cancel
Showing results for 
Search instead for 
Did you mean: 

Metadata not showing in properties

mskarica
Champ in-the-making
Champ in-the-making
Hi.  I created a new model which defines an aspect, which is intended to add one metadata field to any content added to alfresco, but the metadata field does not show anywhere (or I just can't find it).

Here are the steps I took:
1. Created the new model
2. Registered the model with the repository by adding it to core-services-context.xml
3. Added an entry to web-client-config-properties.xml so the metadata shows in the web client
4. Restarted the server, everything parsed fine.

Am I missing any steps?  What I want to happen is when somebody "Adds Content", I want the new metadata field to show as one of the fields in the properties…but it isn't.

Here is my model:
<?xml version="1.0" encoding="UTF-8"?>

<model name="dr:contentmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>My Model</description>
   <author>xxxxx</author>
   <published>2007-09-12</published>
   <version>1.0</version>
   
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   
   <namespaces>
      <namespace uri="dr.doh.model" prefix="dr"/>
   </namespaces>

   <aspects>
      <aspect name="dr:drRecovery">
         <title>Disaster Recovery</title>
         <parent>cm:content</parent>
         <properties>
            <property name="dr:restoreOrder">
               <title>Disaster Recovery Level</title>
               <description>Importance order in which a document should be recovered in case of disaster</description>
               <type>d:int</type>
               <mandatory>true</mandatory>
            </property>
         </properties>
      </aspect>
   </aspects>      
</model>
Here's what I added to core-services-context.xml (the 2nd entry)
 <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/model/defaultCustomModel.xml</value>
                <value>alfresco/model/DOH_Content_Model.xml</value>
            </list>
        </property>
    </bean>
And here's the entry I put into the web-client-config-properties.xml file:
<config evaluator="aspect-name" condition="dr:drRecovery">
   <property-sheet>
       <show-property name="dr:restoreOrder"/>
   </property-sheet>
</config>

Thanks in advance for any help.
10 REPLIES 10

dhalupa
Champ on-the-rise
Champ on-the-rise
Might be silly question, but have you applied your custom aspect to any of existing objects within repository?

Kind regards,

Denis

mskarica
Champ in-the-making
Champ in-the-making
Actually, that was a good question, I hadn't applied an aspect to any of my content (that was stupid of me).

So I tried to add an aspect to a document, and I also tried creating a rule for adding this aspect to all content, but my aspect doesn't show in the list of aspects I can apply to content.

I double checked the code (matched it up against one of the default aspects…author), and I can't find any differences in the structure.

Any ideas?

By the way, thanks for responding.

dhalupa
Champ on-the-rise
Champ on-the-rise
For an aspect to be shown within the list of aspects in the add-aspect action you have to add the following to your custom web-client-config.xml

 
<config evaluator="string-compare" condition="Action Wizards">
      <!– The list of aspects to show in the add/remove features action –>
      <!– and the has-aspect condition –>
      <aspects>
         <aspect name="your-custom-aspect-name"/>
       </aspects>
</config>

After that you can create a rule which will automaically apply that aspect to imported content

Pozdrav,

Denis

mskarica
Champ in-the-making
Champ in-the-making
WHOOOO!!  It shows up.  THANKS a lot.  I get this error now when trying to apply the aspect to a file:
Failed to run Actions due to error: The aspect is invalid: {http://www.alfresco.org/model/content/1.0}drRecovery

If anyone knows what this means, I'll be glad to listen.  In the meantime, I'll search the forum, I'm sure someone has had this error before.

Thanks for the help.

dhalupa
Champ on-the-rise
Champ on-the-rise
Not sure if this is the reason, but you have defined your property as mandatory and you have not provided the default value. Try providing default value or removing mandatory constraint. As I said, not sure about this, but give it a try

mskarica
Champ in-the-making
Champ in-the-making
Actually, I previously removed the mandatory option in an effort to make it look EXACTLY like the example in the Data_Dictionary_Guide.  So my current model looks like this:
<model name="dr:recoverymodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Disaster Recovery Model</description>
   <author></author>
   <published>2007-09-12</published>
   <version>1.0</version>
   
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   
   <namespaces>
      <!– Define a namespace for the new definition –>
      <namespace uri="dr.doh.model" prefix="dr"/>
   </namespaces>
   
   <aspects>
      <aspect name="dr:drRecovery">
         <title>Disaster Recovery</title>
         <properties>
            <property name="dr:restoreOrder">
               <type>d:int</type>
            </property>
         </properties>
      </aspect>
   </aspects>      
</model>

Searching the forum only returns two results, but both are different than my situation.  Does my namespace uri need to be in a specific format? 

If I don't figure it out soon I'll just start from scratch, just in case I changed something I shouldn't have along the way.  At least now I know the process, so it'll be a lot easier to do it again than it was the first time.

Thanks for the help and suggestions.

dhalupa
Champ on-the-rise
Champ on-the-rise
You're welcome Smiley Happy Good luck with your project..

dhalupa
Champ on-the-rise
Champ on-the-rise
check whether you have named your aspect without any prefix or with prefix cm in the aspects list in web-client-config

mskarica
Champ in-the-making
Champ in-the-making
Thanks dhalupa, that was actually the problem.  I hadn't put the prefix because the rest of the options I saw in the list didn't have them.  I added the prefix and all is good.  I really appreciate your help.

Do you know where I can find information on how to make my metadata field a dropdown field?