AnsweredAssumed Answered

Summary action problem

Question asked by need on Feb 23, 2012
Latest reply on Feb 27, 2012 by need
Hi all,

i develop a custom folder action in Alfresco share 4.0.b and i have a problem with retrieve custom properties nome, this is my snipplet code action:


public void executeImpl(Action action, NodeRef actionedUponNodeRef){
       
       if (this.nodeService.exists(actionedUponNodeRef) == true){
          
          StringBuffer nomiSB = new StringBuffer();
            StringBuffer tipoSB = new StringBuffer();
          
            NodeRef parentNodeRef = nodeService.getPrimaryParent(actionedUponNodeRef).getChildRef();
           
            List<ChildAssociationRef> children =  nodeService.getChildAssocs(actionedUponNodeRef);
          for (ChildAssociationRef childAssoc:children){
             childNodeRef = childAssoc.getChildRef();
             //nodeService.getProperty(childNodeRef,ASSOC_NAME_ECOH_CV).toString();
             Map<QName, Serializable> properties = nodeService.getProperties(childNodeRef);
               String name = (String) properties.get(ContentModel.PROP_NAME);
               if (name != null && name != "") {
                  nomiSB.append(name);
                  nomiSB.append("    ");       
               }else {nomiSB.append("NULL");}
               String nome = (String) properties.get("ecoh:nome");
               if (nome != null && nome != "") {
                  tipoSB.append(nome);
                  tipoSB.append("    ");
               }  else {tipoSB.append("NULL");}
          }
          
          QName prova = QName.createQName("http://www.alfresco.org/model/content/1.0", "content");
          org.alfresco.service.cmr.model.FileInfo summaryfile = fileFolderService.create(parentNodeRef, "Summary.html", prova);
          NodeRef summary = summaryfile.getNodeRef();
          
            ContentWriter writer = contentService.getWriter(summary, ContentModel.PROP_CONTENT, true);
           String content = "<h3>Riassunto dati CV</h3>" +
                        "<table>" +
                        "<tr>"+nomiSB.toString()+"</tr>" +
                        "<td>"+tipoSB.toString()+"</td>" +
                        "</table>";
           writer.setMimetype("text/html");
         writer.putContent(content);
        }

the name of the file are printed in Summary.html but the properties ecoh:nome is null why? what's wrong?

to get to this thank Jeff Potts who helped me a lot

Outcomes