Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
ParentReference companyHomeParent = new ParentReference(storeRef, null, "/app:company_home", Constants.ASSOC_CONTAINS, null);
companyHomeParent.setChildName("cm:" + name);
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);
NamedValue[] titledProps = new NamedValue[2];
titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, titulo);
titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION, descripción);
CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED, titledProps, null, "1");
CML cml = new CML();
cml.setCreate(new CMLCreate[] {create});
cml.setAddAspect(new CMLAddAspect[] {addAspect});
UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
Reference content = result[0].getDestination();
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
String text = textoHTML;
// hay que darle el formato segun el tipo!!!
ContentFormat contentFormat=null;
if (tipo.equalsIgnoreCase("html")){
contentFormat = new ContentFormat("application/msword", "UTF-8");
}
if (tipo.equalsIgnoreCase("txt")){
contentFormat = new ContentFormat("plain/text", "UTF-8");
}
if (tipo.equalsIgnoreCase("pdf")){
contentFormat = new ContentFormat("application/pdf", "UTF-8");
}
contentService.write(content, Constants.PROP_CONTENT, text.getBytes(), contentFormat);
String luceneQuery ="@cm\\:name:"+name+"" ;
Query query = new Query("lucene", luceneQuery);
Store storeRef = new Store("workspace", "SpacesStore");
Agradeceria cualquier indicación porque llevo varios dias con este embrollo y no doy con la solución…Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.