AnsweredAssumed Answered

How to modify the creation date ?

Question asked by jarkusk90 on Apr 24, 2018
Latest reply on May 1, 2018 by douglascrp

Hello everyone:

I moved the contents of one repository to another, all right ... but the creation date was modified. I'm working with CMIS and it does not work when I try to change it because it's a read-only metadata, I found this piece of code that could solve my problem:

policyBehaviourFilter.disableBehaviour(node, ContentModel.ASPECT_AUDITABLE);
// Update CreatedDate
 nodeService.setProperty(node, ContentModel.PROP_CREATED, dateTime);
//Enable policy
policyBehaviourFilter.enableBehaviour(node, ContentModel.ASPECT_AUDITABLE);

 

but the truth is that I do not know how to create the ServiceRegistry, NodeService, BehaviourFilterv or Behavior and connect it to alfresco, with CMIS I do it this way:

 

Map<String, String> parameter = new HashMap<>();
parameter.put(SessionParameter.USER, “admin”));
parameter.put(SessionParameter.PASSWORD,”admin”);
parameter.put(SessionParameter.ATOMPUB_URL,”http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom”);
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
// Object factory de Alfresco
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

SessionFactory factory = SessionFactoryImpl.newInstance();

Session session = factory.createSession(parameter);

 

And it works fine!! I am using alfresco community edition and I have Spring 4 configured in my project.

It would be great if someone could help me.

Thank you

Outcomes