ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
String text = textoHTML;
ContentFormat contentFormat = new ContentFormat("application/msword", "UTF-8");
contentService.write(content, Constants.PROP_CONTENT, text.getBytes(), contentFormat);
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
ParentReference companyHomeParent = new ParentReference(storeRef, null, "/app:company_home", Constants.ASSOC_CONTAINS, null);
String id=companyHomeParent.getUuid();
Reference nodeRef = new Reference(storeRef, id, null);
ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT);
if (reader != null && reader.exists())
{
// get the transformer
ContentTransformer transformer = contentService.getTransformer(reader.getMimetype(), MimetypeMap.MIMETYPE_TEXT_PLAIN);
// is this transformer good enough?
if (transformer == null)
{
// We have a transformer that is fast enough
ContentWriter writer = contentService.getTempWriter();
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
try
{
transformer.transform(reader, writer);
// point the reader to the new-written content
reader = writer.getReader();
// Check that the reader is a view onto something concrete
if (!reader.exists())
{
throw new ContentIOException("The transformation did not write any content, yet: \n"
+ " transformer: " + transformer + "\n" + " temp writer: " + writer);
}
}
catch (ContentIOException e)
{
}
}
}
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
ServiceRegistry serviceRegistry = (ServiceRegistry) context.getBean(ServiceRegistry.SERVICE_REGISTRY);
Pero me da la impresión de que para utilizar estas clases de Spring, necesitaria el entorno, que yo no tengo. Eestoy haciendo un portlet para liferay, java basico y no tengo el alfresco instalado en el mismo sitio que el liferay, por lo que cuando va a buscar el application-context.xml, no lo encuentra logicamente…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.