How to modify the creation date ?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

How to modify the creation date ?

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

4 Replies
Highlighted
Advanced II

Re: How to modify the creation date ?

I guess you will not be able to execute that code by using CMIS.

Maybe it would be better to implement the code as an Alfresco service, and then expose it as a REST API you could use it to execute it.

You can find a useful tutorial on how to develop this kind of customizations at A Simple Pattern for Alfresco Extensions | 

Highlighted
Active Member

Re: How to modify the creation date ?

Thanks Douglas:

I'll take a look at the tutorial and then comment on my experience.

Highlighted
Active Member

Re: How to modify the creation date ?

I am sorry,

I could not find in this tutorial what I was looking for, although I found that very interesting work method, which I could start using later, but for now I'm just a simple beginner who only knows how to work with CMIS, I do not know if Alfresco exposes some service that returns some Service Registry, NodeService, BehaviorFilter or Behavior, or what configuration I must do in Spring to be able to inject any of those objects in my beans, sorry for being a beginner.

Please, help me.

Thank you

Highlighted
Advanced II

Re: How to modify the creation date ?

Those are not CMIS compatible components, so you are not going to be able to use them.