本文整理汇总了Java中org.alfresco.repo.policy.Behaviour.NotificationFrequency.FIRST_EVENT属性的典型用法代码示例。如果您正苦于以下问题:Java NotificationFrequency.FIRST_EVENT属性的具体用法?Java NotificationFrequency.FIRST_EVENT怎么用?Java NotificationFrequency.FIRST_EVENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.alfresco.repo.policy.Behaviour.NotificationFrequency
的用法示例。
在下文中一共展示了NotificationFrequency.FIRST_EVENT属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdateProperties
/**
* Ensure that the visibility of a RM site can not be changed to anything but public.
*
* TODO support other site visibilities
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef))
{
Map<QName, Serializable> changed = PropertyMap.getChangedProperties(before, after);
if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) &&
changed.get(SiteModel.PROP_SITE_VISIBILITY) != null &&
!SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY)))
{
// we do not current support non-public RM sites
throw new AlfrescoRuntimeException("The records management site must have public visibility. It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY));
}
}
}
示例2: onCreateChildAssociation
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
*/
@Override
@Behaviour
(
kind = BehaviourKind.ASSOCIATION,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
{
NodeRef nodeRef = childAssocRef.getChildRef();
if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_RECORD_FOLDER))
{
// ensure nothing is being added to a closed record folder
NodeRef recordFolder = childAssocRef.getParentRef();
Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED);
if (isClosed != null && Boolean.TRUE.equals(isClosed))
{
throw new AlfrescoRuntimeException("You can't add new items to a closed record folder.");
}
}
}
示例3: onAddAspect
/**
* Ensure that the DOD record aspect meta-data is applied.
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
@Behaviour
(
kind=BehaviourKind.CLASS,
type="rma:record",
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
@Override
public void onAddAspect(NodeRef nodeRef, QName aspect)
{
if (nodeService.exists(nodeRef) &&
!nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) &&
isDODFilePlan(nodeRef))
{
nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null);
}
}
示例4: onAddAspect
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
isService = true,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName)
{
mandatory("nodeRef", nodeRef);
mandatory("aspectTypeQName", aspectTypeQName);
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
@Override
public Void doWork()
{
if (getNodeService().exists(nodeRef) &&
getDictionaryService().getAllModels().contains(RM_CUSTOM_MODEL) &&
isCustomisable(aspectTypeQName))
{
QName customPropertyAspect = getCustomAspect(aspectTypeQName);
getNodeService().addAspect(nodeRef, customPropertyAspect, null);
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
示例5: onRemoveAspect
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
isService = true,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onRemoveAspect(final NodeRef nodeRef, final QName aspectTypeQName)
{
mandatory("nodeRef", nodeRef);
mandatory("aspectTypeQName", aspectTypeQName);
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
@Override
public Void doWork()
{
if (getNodeService().exists(nodeRef) &&
isCustomisable(aspectTypeQName))
{
QName customPropertyAspect = getCustomAspect(aspectTypeQName);
getNodeService().removeAspect(nodeRef, customPropertyAspect);
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
示例6: onMoveNode
/**
* Record move behaviour
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
{
// check the records parent has actually changed
if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) &&
isFilePlanComponent(oldChildAssocRef.getParentRef()))
{
final NodeRef record = newChildAssocRef.getChildRef();
authenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork()
{
if (nodeService.exists(record) &&
recordService.isFiled(record))
{
// clean record
cleanDisposableItem(nodeService, record);
// re-file in the new folder
recordService.file(record);
}
return null;
}
}, authenticationUtil.getAdminUserName());
}
}
示例7: beforeDeleteNode
/**
* Ensure that no frozen node is deleted.
*
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void beforeDeleteNode(final NodeRef nodeRef)
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork()
{
if (nodeService.exists(nodeRef) &&
filePlanService.isFilePlanComponent(nodeRef))
{
if (freezeService.isFrozen(nodeRef))
{
// never allowed to delete a frozen node
throw new AccessDeniedException("Frozen nodes can not be deleted.");
}
// check children
checkChildren(nodeService.getChildAssocs(nodeRef));
}
return null;
}
});
}
示例8: onCreateNode
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onCreateNode(ChildAssociationRef childAssocRef)
{
final NodeRef rmSite = childAssocRef.getChildRef();
// Do not execute behaviour if this has been created in the archive store
if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE))
{
// This is not the spaces store - probably the archive store
return;
}
if (nodeService.exists(rmSite))
{
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{
public Object doWork()
{
SiteInfo siteInfo = siteService.getSite(rmSite);
if (siteInfo != null)
{
// Create the file plan component
siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null);
// Add the reports
recordsManagementSearchService.addReports(siteInfo.getShortName());
}
return null;
}
}, AuthenticationUtil.getAdminUserName());
}
}
示例9: init
/**
* Init method
*/
public void init()
{
// Register policy behaviours
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"),
ContentModel.ASPECT_TAGGABLE,
new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.EVERY_EVENT));
// Create tag behaviour
createTagBehaviour = new JavaBehaviour(this, "createTags", NotificationFrequency.FIRST_EVENT);
this.policyComponent.bindClassBehaviour(
OnCreateNodePolicy.QNAME,
ContentModel.ASPECT_TAGGABLE,
createTagBehaviour);
// We need to register on content and folders, rather than
// tagable, so we can pick up when things start and
// stop being tagged
updateTagBehaviour = new JavaBehaviour(this, "updateTags", NotificationFrequency.EVERY_EVENT);
this.policyComponent.bindClassBehaviour(
OnUpdatePropertiesPolicy.QNAME,
ContentModel.TYPE_CONTENT,
updateTagBehaviour);
this.policyComponent.bindClassBehaviour(
OnUpdatePropertiesPolicy.QNAME,
ContentModel.TYPE_FOLDER,
updateTagBehaviour);
// We need to know when you move or copy nodes
this.policyComponent.bindClassBehaviour(
OnMoveNodePolicy.QNAME,
ContentModel.ASPECT_TAGGABLE,
new JavaBehaviour(this, "onMoveNode", NotificationFrequency.EVERY_EVENT));
this.policyComponent.bindClassBehaviour(
BeforeCopyPolicy.QNAME,
ContentModel.ASPECT_TAGGABLE,
new JavaBehaviour(this, "beforeCopy", NotificationFrequency.EVERY_EVENT));
this.policyComponent.bindClassBehaviour(
OnCopyCompletePolicy.QNAME,
ContentModel.ASPECT_TAGGABLE,
new JavaBehaviour(this, "onCopyComplete", NotificationFrequency.EVERY_EVENT));
this.policyComponent.bindClassBehaviour(
CheckOutCheckInServicePolicies.OnCheckOut.QNAME,
ContentModel.ASPECT_TAGGABLE,
new JavaBehaviour(this, "afterCheckOut", NotificationFrequency.EVERY_EVENT));
}
示例10: onCreateNode
/**
* Make sure any custom property aspects are applied to newly created nodes.
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
isService = true,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onCreateNode(final ChildAssociationRef childAssocRef)
{
mandatory("nodeRef", childAssocRef);
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
@Override
public Void doWork()
{
if (getDictionaryService().getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL))
{
NodeRef nodeRef = childAssocRef.getChildRef();
QName type = getNodeService().getType(nodeRef);
while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type))
{
if (isCustomisable(type))
{
QName customPropertyAspect = getCustomAspect(type);
getNodeService().addAspect(nodeRef, customPropertyAspect, null);
}
TypeDefinition def = getDictionaryService().getType(type);
if (def != null)
{
type = def.getParentName();
}
else
{
type = null;
}
}
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
示例11: beforeDeleteNode
/**
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
*/
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void beforeDeleteNode(NodeRef nodeRef)
{
final SiteInfo siteInfo = siteService.getSite(nodeRef);
if (siteInfo != null)
{
// grab the file plan for the RM site
NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
{
@Override
public NodeRef doWork()
{
return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY);
}
});
if (filePlan != null)
{
// determine whether the current user has delete capability on the file plan node
AccessStatus accessStatus = capabilityService.getCapabilityAccessState(filePlan, "Delete");
if (AccessStatus.DENIED.equals(accessStatus))
{
throw new AlfrescoRuntimeException("The records management site can not be deleted, because the user doesn't have sufficient privillages to delete the file plan.");
}
// work around for MNT-11038 .. we want to ensure that the RM site can be created once it's been deleted since we only
// allow one short name for the RM site
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork()
{
// delete the authority
String siteGroup = siteService.getSiteGroup(siteInfo.getShortName());
authorityService.deleteAuthority(siteGroup, true);
return null;
}
});
}
}
}
示例12: onMoveNode
/**
* Record folder move behaviour
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
{
if (!nodeService.getType(newChildAssocRef.getParentRef()).equals(TYPE_RECORD_FOLDER))
{
if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()))
{
final NodeRef newNodeRef = newChildAssocRef.getChildRef();
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{
public Object doWork()
{
// clean record folder
cleanDisposableItem(nodeService, newNodeRef);
// re-initialise the record folder
recordFolderService.setupRecordFolder(newNodeRef);
// sort out the child records
for (NodeRef record : recordService.getRecords(newNodeRef))
{
// clean record
cleanDisposableItem(nodeService, record);
// Re-initiate the records in the new folder.
recordService.file(record);
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
}
else
{
throw new UnsupportedOperationException("Cannot move record folder into another record folder.");
}
}