 
					
				
		
09-17-2008 01:06 AM
 roduct and a cm
roduct and a cm est.  All my attempts have failed.  Please help.
est.  All my attempts have failed.  Please help.<?xml version="1.0" encoding="UTF-8"?>
<!– Custom Model –>
<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>
<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <!– Optional meta-data about the model –>   
   <description>Custom Model</description>
   <author>Stephen M. Wick</author>
   <version>1.0</version>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="custom.model" prefix="custom"/>
   </namespaces>
   <types>
      <type name="cm:product">
         <title>Product</title>
         <parent>cm:content</parent>
         <associations>
            <association name="cm:crops">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:crop</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
            <association name="cm:pests">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:pest</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </type>
      <type name="cm:crop">
         <title>Crop</title>
         <parent>cm:content</parent>
         <associations>
            <association name="cm:products">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:product</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
            <association name="cm:pests">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:pest</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </type>
      <type name="cm:pest">
         <title>Pest</title>
         <parent>cm:content</parent>
         <associations>
            <association name="cm:products">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:product</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
            <association name="cm:crops">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:crop</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </type>
   </types>
</model>
 ests within class cm:crop and class cm
ests within class cm:crop and class cm roduct
roduct roduct(s) are associated with my cm:crop form the Details screen for the cm:crop.
roduct(s) are associated with my cm:crop form the Details screen for the cm:crop.<?xml version="1.0" encoding="UTF-8"?>
<!– Custom Model –>
<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>
<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <!– Optional meta-data about the model –>   
   <description>Custom Model</description>
   <author>Stephen M. Wick</author>
   <version>1.0</version>
   <imports>
      <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="custom.model" prefix="custom"/>
   </namespaces>
   <types>
      <type name="cm:product">
         <title>Product</title>
         <parent>cm:content</parent>
         <associations>
            <association name="cm:crops">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:crop</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
            <association name="cm:pests">
               <source>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </source>
               <target>
                  <class>cm:pest</class>
                  <mandatory>false</mandatory>
                  <many>true</many>
               </target>
            </association>
         </associations>
      </type>
      <type name="cm:crop">
         <title>Crop</title>
         <parent>cm:content</parent>
      </type>
      <type name="cm:pest">
         <title>Pest</title>
         <parent>cm:content</parent>
      </type>
   </types>
</model>
 
					
				
		
09-23-2008 05:19 PM
 est and fs:crop nodes do not have references to the fs
est and fs:crop nodes do not have references to the fs roduct.
roduct. roduct, fs:crop and fs
roduct, fs:crop and fs est named fs:related, which defines the association fs:crops, fs
est named fs:related, which defines the association fs:crops, fs ests and fs
ests and fs roducts.  This got around the duplicate name violation, but still didn't solve my problem.  Adding an fs:crop to an fs
roducts.  This got around the duplicate name violation, but still didn't solve my problem.  Adding an fs:crop to an fs roduct's fs:crops property does not add the fs
roduct's fs:crops property does not add the fs roduct to the fs:crop's fs
roduct to the fs:crop's fs roducts property.
roducts property.
					
				
			
			
				
			
			
			
			
			
			
			
		09-24-2008 03:45 AM
 * Represents a generic association between two nodes.  The association is named
 * and bidirectional by default.
   <config evaluator="node-type" condition="cns:text">
      <property-sheet>
         <show-association name="cns:textTemplateAssoc" />
      </property-sheet>
   </config>
   
   <config evaluator="node-type" condition="cns:textTemplate">
      <property-sheet>
         <show-association name="cns:textTemplateAssoc" />
      </property-sheet>
   </config>
09:33:13,450 User:admin WARN  [component.property.UIAssociation] Failed to find association definition for association 'cns:textTemplateAssoc'
 
					
				
		
09-24-2008 05:49 PM
    /**
     * @throws UnsupportedOperationException always
     */
    public List<AssociationRef> getSourceAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
    {
        // This operation is not supported for a version store
        throw new UnsupportedOperationException(MSG_UNSUPPORTED);
    } 
					
				
		
09-24-2008 06:05 PM
 roduct and fs:crop extend cm:content, and fs
roduct and fs:crop extend cm:content, and fs roduct defines an association to fs:crop named "fs:crops"…
roduct defines an association to fs:crop named "fs:crops"… roduct (Source node).
roduct (Source node).<#– Shows some Crop info about the current document –>
<#if document?exists>
   <h4>Crop Info:</h4>
   <table>
   <tr><td><b>Name:</b></td><td>${document.name}</td></tr>
   <tr><td><b>Products:</b></td><td>
   <table>
      <#list companyhome.childrenByLuceneSearch["+TYPE:\"fs:product\""] as product>
         <#list product.assocs["fs:crops"] as crop>
         <#if crop.name == document.name>
         <tr><td><a href="/alfresco/n/showDocDetails/workspace/SpacesStore/${product.id}">${product.name}</a></td></tr>
         </#if>
      </#list>
      </#list>
   </table>
   </td></tr>
    </table>
<#else>
   No document found!
</#if>
 
					
				
		
09-25-2008 12:40 PM
09-29-2008 11:15 AM

10-06-2008 12:17 PM
public class RuleTriggerBidirectionalAssoc extends RuleTriggerAbstractBase
   implements NodeServicePolicies.OnDeleteAssociationPolicy, NodeServicePolicies.OnCreateAssociationPolicy {
   public void onDeleteAssociation(AssociationRef nodeAssocRef) {
         nodeService.removeAssociation(nodeAssocRef.getTargetRef(), nodeAssocRef.getSourceRef(), 
               getReverseQnameAssociationName(nodeAssocRef.getTypeQName()));
   }
   public void onCreateAssociation(AssociationRef nodeAssocRef) {
         nodeService.createAssociation(nodeAssocRef.getTargetRef(), nodeAssocRef.getSourceRef(), 
               getReverseQnameAssociationName(nodeAssocRef.getTypeQName()));
   }
   public void registerRuleTrigger() {
      this.policyComponent.bindAssociationBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateAssociation"), this, 
            new JavaBehaviour(this, "onCreateAssociation"));
      
      this.policyComponent.bindAssociationBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteAssociation"), this, 
            new JavaBehaviour(this, "onDeleteAssociation"));
      
   }
}
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="on-association-change-trigger" class="org.test.alfresco.repo.rule.trigger.RuleTriggerBidirectionalAssoc" 
      parent="rule-trigger-base" />
</beans>
 
					
				
		
10-06-2008 05:43 PM
12-22-2008 06:45 PM
    public QName getReverseQnameAssociationName(QName qName) {
        String reverseLocalName = new StringBuffer(qName.getLocalName()).reverse().toString();
        QName reverseQName = QName.createQName(qName.getNamespaceURI(), reverseLocalName);
        return reverseQName;
    }
        <property-sheet>
            <show-association name="sample:s2c" read-only="true" />
        </property-sheet>
    public void onDeleteAssociation(AssociationRef nodeAssocRef) {
        try {
            nodeService.removeAssociation(nodeAssocRef.getTargetRef(), nodeAssocRef.getSourceRef(), getReverseQnameAssociationName(nodeAssocRef.getTypeQName()));
        } catch (IllegalArgumentException exception) {
            if (exception.getMessage().indexOf(NOT_DEFINED_EXCEPTION_MESSAGE) == -1)
                throw exception;
            // otherwise ignore it
        }
    }
    public void onCreateAssociation(AssociationRef nodeAssocRef) {
        try {
            nodeService.createAssociation(nodeAssocRef.getTargetRef(), nodeAssocRef.getSourceRef(), getReverseQnameAssociationName(nodeAssocRef.getTypeQName()));
        } catch (IllegalArgumentException exception) {
            if (exception.getMessage().indexOf(NOT_DEFINED_EXCEPTION_MESSAGE) == -1)
                throw exception;
            // otherwise ignore it
        }
    }
 
					
				
				
			
		
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.