01-10-2007 06:47 AM
01-26-2007 10:28 AM
02-01-2007 08:43 AM
// Load a custom model using the cm:dictionaryModel type
CMLCreate create = new CMLCreate();
create.setId("id1");
create.setType(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, "dictionaryModel"));
ParentReference parentReference = new ParentReference(new Store(Constants.WORKSPACE_STORE, "SpacesStore"), null, "/app:company_home", Constants.ASSOC_CONTAINS, Constants.ASSOC_CONTAINS);
create.setParent(parentReference);
create.setProperty(new NamedValue[] {
new NamedValue(
Constants.PROP_NAME,
false,
"testModel.xml",
null),
new NamedValue(
Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, "modelActive"),
false,
"true",
null)});
CML cml = new CML();
cml.setCreate(new CMLCreate[]{create});
UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml);
Reference model = results[0].getDestination();
// Now add the content to the model
InputStream viewStream = getClass().getClassLoader().getResourceAsStream("org/alfresco/webservice/test/resources/propertymodel.xml");
byte[] bytes = ContentUtils.convertToByteArray(viewStream);
this.contentService.write(model, Constants.PROP_CONTENT, bytes, new ContentFormat(Constants.MIMETYPE_XML, "UTF-8"));
03-05-2007 08:36 AM
It is possible to add a model to the repo at run time, but it is currently unsupported.
04-18-2007 06:43 AM
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.