03-23-2011 04:59 AM
03-23-2011 05:29 AM
03-23-2011 12:02 PM
package com.surevine.proto.alfresco.repo.action;
public class ChangeModificationDateAction extends ActionExecuterAbstractBase {
private NodeService _nodeService;
private BehaviourFilter _policyFilter;
public void setPolicyFilter(BehaviourFilter setFilter)
{
_policyFilter=setFilter;
}
public void setNodeService(NodeService nodeService)
{
_nodeService=nodeService;
}
@Override
protected void executeImpl(Action arg0, NodeRef arg1) {
try
{
Date yesterday = new Date(new Date().getTime()-(1000l*60l*60l*24l)); //I've also tried new Date(0l)
_policyFilter.disableBehaviour(arg1, ContentModel.ASPECT_AUDITABLE);
_nodeService.setProperty(arg1, ContentModel.PROP_TITLE, "Modified by test action!"); //Just to confirm the action has actually run
_nodeService.setProperty(arg1, ContentModel.PROP_MODIFIED, yesterday);
}
finally
{
_policyFilter.enableBehaviour(arg1, ContentModel.ASPECT_AUDITABLE);
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> arg0)
{
//Intentionally blank
}
}
curl -u admin:xxxxxxxxx -d "" "http://localhost:8080/alfresco/service/api/audit/control/CMISChangeLog/CMISChangeLog?enable=false"
03-23-2011 12:53 PM
package com.surevine.alfresco.repo.action;
import java.util.Date;
import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
/**
*Prototype code - not for production use
* @author simon.white@surevine.com simon.white@gmail.com
*/
public class ChangeModificationDateAction extends ActionExecuterAbstractBase {
private NodeService _nodeService;
private BehaviourFilter _policyFilter;
public void setPolicyFilter(BehaviourFilter setFilter)
{
_policyFilter=setFilter;
}
public void setNodeService(NodeService nodeService)
{
_nodeService=nodeService;
}
@Override
protected void executeImpl(Action arg0, NodeRef arg1) {
try
{
Date yesterday = new Date(new Date().getTime()-(1000l*60l*60l*24l));
_policyFilter.disableBehaviour( ContentModel.ASPECT_VERSIONABLE);
_policyFilter.disableBehaviour(arg1, ContentModel.ASPECT_AUDITABLE);
_nodeService.setProperty(arg1, ContentModel.PROP_TITLE, "Modified by test action!");
_nodeService.setProperty(arg1, ContentModel.PROP_MODIFIED, yesterday);
}
finally
{
_policyFilter.enableBehaviour(arg1, ContentModel.ASPECT_AUDITABLE);
_policyFilter.enableBehaviour(arg1, ContentModel.ASPECT_VERSIONABLE);
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> arg0)
{
//Intentionally blank
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="com.surevine.alfresco.repo.action.ChangeModificationDateAction" class="com.surevine.alfresco.repo.action.ChangeModificationDateAction" parent="action-executer">
<property name="nodeService">
<ref bean="nodeService" />
</property>
<property name="policyFilter">
<ref bean="policyBehaviourFilter" />
</property>
</bean>
</beans>
04-06-2011 12:42 PM
05-21-2013 05:58 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.