cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Aspect Property reading Values from a database Field

ctraversa
Champ in-the-making
Champ in-the-making
Hi all.
I'd like to have a suggestion on the best way to implement Custom Aspect Property whose values come from a database field.
In other words the possible values of the custom aspect property cannot be entered freely but come from a database field with more then 5000 entries.
Does exist a best practice to follow to put in place a such procedure?
Or does anyone have any idea on how to do it?
Thanks in advance,
Carlo.
12 REPLIES 12

archana_bonkanp
Champ in-the-making
Champ in-the-making
hi,

i have renamed the custom-model-context.xml.sample file as custom-model-context.xml,
then in custom model.xml file

<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Custom Model</description>
   <author></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="customSmiley SurprisedneType">
         <title>One kind of type</title>
         <parent>cm:content</parent>
         <properties>
            <property name="custom:whatever">
               <type>d:text</type>
               <multiple>false</multiple>
                    <index enabled="true">
                  <tokenised>true</tokenised>
               </index>
                    <constraints>
<constraint ref="custom:yesno"/>
               </constraints>
                  </property>
               </properties>
            </type>
    
<constraint name="pre:yesno" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Yes</value>
               <value>No</value>
               <value>Indeterminated</value>
            </list>
         </parameter>
      </constraint>
</types>
</model>

then in thew web-client config custom.xml,added the following code

<config evaluator="string-compare" condition="Action Wizards">
<aspects>
     <aspect name="custom:CustomerDetails"/>
</aspects>
<subtypes>

<type name="customSmiley SurprisedneType"/>

</subtypes>
</config>


<config evaluator="aspect-name" condition="custom:CustomerDetails">
<property-sheet>
<separator name="sepCust1" display-label="Lessons Learned Database"
          component-generator="HeaderSeparatorGenerator"/>

<show-property name="custom:Geography"/>


</property-sheet>
</config>

archana_bonkanp
Champ in-the-making
Champ in-the-making
im nt getting any error but i cant see that property
hw to set that property to a document

marcostopper
Champ in-the-making
Champ in-the-making
I've acces to my SQL Server 2005 database. So my custom property can get only permetted value froma my database.

I've wrote an application to write file in the repository (using API Web Services C#) with their "custom" meta-data.

Now the problem is how to refresh Alfresco to get database changing. Sometimes I tried to write file with databse updatated value for the custom property and I got an Integrity error for my Alfresco. The repository doesn't refresh the custom constraint with new value from db.
How can I get the repository refreshed?
Remember that the user doesn't access by the standard graphic interface but throw my custom application.