本文整理汇总了Java中org.alfresco.repo.action.ActionModel类的典型用法代码示例。如果您正苦于以下问题:Java ActionModel类的具体用法?Java ActionModel怎么用?Java ActionModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionModel类属于org.alfresco.repo.action包,在下文中一共展示了ActionModel类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadRenditionDefinitions
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
public List<RenditionDefinition> loadRenditionDefinitions()
{
checkRenderingActionRootNodeExists();
// Note that in the call to getChildAssocs below, only the specified
// types are included.
// Subtypes of the type action:action will not be returned.
Set<QName> actionTypes = new HashSet<QName>();
actionTypes.add(ActionModel.TYPE_ACTION);
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(RENDERING_ACTION_ROOT_NODE_REF, actionTypes);
List<RenditionDefinition> renderingActions = new ArrayList<RenditionDefinition>(childAssocs.size());
for (ChildAssociationRef actionAssoc : childAssocs)
{
Action nextAction = runtimeActionService.createAction(actionAssoc.getChildRef());
renderingActions.add(new RenditionDefinitionImpl(nextAction));
}
return renderingActions;
}
示例2: checkNodeType
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
/**
* Looks at the type of the node and indicates whether the node can have rules associated with it
*
* @param nodeRef the node reference
* @return true if the node can have rule associated with it (inherited or otherwise)
*/
private boolean checkNodeType(NodeRef nodeRef)
{
boolean result = true;
QName nodeType = this.runtimeNodeService.getType(nodeRef);
if (this.dictionaryService.isSubClass(nodeType, ContentModel.TYPE_SYSTEM_FOLDER) == true ||
this.dictionaryService.isSubClass(nodeType, ActionModel.TYPE_ACTION) == true ||
this.dictionaryService.isSubClass(nodeType, ActionModel.TYPE_ACTION_CONDITION) == true ||
this.dictionaryService.isSubClass(nodeType, ActionModel.TYPE_ACTION_PARAMETER) == true)
{
result = false;
if (logger.isDebugEnabled() == true)
{
logger.debug("A node of type " + nodeType.toString() + " was checked and can not have rules.");
}
}
return result;
}
示例3: getOwningNodeRefActionImpl
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
private NodeRef getOwningNodeRefActionImpl(NodeRef actionNodeRef)
{
NodeRef result = null;
NodeRef parentNodeRef = this.nodeService.getPrimaryParent(actionNodeRef).getParentRef();
if (parentNodeRef != null)
{
QName parentType = this.nodeService.getType(parentNodeRef);
if (RuleModel.TYPE_RULE.equals(parentType) == true)
{
result = getOwningNodeRefRuleImpl(parentNodeRef);
}
else if (ActionModel.TYPE_COMPOSITE_ACTION.equals(parentType) == true)
{
result = getOwningNodeRefActionImpl(parentNodeRef);
}
}
return result;
}
示例4: getSchedule
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
@Override
public ScheduledPersistedAction getSchedule(NodeRef persistedActionNodeRef)
{
if (persistedActionNodeRef == null)
{
// action is not persistent
return null;
}
// locate associated schedule for action
List<AssociationRef> assocs = nodeService.getSourceAssocs(persistedActionNodeRef, ActionModel.ASSOC_SCHEDULED_ACTION);
AssociationRef scheduledAssoc = null;
for (AssociationRef assoc : assocs)
{
scheduledAssoc = assoc;
}
if (scheduledAssoc == null)
{
// there is no associated schedule
return null;
}
// load the scheduled action
return loadPersistentSchedule(scheduledAssoc.getSourceRef());
}
示例5: createPersistentSchedule
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
private void createPersistentSchedule(ScheduledPersistedActionImpl schedule)
{
ChildAssociationRef childAssoc = nodeService.createNode(SCHEDULED_ACTION_ROOT_NODE_REF,
ContentModel.ASSOC_CONTAINS, QName.createQName(GUID.generate()),
ActionModel.TYPE_ACTION_SCHEDULE);
schedule.setPersistedAtNodeRef(childAssoc.getChildRef());
}
示例6: loadPersistentSchedule
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
protected ScheduledPersistedActionImpl loadPersistentSchedule(NodeRef schedule)
{
if (!nodeService.exists(schedule))
return null;
// create action
Action action = null;
AssociationRef actionAssoc = findActionAssociationFromSchedule(schedule);
if (actionAssoc != null)
{
action = runtimeActionService.createAction(actionAssoc.getTargetRef());
}
// create schedule
ScheduledPersistedActionImpl scheduleImpl = new ScheduledPersistedActionImpl(action);
scheduleImpl.setPersistedAtNodeRef(schedule);
scheduleImpl.setScheduleLastExecutedAt((Date)nodeService.getProperty(schedule, ActionModel.PROP_LAST_EXECUTED_AT));
scheduleImpl.setScheduleStart((Date)nodeService.getProperty(schedule, ActionModel.PROP_START_DATE));
scheduleImpl.setScheduleIntervalCount((Integer)nodeService.getProperty(schedule, ActionModel.PROP_INTERVAL_COUNT));
String period = (String)nodeService.getProperty(schedule, ActionModel.PROP_INTERVAL_PERIOD);
if (period != null)
{
scheduleImpl.setScheduleIntervalPeriod(IntervalPeriod.valueOf(period));
}
return scheduleImpl;
}
示例7: findActionAssociationFromSchedule
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
private AssociationRef findActionAssociationFromSchedule(NodeRef schedule)
{
List<AssociationRef> assocs = nodeService.getTargetAssocs(schedule, ActionModel.ASSOC_SCHEDULED_ACTION);
AssociationRef actionAssoc = null;
for (AssociationRef assoc : assocs)
{
actionAssoc = assoc;
}
return actionAssoc;
}
示例8: execute
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
public void execute(final JobExecutionContext jobContext)
{
// Do all this work as system
// TODO - See if we can pinch some bits from the existing scheduled
// actions around who to run as
AuthenticationUtil.setRunAsUserSystem();
transactionService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionCallback<Void>() {
public Void execute() throws Throwable {
// Update the last run time on the schedule
NodeRef scheduleNodeRef = new NodeRef(
jobContext.getMergedJobDataMap().getString(JOB_SCHEDULE_NODEREF)
);
nodeService.setProperty(
scheduleNodeRef,
ActionModel.PROP_LAST_EXECUTED_AT,
new Date()
);
// Create the action object
NodeRef actionNodeRef = new NodeRef(
jobContext.getMergedJobDataMap().getString(JOB_ACTION_NODEREF)
);
Action action = runtimeActionService.createAction(
actionNodeRef
);
// Have it executed asynchronously
actionService.executeAction(
action, (NodeRef)null,
false, true
);
// Real work starts when the transaction completes
return null;
}
}, false, true
);
}
示例9: getSchedule
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
/**
* Returns the schedule for the specified action, or null if it isn't
* currently scheduled.
*/
public ScheduledPersistedAction getSchedule(Action persistedAction)
{
NodeRef nodeRef = persistedAction.getNodeRef();
if (nodeRef == null)
{
// action is not persistent
return null;
}
// locate associated schedule for action
List<AssociationRef> assocs = nodeService.getSourceAssocs(nodeRef, ActionModel.ASSOC_SCHEDULED_ACTION);
AssociationRef scheduledAssoc = null;
for (AssociationRef assoc : assocs)
{
scheduledAssoc = assoc;
}
if (scheduledAssoc == null)
{
// there is no associated schedule
return null;
}
// load the scheduled action
return loadPersistentSchedule(scheduledAssoc.getSourceRef());
}
示例10: init
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
/**
* Registers to listen for events of interest. For instance, the creation or deletion of a rule folder
* will affect the caching of rules.
*/
public void init()
{
policyComponent.bindAssociationBehaviour(
NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME,
RuleModel.ASPECT_RULES,
RuleModel.ASSOC_RULE_FOLDER,
new JavaBehaviour(this, "onCreateChildAssociation"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnAddAspectPolicy.QNAME,
RuleModel.ASPECT_RULES,
new JavaBehaviour(this, "onAddAspect"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnUpdateNodePolicy.QNAME,
RuleModel.ASPECT_RULES,
new JavaBehaviour(this, "onUpdateNode"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnCreateNodePolicy.QNAME,
RuleModel.TYPE_RULE,
new JavaBehaviour(this, "onCreateNode"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnUpdateNodePolicy.QNAME,
RuleModel.TYPE_RULE,
new JavaBehaviour(this, "onUpdateNode"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnCreateNodePolicy.QNAME,
ActionModel.TYPE_ACTION_BASE,
new JavaBehaviour(this, "onCreateNode"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnUpdateNodePolicy.QNAME,
ActionModel.TYPE_ACTION_BASE,
new JavaBehaviour(this, "onUpdateNode"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnCreateNodePolicy.QNAME,
ActionModel.TYPE_ACTION_PARAMETER,
new JavaBehaviour(this, "onCreateNode"));
policyComponent.bindClassBehaviour(
NodeServicePolicies.OnUpdateNodePolicy.QNAME,
ActionModel.TYPE_ACTION_PARAMETER,
new JavaBehaviour(this, "onUpdateNode"));
}
示例11: updatePersistentSchedule
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
private void updatePersistentSchedule(ScheduledPersistedActionImpl schedule)
{
NodeRef nodeRef = schedule.getPersistedAtNodeRef();
if (nodeRef == null)
throw new IllegalStateException("Must be persisted first");
// update schedule properties
nodeService.setProperty(nodeRef, ActionModel.PROP_START_DATE, schedule.getScheduleStart());
nodeService.setProperty(nodeRef, ActionModel.PROP_INTERVAL_COUNT, schedule.getScheduleIntervalCount());
IntervalPeriod period = schedule.getScheduleIntervalPeriod();
nodeService.setProperty(nodeRef, ActionModel.PROP_INTERVAL_PERIOD, period == null ? null : period.name());
// We don't save the last executed at date here, that only gets changed
// from within the execution loop
// update scheduled action (represented as an association)
// NOTE: can only associate to a single action from a schedule (as specified by the action model)
// update association to reflect updated schedule
AssociationRef actionAssoc = findActionAssociationFromSchedule(nodeRef);
NodeRef actionNodeRef = schedule.getActionNodeRef();
try
{
behaviourFilter.disableBehaviour(ActionModel.TYPE_ACTION_SCHEDULE);
if (actionNodeRef == null)
{
if (actionAssoc != null)
{
// remove associated action
nodeService.removeAssociation(actionAssoc.getSourceRef(), actionAssoc.getTargetRef(), actionAssoc.getTypeQName());
}
}
else
{
if (actionAssoc == null)
{
// create associated action
nodeService.createAssociation(nodeRef, actionNodeRef, ActionModel.ASSOC_SCHEDULED_ACTION);
}
else if (!actionAssoc.getTargetRef().equals(actionNodeRef))
{
// associated action has changed... first remove existing association
nodeService.removeAssociation(actionAssoc.getSourceRef(), actionAssoc.getTargetRef(), actionAssoc.getTypeQName());
nodeService.createAssociation(nodeRef, actionNodeRef, ActionModel.ASSOC_SCHEDULED_ACTION);
}
}
}
finally
{
behaviourFilter.enableBehaviour(ActionModel.TYPE_ACTION_SCHEDULE);
}
}
示例12: setUp
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
// Detect any dangling transactions as there is a lot of direct UserTransaction manipulation
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
throw new IllegalStateException(
"There should not be any transactions when starting test: " +
AlfrescoTransactionSupport.getTransactionId() + " started at " +
new Date(AlfrescoTransactionSupport.getTransactionStartTime()));
}
// Get services
this.taggingService = (TaggingService)ctx.getBean("TaggingService");
this.nodeService = (NodeService) ctx.getBean("NodeService");
this.contentService = (ContentService) ctx.getBean("ContentService");
this.transactionService = (TransactionService)ctx.getBean("transactionComponent");
this.auditService = (AuditService)ctx.getBean("auditService");
this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
this.executer = (ContentMetadataExtracter) ctx.getBean("extract-metadata");
executer.setEnableStringTagging(true);
executer.setTaggingService(taggingService);
if (init == false)
{
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>(){
@Override
public Void execute() throws Throwable
{
// Authenticate as the system user
authenticationComponent.setSystemUserAsCurrentUser();
// Create the store and get the root node
ContentMetadataExtracterTagMappingTest.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
ContentMetadataExtracterTagMappingTest.rootNode = nodeService.getRootNode(ContentMetadataExtracterTagMappingTest.storeRef);
// Create the required tagging category
NodeRef catContainer = nodeService.createNode(ContentMetadataExtracterTagMappingTest.rootNode, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryContainer"), ContentModel.TYPE_CONTAINER).getChildRef();
NodeRef catRoot = nodeService.createNode(
catContainer,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryRoot"),
ContentModel.TYPE_CATEGORYROOT).getChildRef();
nodeService.createNode(
catRoot,
ContentModel.ASSOC_CATEGORIES,
ContentModel.ASPECT_TAGGABLE,
ContentModel.TYPE_CATEGORY).getChildRef();
MetadataExtracterRegistry registry = (MetadataExtracterRegistry) ctx.getBean("metadataExtracterRegistry");
extractor = new TagMappingMetadataExtracter();
extractor.setRegistry(registry);
extractor.register();
init = true;
return null;
}});
}
// We want to know when tagging actions have finished running
asyncOccurs = (new TaggingServiceImplTest()).new AsyncOccurs();
((PolicyComponent)ctx.getBean("policyComponent")).bindClassBehaviour(
AsynchronousActionExecutionQueuePolicies.OnAsyncActionExecute.QNAME,
ActionModel.TYPE_ACTION,
new JavaBehaviour(asyncOccurs, "onAsyncActionExecute", NotificationFrequency.EVERY_EVENT)
);
// We do want action tracking whenever the tag scope updater runs
UpdateTagScopesActionExecuter updateTagsAction =
(UpdateTagScopesActionExecuter)ctx.getBean("update-tagscope");
updateTagsAction.setTrackStatus(true);
}
示例13: testTypeFiltering
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
/**
* ALF-18968
*
* @see QNameFilterImpl#listOfHardCodedExcludedTypes()
*/
@Test
public void testTypeFiltering() throws Exception
{
// Force an exclusion in order to test the exclusion inheritance
cmisTypeExclusions.setExcluded(ActionModel.TYPE_ACTION_BASE, true);
// Quick check
assertTrue(cmisTypeExclusions.isExcluded(ActionModel.TYPE_ACTION_BASE));
// Test that a type defined with this excluded parent type does not break the CMIS dictionary
DictionaryBootstrap bootstrap = new DictionaryBootstrap();
List<String> bootstrapModels = new ArrayList<String>();
bootstrapModels.add("publicapi/test-model.xml");
bootstrap.setModels(bootstrapModels);
bootstrap.setDictionaryDAO(dictionaryDAO);
bootstrap.setTenantService(tenantService);
bootstrap.bootstrap();
cmisDictionary.afterDictionaryInit();
final TestNetwork network1 = getTestFixture().getRandomNetwork();
String username = "user" + System.currentTimeMillis();
PersonInfo personInfo = new PersonInfo(username, username, username, TEST_PASSWORD, null, null, null, null, null, null, null);
TestPerson person1 = network1.createUser(personInfo);
String person1Id = person1.getId();
// test that this type is excluded; the 'action' model (act prefix) is in the list of hardcoded exclusions
QName type = QName.createQName("{http://www.alfresco.org/test/testCMIS}type1");
assertTrue(cmisTypeExclusions.isExcluded(type));
// and that we can't get to it through CMIS
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
try
{
cmisSession.getTypeDefinition("D:testCMIS:type1");
fail("Type should not be available");
}
catch(CmisObjectNotFoundException e)
{
// ok
}
}
示例14: setUp
import org.alfresco.repo.action.ActionModel; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
// Detect any dangling transactions as there is a lot of direct UserTransaction manipulation
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
throw new IllegalStateException(
"There should not be any transactions when starting test: " +
AlfrescoTransactionSupport.getTransactionId() + " started at " +
new Date(AlfrescoTransactionSupport.getTransactionStartTime()));
}
// Get services
this.taggingService = (TaggingService)ctx.getBean("TaggingService");
this.nodeService = (NodeService) ctx.getBean("NodeService");
this.contentService = (ContentService) ctx.getBean("ContentService");
this.transactionService = (TransactionService)ctx.getBean("transactionComponent");
this.auditService = (AuditService)ctx.getBean("auditService");
this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
this.executer = (ContentMetadataExtracter) ctx.getBean("extract-metadata");
executer.setEnableStringTagging(true);
executer.setTaggingService(taggingService);
if (init == false)
{
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>(){
@Override
public Void execute() throws Throwable
{
// Authenticate as the system user
authenticationComponent.setSystemUserAsCurrentUser();
// Create the store and get the root node
ContentMetadataExtracterTagMappingTest.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
ContentMetadataExtracterTagMappingTest.rootNode = nodeService.getRootNode(ContentMetadataExtracterTagMappingTest.storeRef);
// Create the required tagging category
NodeRef catContainer = nodeService.createNode(ContentMetadataExtracterTagMappingTest.rootNode, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryContainer"), ContentModel.TYPE_CONTAINER).getChildRef();
NodeRef catRoot = nodeService.createNode(
catContainer,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryRoot"),
ContentModel.TYPE_CATEGORYROOT).getChildRef();
nodeService.createNode(
catRoot,
ContentModel.ASSOC_CATEGORIES,
ContentModel.ASPECT_TAGGABLE,
ContentModel.TYPE_CATEGORY).getChildRef();
MetadataExtracterRegistry registry = (MetadataExtracterRegistry) ctx.getBean("metadataExtracterRegistry");
extractor = new TagMappingMetadataExtracter();
extractor.setRegistry(registry);
extractor.register();
init = true;
return null;
}});
}
// We want to know when tagging actions have finished running
asyncOccurs = (new TaggingServiceImplTest()).new AsyncOccurs();
((PolicyComponent)ctx.getBean("policyComponent")).bindClassBehaviour(
AsynchronousActionExecutionQueuePolicies.OnAsyncActionExecute.QNAME,
ActionModel.TYPE_ACTION,
new JavaBehaviour(asyncOccurs, "onAsyncActionExecute", NotificationFrequency.EVERY_EVENT)
);
// We do want action tracking whenever the tag scope updater runs
UpdateTagScopesActionExecuter updateTagsAction =
(UpdateTagScopesActionExecuter)ctx.getBean("update-tagscope");
updateTagsAction.setTrackStatus(true);
// Create the folders and documents to be tagged
createTestDocumentsAndFolders();
}