本文整理汇总了Java中org.alfresco.service.cmr.action.ActionService.createAction方法的典型用法代码示例。如果您正苦于以下问题:Java ActionService.createAction方法的具体用法?Java ActionService.createAction怎么用?Java ActionService.createAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.action.ActionService
的用法示例。
在下文中一共展示了ActionService.createAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCreateThumbnailAction
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
public static Action createCreateThumbnailAction(ThumbnailDefinition thumbnailDef, ServiceRegistry services)
{
ActionService actionService = services.getActionService();
Action action = actionService.createAction(CreateThumbnailActionExecuter.NAME);
action.setParameterValue(CreateThumbnailActionExecuter.PARAM_THUMBANIL_NAME, thumbnailDef.getName());
decorateAction(thumbnailDef, action, actionService);
return action;
}
示例2: decorateAction
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
private static void decorateAction(ThumbnailDefinition thumbnailDef, Action action, ActionService actionService)
{
final FailureHandlingOptions failureOptions = thumbnailDef.getFailureHandlingOptions();
long retryPeriod = failureOptions == null ? FailureHandlingOptions.DEFAULT_PERIOD : failureOptions.getRetryPeriod() * 1000l;
int retryCount = failureOptions == null ? FailureHandlingOptions.DEFAULT_RETRY_COUNT : failureOptions.getRetryCount();
long quietPeriod = failureOptions == null ? FailureHandlingOptions.DEFAULT_PERIOD : failureOptions.getQuietPeriod() * 1000l;
boolean quietPeriodRetriesEnabled = failureOptions == null ?
FailureHandlingOptions.DEFAULT_QUIET_PERIOD_RETRIES_ENABLED : failureOptions.getQuietPeriodRetriesEnabled();
// The thumbnail/action should only be run if it is eligible.
Map<String, Serializable> failedThumbnailConditionParams = new HashMap<String, Serializable>();
failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_THUMBNAIL_DEFINITION_NAME, thumbnailDef.getName());
failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_PERIOD, retryPeriod);
failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_RETRY_COUNT, retryCount);
failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD, quietPeriod);
failedThumbnailConditionParams.put(NodeEligibleForRethumbnailingEvaluator.PARAM_QUIET_PERIOD_RETRIES_ENABLED, quietPeriodRetriesEnabled);
ActionCondition thumbnailCondition = actionService.createActionCondition(NodeEligibleForRethumbnailingEvaluator.NAME, failedThumbnailConditionParams);
// If it is run and if it fails, then we want a compensating action to run which will mark
// the source node as having failed to produce a thumbnail.
Action applyBrokenThumbnail = actionService.createAction("add-failed-thumbnail");
applyBrokenThumbnail.setParameterValue(AddFailedThumbnailActionExecuter.PARAM_THUMBNAIL_DEFINITION_NAME, thumbnailDef.getName());
applyBrokenThumbnail.setParameterValue(AddFailedThumbnailActionExecuter.PARAM_FAILURE_DATETIME, new Date());
action.addActionCondition(thumbnailCondition);
action.setCompensatingAction(applyBrokenThumbnail);
}
示例3: create
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
/**
* Create an Action
*
* @param actionName
* the action name
* @return the action
*/
public ScriptAction create(String actionName)
{
ScriptAction scriptAction = null;
ActionService actionService = services.getActionService();
ActionDefinition actionDef = actionService.getActionDefinition(actionName);
if (actionDef != null)
{
Action action = actionService.createAction(actionName);
scriptAction = new ScriptAction(this.services, action, actionDef);
scriptAction.setScope(getScope());
}
return scriptAction;
}
示例4: createWorkingSleepAction
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
protected static Action createWorkingSleepAction(String id, ActionService actionService) throws Exception
{
Action workingAction = new CancellableSleepAction(actionService.createAction(SleepActionExecuter.NAME));
workingAction.setTrackStatus(Boolean.TRUE);
if(id != null)
{
Field idF = ParameterizedItemImpl.class.getDeclaredField("id");
idF.setAccessible(true);
idF.set(workingAction, id);
}
return workingAction;
}
示例5: execute
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
/**
* Executer implementation
*/
public void execute() {
LOG.info("Running the scheduled job: Delete Expired Content");
ActionService actionService = serviceRegistry.getActionService();
Action action = actionService.createAction("delete-expired-content");
actionService.executeAction(action, null);
}
开发者ID:Conexiam,项目名称:alfresco-expirable-content,代码行数:11,代码来源:DeleteExpiredContentScheduledJobExecuter.java
示例6: execute
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
protected void execute(final ActionService actionService, final UpdateTagScopesActionExecuter updateTagsAction)
{
// Process
final ArrayList<NodeRef> tagNodes = new ArrayList<NodeRef>();
final HashSet<NodeRef> handledTagNodes = new HashSet<NodeRef>();
while(true)
{
// Fetch a batch of the pending changes
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
{
public Void doWork() throws Exception
{
tagNodes.clear();
tagNodes.addAll(
updateTagsAction.searchForTagScopesPendingUpdates()
);
return null;
}
}, AuthenticationUtil.getSystemUserName()
);
// If we're on our 2nd loop round for any of them, then skip them from now on
// (This can happen if another thread is already processing one of them)
Iterator<NodeRef> it = tagNodes.iterator();
while(it.hasNext())
{
NodeRef nodeRef = it.next();
if(handledTagNodes.contains(nodeRef))
{
it.remove();
if(logger.isDebugEnabled())
logger.debug("Tag scope " + nodeRef + " must be being processed by another Thread, not updating it");
}
}
// Log what we found to process
if(logger.isDebugEnabled())
{
logger.debug("Checked for tag scopes with pending tag updates, found " + tagNodes);
}
// If we're out of tag scopes, stop!
if(tagNodes.size() == 0)
break;
// Have the action run for these tag scope nodes
// Needs to run synchronously
Action action = actionService.createAction(UpdateTagScopesActionExecuter.NAME);
action.setParameterValue(UpdateTagScopesActionExecuter.PARAM_TAG_SCOPES, (Serializable)tagNodes);
actionService.executeAction(action, null, false, false);
// Record the scopes we've just done
handledTagNodes.addAll(tagNodes);
}
}
示例7: setUp
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
actionService = (ActionService) ctx.getBean("actionService");
nodeService = (NodeService) ctx.getBean("nodeService");
transactionService = (TransactionService) ctx.getBean("transactionService");
runtimeActionService = (RuntimeActionService) ctx.getBean("actionService");
service = (ScheduledPersistedActionService) ctx.getBean("ScheduledPersistedActionService");
serviceImpl = (ScheduledPersistedActionServiceImpl) ctx.getBean("scheduledPersistedActionService");
scheduler = (Scheduler) ctx.getBean("schedulerFactory");
bootstrap = (ScheduledPersistedActionServiceBootstrap) ctx.getBean("scheduledPersistedActionServiceBootstrap");
// Set the current security context as admin
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
// Register the test executor, if needed
SleepActionExecuter.registerIfNeeded(ctx);
// Zap all test schedules
List<ScheduledPersistedAction> schedules = service.listSchedules();
for (ScheduledPersistedAction schedule : schedules)
{
service.deleteSchedule(schedule);
}
// Persist an action that uses the test executor
testAction = new TestAction(actionService.createAction(SleepActionExecuter.NAME));
runtimeActionService.createActionNodeRef(testAction, serviceImpl.SCHEDULED_ACTION_ROOT_NODE_REF,
ContentModel.ASSOC_CONTAINS, QName.createQName("TestAction"));
testAction2 = new TestAction(actionService.createAction(SleepActionExecuter.NAME));
runtimeActionService.createActionNodeRef(testAction2, serviceImpl.SCHEDULED_ACTION_ROOT_NODE_REF,
ContentModel.ASSOC_CONTAINS, QName.createQName("TestAction2"));
testAction3 = new TestAction(actionService.createAction(SleepActionExecuter.NAME));
// Finish setup
txn.commit();
// By default, we don't want the scheduler to fire while the tests run
// Certain tests will enable it as required
scheduler.standby();
}
示例8: setUp
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
actionService = (ActionService) ctx.getBean("actionService");
nodeService = (NodeService) ctx.getBean("nodeService");
transactionService = (TransactionService) ctx
.getBean("transactionService");
runtimeActionService = (RuntimeActionService) ctx
.getBean("actionService");
service = (ScheduledPersistedActionService) ctx
.getBean("ScheduledPersistedActionService");
serviceImpl = (ScheduledPersistedActionServiceImpl) ctx
.getBean("scheduledPersistedActionService");
scheduler = (Scheduler) ctx.getBean("schedulerFactory");
bootstrap = (ScheduledPersistedActionServiceBootstrap) ctx
.getBean("scheduledPersistedActionServiceBootstrap");
// Set the current security context as admin
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil
.getAdminUserName());
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
// Register the test executor, if needed
SleepActionExecuter.registerIfNeeded(ctx);
// Zap all test schedules
List<ScheduledPersistedAction> schedules = service.listSchedules();
for (ScheduledPersistedAction schedule : schedules)
{
service.deleteSchedule(schedule);
}
// Persist an action that uses the test executor
testAction = new TestAction(actionService
.createAction(SleepActionExecuter.NAME));
runtimeActionService.createActionNodeRef(
testAction, serviceImpl.SCHEDULED_ACTION_ROOT_NODE_REF,
ContentModel.ASSOC_CONTAINS, QName.createQName("TestAction"));
testAction2 = new TestAction(actionService
.createAction(SleepActionExecuter.NAME));
runtimeActionService.createActionNodeRef(
testAction2, serviceImpl.SCHEDULED_ACTION_ROOT_NODE_REF,
ContentModel.ASSOC_CONTAINS, QName.createQName("TestAction2"));
testAction3 = new TestAction(actionService
.createAction(SleepActionExecuter.NAME));
// Finish setup
txn.commit();
// By default, we don't want the scheduler to fire while the tests run
// Certain tests will enable it as required
scheduler.standby();
}
示例9: executePDFAction
import org.alfresco.service.cmr.action.ActionService; //导入方法依赖的package包/类
/**
* Executes a specific PDF action called by the service
*
* @param name
* @param params
* @param actioned
*/
private void executePDFAction(String name, Map<String, Serializable> params, NodeRef actioned)
{
ActionService actionService = serviceRegistry.getActionService();
Action toExecute = actionService.createAction(name, params);
actionService.executeAction(toExecute, actioned);
}