01-19-2016 05:50 AM
<constraints>
//the value on Share will be shown as <strong>A</strong> instead of <strong>1 - A</strong>
// through the use of ftl
<constraint name="evl:courtNames" type="LIST">
<parameter name="allowedValues">
<list>
<value></value>
<value>1 - A</value>
<value>2 - B</value>
</parameter>
</constraint>
//the value on Share will be shown as <strong>Arbitration Petition</strong> instead of <strong>1 - Arbitration Petition through the use of ftl</strong>
<constraint name="evl:matterTypes" type="LIST">
<parameter name="allowedValues">
<list>
<value></value>
<value>1 - Arbitration Petition</value>
<value>1 - Civil Appeal</value>
<value>1 - REF. U/A 317(1)</value>
<value>2 - CAVEAT(CO.)</value>
<value>2 - CCP(CO.)</value>
<value>2 - CCP(O)</value>
<value>2 - CCP(REF)</value>
<value>2 - CEAC</value>
<value>2 - O.M.P. (T) (COMM.)</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<!– Enterprise-wide generic legal document type –>
<type name="evl:legalDocument">
<title>Legal Document</title>
<parent>cm:content</parent>
<properties>
<!– Year of the Case. –>
<property name="evl:yearOfCreation">
<title>Document Year</title>
<type>d:long</type>
<mandatory>true</mandatory>
<multiple>false</multiple>
<constraints>
<constraint ref="evl:yearConstraint" />
</constraints>
</property>
<!– Which court is the case in –>
<property name="evl:courtName">
<title>Name of the Court</title>
<type>d:text</type>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
<constraints>
<constraint ref="evl:courtNames" />
</constraints>
</property>
<!– A number assigned to a legal case by a court –>
<property name="evl:caseNumber">
<title>Case Number </title>
<type>d:long</type>
</property>
<!– A short code for the type of matter at hand –>
<property name="evl:matterType">
<title>Matter Type</title>
<type>d:text</type>
<multiple>false</multiple>
<index enabled="true">
<tokenised>false</tokenised>
</index>
<constraints>
<constraint ref="evl:matterTypes" />
</constraints>
</property>
<!– Will be auto-generated based on Matter Type, Case Number and Case
Year –>
<property name="evl:caseReference">
<title>Case Reference</title>
<type>d:text</type>
<index enabled="true">
<tokenised>false</tokenised>
</index>
</property>
</properties>
</type>
</types>
<!– Advanced search form configuration –>
<config evaluator="model-type" condition="evl:legalDocument"
override="true">
<forms>
<!– Search form –>
<form id="search">
<field-visibility>
<show id="evl:caseNumber" force="true" />
<show id="evl:yearOfCreation" force="true" />
<show id="evl:courtName" force="true" />
<show id="evl:matterType" force="true" />
<show id="evl:caseReference" force="true" />
</field-visibility>
<appearance>
<field id="evl:caseNumber" label-id="prop.evl_caseNumber">
<!– <control> <control template="" /> </control> –>
</field>
<field id="evl:yearOfCreation" label-id="prop.evl_yearOfCreation">
<control>
<control-param name="maxLength">4</control-param>
</control>
</field>
<field id="evl:courtName" label-id="prop.evl_courtName">
<control template="/form-controls/parent-filter-selectone.ftl">
<control-param name="filteredProperty">evl_matterType</control-param>
</control>
</field>
<field id="evl:matterType" label-id="prop.evl_matterType">
<control template="/form-controls/filtered-selectone.ftl" />
</field>
<!– <field id="evl:caseReference" label-id="prop.evl_caseReference"></field> –>
</appearance>
</form>
</forms>
</config>
public class LegalPropertyGenerator implements
NodeServicePolicies.OnCreateNodePolicy,
NodeServicePolicies.OnUpdatePropertiesPolicy {
// Dependencies
private NodeService nodeService;
private PolicyComponent policyComponent;
// Behaviours
private Behaviour onCreateNode;
private Behaviour onUpdateProperties;
private Logger logger = Logger.getLogger(LegalPropertyGenerator.class);
public void init() {
if (logger.isDebugEnabled())
logger.debug("******************* Initializing legal property generator behavior *******************");
// Create behaviours
this.onCreateNode = new JavaBehaviour(this, "onCreateNode",
NotificationFrequency.TRANSACTION_COMMIT);
this.onUpdateProperties = new JavaBehaviour(this, "onUpdateProperties",
NotificationFrequency.TRANSACTION_COMMIT);
// Bind behaviours to node policies
this.policyComponent.bindClassBehaviour(QName.createQName(
NamespaceService.ALFRESCO_URI, "onCreateNode"), LegalDocumentModel.TYPE_LEGAL_DOCUMENT,
this.onCreateNode);
this.policyComponent.bindClassBehaviour(QName.createQName(
NamespaceService.ALFRESCO_URI, "onUpdateProperties"), LegalDocumentModel.TYPE_LEGAL_DOCUMENT,
this.onUpdateProperties);
}
@Override
public void onCreateNode(ChildAssociationRef childAssocRef) {
if (logger.isDebugEnabled())
logger.debug("Inside onCreateNode");
generateLegalTypeFields(childAssocRef.getChildRef());
}
@Override
public void onUpdateProperties(NodeRef nodeRef,
Map<QName, Serializable> before, Map<QName, Serializable> after) {
if (logger.isDebugEnabled())
logger.debug("Inside onUpdateProperties");
generateLegalTypeFields(nodeRef);
}
/**
* Method used for generating the ev:legalDocument type fields
*
* @param caseNumber
* case number of the document
* @param caseYear
* year of the case
* @param matterType
* matter type of the case
*/
public void generateLegalTypeFields(NodeRef nodeRef) {
if (logger.isDebugEnabled())
logger.debug("Inside generateFieldCaseRef");
// get the required fields for generating the case reference field
Serializable caseNumber = nodeService.getProperty(nodeRef, LegalDocumentModel.PROP_CASE_NUMBER);
Serializable caseYear = nodeService.getProperty(nodeRef, LegalDocumentModel.PROP_CASE_YEAR);
Serializable matterType = nodeService.getProperty(nodeRef, LegalDocumentModel.PROP_MATTER_TYPE);
generateCaseRefField(nodeRef, caseNumber, caseYear, matterType);
}
private void generateCaseRefField(NodeRef nodeRef, Serializable caseNumber,
Serializable caseYear, Serializable matterType) {
if (caseNumber == null || caseYear == null || matterType == null
|| matterType.toString().equals("")) {
nodeService.setProperty(nodeRef, LegalDocumentModel.PROP_CASE_REFERENCE, null);
} else {
// as the value is coming as "1 - courtName", we need to extract the "courtName"
int index = matterType.toString().indexOf("-") + 1;
nodeService.setProperty(nodeRef, LegalDocumentModel.PROP_CASE_REFERENCE, matterType
.toString().substring(index)
+ "/"
+ caseNumber.toString()
+ "/"
+ caseYear.toString());
}
}
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public void setPolicyComponent(PolicyComponent policyComponent) {
this.policyComponent = policyComponent;
}
}
02-03-2016 11:46 PM
02-04-2016 01:56 AM
02-04-2016 03:26 AM
02-04-2016 07:34 AM
02-05-2016 09:26 AM
<config evaluator="string-compare" condition="Advanced Search">
<!– advanced search custom attribute config –>
<!– see http://wiki.alfresco.com/wiki/Advanced_Search_Custom_Attributes –>
<advanced-search>
<!– type constraint drop-down –>
<content-types>
<!– cm:content type is implicit in this list –>
<!– types must extend cm:content for display in the Alfresco web-client –>
<type name="evl:legalDocument" />
<type name="fm:post" />
</content-types>
<folder-types>
<!– cm:folder type is implicit in this list –>
<!– types must extend cm:folder for display in the Alfresco web-client –>
<type name="fm:forums" />
</folder-types>
</advanced-search>
</config>
02-08-2016 01:34 AM
<!– Advanced Search config section –>
<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
<advanced-search>
<!– Forms for the advanced search type list –>
<forms>
<form labelId="type.evl_legalDocument" descriptionId="search.form.desc.evl_legalDocument">evl:legalDocument
</form>
<form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content
</form>
<form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder
</form>
</forms>
</advanced-search>
</config>
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.