cancel
Showing results for 
Search instead for 
Did you mean: 

Association default value

cgiuliano
Champ in-the-making
Champ in-the-making
Hello everybody,

I've defined an aspect including an association to a datalist:

<association name="ax:tenant" >
   <source>
      <!– The association to a tenant is mandatory –>
      <mandatory>true</mandatory>
      <many>false</many>
   </source>
   <target>
      <class>axdl:tenants</class>
      <!– The associated node must exist in the target class –>
      <mandatory>true</mandatory>
      <many>false</many>
   </target>
</association>
I need such association to be mandatory.

But then I cannot manually add the aspect to a node from Share, because the required association would be not present until I associate the node. And this is quite annoying during development and maintenance.

Is there any way to define a default value for an association?
I would like to avoid to build a custom action for each aspect with a mandatory property/association.

Thanks,
Carlo
7 REPLIES 7

kaynezhang
World-Class Innovator
World-Class Innovator
I'm afraid there is no way to  define a default value for an association.

You set it mandatory,it means "if you add this apect ,you must provide association". you can't go against it ,or the mandatory is meaningless.

If you just want to make it easier to add the aspect  from share ,you can customize share or modify you association define

cgiuliano
Champ in-the-making
Champ in-the-making
Thanks Kaynezhang,
I was doubtful there could be a solution…

Kind regards,
Carlo

kaynezhang
World-Class Innovator
World-Class Innovator
Following is extracted from content metamodel XML schema

<xs:complexType name="association">
      <xs:sequence>
         <xs:group ref="dd:TextualDescription"></xs:group>
         <xs:element name="source" maxOccurs="1" minOccurs="0">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="role" type="xs:string" maxOccurs="1"
                     minOccurs="0" />
                  <xs:element name="mandatory" type="xs:boolean"
                     maxOccurs="1" minOccurs="0" />
                  <xs:element name="many" type="xs:boolean"
                     maxOccurs="1" minOccurs="0" />
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="target">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="class" type="xs:string"  maxOccurs="1" minOccurs="1" />
                  <xs:element name="role" type="xs:string" maxOccurs="1" minOccurs="0" />
                  <xs:element name="mandatory" type="dd:mandatoryDef"
                     maxOccurs="1" minOccurs="0" />
                  <xs:element name="many" type="xs:boolean"
                     maxOccurs="1" minOccurs="0" />
               </xs:sequence>
            </xs:complexType>
         </xs:element>
      </xs:sequence>
      <xs:attributeGroup ref="dd:name" />
   </xs:complexType>

you can not define default value.

kaynezhang
World-Class Innovator
World-Class Innovator
Following is extracted from content metamodel XML schema

<xs:complexType name="association">
      <xs:sequence>
         <xs:group ref="dd:TextualDescription"></xs:group>
         <xs:element name="source" maxOccurs="1" minOccurs="0">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="role" type="xs:string" maxOccurs="1"
                     minOccurs="0" />
                  <xs:element name="mandatory" type="xs:boolean"
                     maxOccurs="1" minOccurs="0" />
                  <xs:element name="many" type="xs:boolean"
                     maxOccurs="1" minOccurs="0" />
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="target">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="class" type="xs:string"  maxOccurs="1" minOccurs="1" />
                  <xs:element name="role" type="xs:string" maxOccurs="1" minOccurs="0" />
                  <xs:element name="mandatory" type="dd:mandatoryDef"
                     maxOccurs="1" minOccurs="0" />
                  <xs:element name="many" type="xs:boolean"
                     maxOccurs="1" minOccurs="0" />
               </xs:sequence>
            </xs:complexType>
         </xs:element>
      </xs:sequence>
      <xs:attributeGroup ref="dd:name" />
   </xs:complexType>

there is no way you can  define default value for association

There should be solution for this.By writing ftl or something else.Are you sure about this,that we cant have default value for association?

I mean  there is no way to  specify  default value for association in model definition level.
Of course you can customize service or UI and specify a value for an association

can you show me some thing use full?