AnsweredAssumed Answered

Get name of content.

Question asked by savah on Jan 31, 2008

I think i need some help here!

Below is a class that runs a stored procedure on our SQL Server, returns a number (protocolNumber) and populates a custom aspect added on each content with this number.

What i want to do is after the aspect has been populated to change the Local Name of the content (based on NodeRef) to "protocolnumber" + extension.

Is it possible to get the name using java?

Any help will be greatly appreciated!

Paris Kapsouros

public class InsertProtocolNumber extends org.alfresco.repo.action.executer.ActionExecuterAbstractBase {
   private NodeService nodeService;
   public void setNodeService(NodeService nodeService) {
      this.nodeService = nodeService;
    protected void executeImpl(Action action, NodeRef nodeRef) {
        String OMLocalName = new String ();
        // Check that the node still exists
        if (nodeService.exists(nodeRef)) {
            //add aspect
            nodeService.addAspect(nodeRef, org.alfresco.service.namespace.QName.createQName("custom.model", "protocolDocDetails"), null);
            //set protocol number
            nodeService.setProperty(nodeRef, org.alfresco.service.namespace.QName.createQName("custom.model", "DocProtocolID"), ProtocolNumber.getNext());