07-30-2008 07:59 AM
07-31-2008 05:45 AM
07-31-2008 06:52 AM
//First, I create the container
CML cml = new CML();
CML.Create create = new CML.Create();
create.setId("create_1");
List<NamedValue> propertyList = new ArrayList<NamedValue>();
//CM_NAME={http://www.alfresco.org/model/content/1.0}name
NamedValue nv = createNamedValue(CM_NAME, name);
propertyList.add(nv);
//CM_DESCRIPTION={http://www.alfresco.org/model/content/1.0}description
NamedValue nvd = createNamedValue(CM_DESCRIPTION, description);
propertyList.add(nvd);
//CM_TITLE={http://www.alfresco.org/model/content/1.0}title
NamedValue nvt = createNamedValue(CM_TITLE, title);
propertyList.add(nvt);
create.getProperty().addAll(propertyList);
Store store = createDefaultStore();
//creates a ParentReference
ParentReference parentReference =
createParent(store, path, parentPath);
//JAX-WS annoying JAXBElement with nillable SOAP elements. This is the same in Axis client
//that create.setParent(parentReference);
create.setParent(
new JAXBElement<ParentReference>(
QName.valueOf(CML_PARENT),
ParentReference.class,
parentReference));
create.setType(type);
cml.getCreate().add(create);
List<UpdateResult> r = null;
try {
r = repoPort.update(cml);
} catch (RepositoryFault_Exception e) {
throw new RuntimeException(
e.getFaultInfo().getErrorCode() + ", " +
e.getFaultInfo().getMessage(), e);
}
//at this point, we can see the content in the web client, buy empty
//Now, I fill the containter with data (a curious Spanish "palíndromo")
byte[] data = "Dábale arroz a la zorra el abad".getBytes("utf-8");
//creates a Reference (in this case, with a valid path, id is ignored)
Reference reference = createReference(store, path, id);
ContentFormat format = new ContentFormat();
format.setMimetype("text/plain");
format.setEncoding("utf-8");
try {
//CM_CONTENT={http://www.alfresco.org/model/content/1.0}content
contentPort.write(reference, CM_CONTENT, data, format);
} catch (ContentFault_Exception e) {
throw new RuntimeException(
e.getFaultInfo().getErrorCode() + ", " +
e.getFaultInfo().getMessage(), e);
}
//at this point, we have uploaded the content, and we can access to it by the web client.
08-06-2008 09:43 AM
Is this a Alfresco-bug? Is this a programmer-bug?
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.