As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(); titledProps.put(ContentModel.PROP_TITLE, name); titledProps.put(ContentModel.PROP_DESCRIPTION, name);
// Assign name String name = "Web Services sample (" + System.currentTimeMillis() + ")"; companyHomeParent.setChildName("cm:" + name); // Construct CML statement to create content node // Note: Assign "1" as a local id, so we can refer to it in subsequent // CML statements within the same CML block NamedValue[] contentProps = new NamedValue[1]; contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, name); CMLCreate create = new CMLCreate("1", companyHomeParent, null, null, null, Constants.TYPE_CONTENT, contentProps); // Construct CML statement to add titled aspect NamedValue[] titledProps = new NamedValue[2]; titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, name); titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, name); CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED, titledProps, null, "1"); // Construct CML Block CML cml = new CML(); cml.setCreate(new CMLCreate[] {create}); cml.setAddAspect(new CMLAddAspect[] {addAspect});
{http://www.alfresco.org/ws/service/repository/1.0}RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>java.lang.NullPointerException</ns1:message>
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService(); ParentReference parentReference = new ParentReference(STORE, null, "/app:company_home/cm:sample_folder", Constants.ASSOC_CONTAINS, Constants.ASSOC_CONTAINS); NamedValue[] properties = new NamedValue[]{Utils.createNamedValue(Constants.PROP_NAME, System.currentTimeMillis() + "_WebServiceSample4.txt")}; CMLCreate create = new CMLCreate("id1", parentReference, null, null, null, Constants.TYPE_CONTENT, properties); CMLUpdate update = new CMLUpdate(); ParentReference parentReference2 = new ParentReference(STORE, null, "/app:company_home/cm:sample_folder/cm:hola.txt", Constants.ASSOC_CONTAINS, "{" + Constants.NAMESPACE_CONTENT_MODEL + "}" + "hola.txt"); String aspectString = Constants.createQNameString("modelo.regasoc", "aspectRegasoc"); NamedValue[] titledProps = new NamedValue[3]; titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, "pablo"); titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, "descripción"); titledProps[2] = Utils.createNamedValue(Constants.createQNameString("modelo.regasoc", "nexpediente"), "10"); CMLAddAspect addAspect = new CMLAddAspect(aspectString, titledProps, null, null); Predicate predicate = new Predicate(new Reference[]{parentReference2}, null, null); update.setWhere(predicate); CML cml = new CML(); cml.setUpdate(new CMLUpdate[]{update}); cml.setAddAspect(new CMLAddAspect[] {addAspect}); UpdateResult[] updateResults = repositoryService.update(cml);
titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, "pablo"); CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED, titledProps, null, "1");
ParentReference parentReference2 = new ParentReference(STORE, null, "/app:company_home/cm:sample_folder/cm:hola.txt", Constants.ASSOC_CONTAINS, "{" + Constants.NAMESPACE_CONTENT_MODEL + "}" + "hola.txt");