HiI've created an alfresco AMP that writes new nodes with a specified custom modeland pdf contents related to these nodes.Everything works properly except for the indexation of contents. I've tried everything,but nothing seem to solve the problemhere is the method that writes new content from a bean:
/**
* Inserts the new in protocol record in alfresco
* @param bean
* @return boolean
*/
public void insertNewInProtocol(ProtocolBean bean) {
logger.info("Method insertNewInProtocol of ContentManager");
NodeRef assigned = getNodeRef(protocolRootNode, this.divisionsMap.get(bean.getAssegnatari().get(0)));
UserTransaction tx = null;
TransactionService transactionService = serviceRegistry.getTransactionService();
InputStream is = null;
try{
tx = transactionService.getUserTransaction();
tx.begin();
Map<QName, Serializable> protocolData = getProtocolValues(bean);
ChildAssociationRef nodeRef = nodeService.createNode(assigned,
ContentModel.ASSOC_CONTAINS,
QName.createQName(ProtocolListenersModel.fl, bean.getNumeroProtocollo()),
ProtocolListenersModel.PROTOCOLLO_DOCUMENTO,
protocolData);
NodeRef node = nodeRef.getChildRef();
// Put the titled aspect
Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>();
titledProps.put(ContentModel.PROP_TITLE, bean.getNumeroProtocollo());
titledProps.put(ContentModel.PROP_DESCRIPTION, "Importato da Protocollo");
nodeService.addAspect(node, ContentModel.ASPECT_TITLED, titledProps);
ContentWriter writer = contentService.getWriter(node, ContentModel.PROP_CONTENT, true);
MimetypeService mimetypeService = serviceRegistry.getMimetypeService();
writer.setMimetype(mimetypeService.guessMimetype(bean.getPathImmagine()));
writer.setEncoding("UTF-8");
is = bean.getImmaginedocumento();
writer.putContent(is);
tx.commit();
logger.info("End Method insertNewInProtocol of ContentManager");
} catch (Exception e) {
logger.error(e.getMessage());
}
}
the method getProtocolValues creates an HashMap of QNames according to the bean data;all the values are created correctly in alfresco and there are no errors in the alfresco.logand in catalina.out log, but when I try to search something in the pdf content nothing matches.By the way all of the properties related to my new content model are indexed and searched correctly.For completeness I write the new model definition
<type name="fl:protocolloDocument">
<title>Documento Protocollato</title>
<parent>cm:content</parent>
<properties>
<property name="fl:type" >
<type>d:text</type>
<mandatory>true</mandatory>
<default>I</default>
<constraints>
<constraint ref="fl:protocolType"/>
</constraints>
</property>
<property name="fl:numeroProtocollo" >
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="fl:assegnatario">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="fl:dataRegistrazione">
<type>d:date</type>
</property>
<property name="fl:status" >
<type>d:text</type>
<mandatory>false</mandatory>
<default>Assegnato</default>
<constraints>
<constraint ref="fl:documentStatus"/>
</constraints>
</property>
<property name="fl:oggetto" >
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="fl:oggettoEsteso" >
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="fl:mittente" >
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="fl:destinatario" >
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="fl:protocolloMittente" >
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="fl:dataProtocolloMittente">
<type>d:date</type>
</property>
<property name="fl:incaricato">
<type>d:text</type>
</property>
<property name="fl:note">
<type>d:text</type>
<mandatory>false</mandatory>
</property>
<property name="fl:riservato">
<type>d:boolean</type>
<default>false</default>
</property>
</properties>
</type>
Please give me some help, I'm going out of my mind for this problem!Thanks in advanceRoberto