07-31-2011 09:58 AM
07-31-2011 01:54 PM
08-01-2011 04:11 AM
<type name="sec:organization">
<title>Organization</title>
<parent>cm:content</parent>
<properties>
<property name="sec:organizationId">
<title>Organization ID</title>
<type>d:int</type>
</property>
<property name="sec:organizationName">
<title>Organization Name</title>
<type>d:text</type>
</property>
<property name="sec:organizationDescription">
<title>Organization Description</title>
<type>d:text</type>
</property>
<property name="sec:rootPosition">
<title>Root Position</title>
<type>d:noderef</type>
</property>
</properties>
</type>
public static final String DIGITAL_SERIES_SECURITY_MODEL_NAMESPACE_STRING = "www.ds.alfresco.security.extension.com";
public static final String DIGITAL_SERIES_SECURITY_MODEL_NAMEPSACE_PREFIX_STRING = "sec";
public static final QName TYPE_SEC_ORGANIZATION = QName.createQName(DIGITAL_SERIES_SECURITY_MODEL_NAMESPACE_STRING, TYPE_SEC_ORGANIZATION_STRING);
public final RetryingTransactionCallback<String> CreateOrganizationCallback
= new RetryingTransactionCallback<String>() {
public String execute() throws Throwable {
// Acquire organization folder
Node organizationsFolder = new Node(NodeUtil
.acquireOrganizationsFolder(searchService));
// current organization created
currentOrganization = new Node(
nodeService.createNode(
organizationsFolder.getNodeRef(),
ContentModel.ASSOC_CONTAINS,
QName.createQName(
Constants.DIGITAL_SERIES_SECURITY_MODEL_NAMEPSACE_PREFIX_STRING,
Constants.TYPE_SEC_ORGANIZATION_STRING),
Constants.SecurityModelQNames.TYPE_SEC_ORGANIZATION,
new HashMap<QName,Serializable>()).getChildRef());
return "";
}
};
public final RetryingTransactionCallback<String> CreateOrganizationCallback = new RetryingTransactionCallback<String>() {
public String execute() throws Throwable {
// PREPARE ORGANIZATION SEQUENCE ID
Node organizationSeq = new Node(SequenceUtil.prepareSequence(
SequenceUtil.ORGANIZATION_SEQUENCE_NODE_NAME_STRING,
nodeService, searchService));
// LOCK ORGANIZATION SEQUENCE
if(!organizationSeq.isLocked()){
lockService.lock(organizationSeq.getNodeRef(), LockType.NODE_LOCK);
// GET THE NEXT SEQUENCE
SequenceUtil.addCurrentSequence(organizationSeq.getNodeRef(), nodeService);
}
// PREPARE ORGANIZATION PROPERTIES
Map<QName, Serializable> orgProps = new HashMap<QName, Serializable>();
// UPDATE ORGANIZATION SEQUENCE ID
orgProps.put(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_ID,
SequenceUtil.getCurrentSequence(
organizationSeq.getNodeRef(), nodeService));
// UPDATE ORGANIZATION/CONTENT NAME PROPERTY
orgProps.put(ContentModel.PROP_NAME,
NodeUtil.extractNodeProperty(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_NAME,
currentOrganization).toString() +
"_"+orgProps.get(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_ID));
// UPDATE ORGANIZATION NAME PROPERTY
orgProps.put(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_NAME,
NodeUtil.extractNodeProperty(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_NAME,
currentOrganization).toString());
// UPDATE ORGANIZATION DESCRIPTION
orgProps.put(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_DESCRIPTION,
NodeUtil.extractNodeProperty(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_DESCRIPTION,
currentOrganization).toString());
// UPDATE THE PROPERTIES TO AN ORGANIZATION NODE
nodeService.setProperties(currentOrganization.getNodeRef(), orgProps);
// UNLOCK
lockService.unlock(organizationSeq.getNodeRef());
return "";
}
};
08-01-2011 08:58 AM
08-02-2011 08:05 AM
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.