Custom repository

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member

Custom repository

So I'm doing the Jeff Potts tutorial about Working With Custom Content Types in Alfresco but after i made the few changes as said in the tutorial to add some rules in the rule configuration panel i don't see any change.
All the things I added don't appear.
My share-config-custom.xml in ..\tutorial_home\content-tutorial-share\src\main\resources\META-INF\ looks like this :

<alfresco-config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
</config>
</alfresco-config>

<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="sc:webable" />
<aspect name="scSmiley TongueroductRelated" />
</visible>

<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>

<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>

<types>
<type name="cm:content">
<subtype name="sc:doc" />
<subtype name="sc:whitepaper" />
</type>
<type name="sc:doc">
<subtype name="sc:whitepaper" />
</type>
</types>

And my scModel.xml in ..\tutorial_home\content-tutorial-repo\src\main\resources\alfresco\module\content-tutorial-repo\model\ looks like this : 

<?xml version="1.0" encoding="UTF-8"?> <!-- Definition of new Model -->
<model name="sc:somecomodel"
       xmlns="http://www.alfresco.org/model/dictionary/1.0">
     <!-- Optional meta-data about the model -->
    <description>Someco Model</description>
    <author>Jeff Potts</author>
    <version>1.0</version>      <!-- Imports are required to allow references to definitions in other models -->
    <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 -->
    <namespaces>
        <namespace uri="http://www.someco.com/model/content/1.0" prefix="sc"/>
    </namespaces>
    <constraints>
        <constraint name="sc:campaignList" type="LIST">
            <parameter name="allowedValues">
                <list>
                    <value>Application Syndication</value>
                    <value>Private Event Retailing</value>
                    <value>Social Shopping</value>
                </list>
            </parameter>
        </constraint>
    </constraints>
    <types>         <!-- Enterprise-wide generic document type -->
        <type name="sc:doc">
            <title>Someco Document</title>
            <parent>cm:content</parent>
            <associations>
                <association name="sc:relatedDocuments">
                    <title>Related Documents</title>
                    <source>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </source>
                    <target>
                        <class>sc:doc</class>
                        <mandatory>false</mandatory>
                        <many>true</many>
                    </target>
                </association>
            </associations>
            <mandatory-aspects>
                <aspect>cm:generalclassifiable</aspect>
            </mandatory-aspects>
        </type>
        <type name="sc:whitepaper">
            <title>Someco Whitepaper</title>
            <parent>sc:doc</parent>
        </type>
        <type name="sc:marketingDoc">
            <title>Someco Marketing Document</title>
            <parent>sc:doc</parent>
            <properties>
                <property name="sc:campaign">
                    <type>d:text</type>
                    <multiple>true</multiple>
                    <constraints>
                        <constraint ref="sc:campaignList"/>
                    </constraints>
                </property>
            </properties>
        </type>
    </types>
    <aspects>
        <aspect name="sc:webable">
            <title>Someco Webable</title>
            <properties>
                <property name="sc:published">
                    <type>d:date</type>
                </property>
                <property name="sc:isActive">
                    <type>d:boolean</type>
                    <default>false</default>
                </property>
            </properties>
        </aspect>
        <aspect name="sc:productRelated">
            <title>Someco Product Metadata</title>
            <properties>
                <property name="sc:product">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <multiple>true</multiple>
                </property>
                <property name="sc:version">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <multiple>true</multiple>
                </property>
            </properties>
        </aspect>
    </aspects>
</model>

If anyone ever had this problem and can help me. I don't really know where the problem may come from and I'm a newbie in the Alfresco development world so only showed these two documents, if you need anything else, let me know.

8 Replies
Highlighted
Advanced II

Re: Custom repository

It is not clear to me what exactly is not working.

What do you expect to see?

Are you referring to the change type action? Can't you see your custom type there?

Are you packaging your project as an AMP or JAR and deploying it in a server? Or are you simply executing the project by using the SDK?

Highlighted
Established Member

Re: Custom repository

Ok so for example I'm supposed to have this, but the two highlighted types do not appear in my share.
From a jar, I created an Alfresco Platform JAR archetype but I also uncommented my pom so that it is able to create an AMP.

What I

Highlighted
Advanced II

Re: Custom repository

Well, that one is a simple thing, so the only thing I can think of is that you have a typo or something somewhere, but for that, it will be hard to help you indentifying it without taking a look at your project's source code.

An idea would be to grab the source code from Jeff's repository on github ( alfresco-developer-series/share-config-custom.xml at master · jpotts/alfresco-developer-series · Git... ) and perform a diff to show what is different.

Highlighted
Established Member

Re: Custom repository

Ok mh this code is totaly different from mine, I think it has been made in another (more advanced) tutorial...My share-config-custom.xml is juste made of this :

<alfresco-config>
      <!-- Document Library config section -->
      <config evaluator="string-compare" condition="DocumentLibrary">
      </config>
</alfresco-config>

<aspects>
   <!-- Aspects that a user can see -->
   <visible>
         <aspect name="sc:webable" />
         <aspect name="scSmiley TongueroductRelated" />
   </visible>

   <!-- Aspects that a user can add. Same as "visible" if left empty -->
   <addable>
   </addable>

   <!-- Aspects that a user can remove. Same as "visible" if left empty -->
   <removeable>
   </removeable>
</aspects>

<types>
   <type name="cm:content">
         <subtype name="sc:doc" />
         <subtype name="sc:whitepaper" />
   </type>
   <type name="sc:doc">
         <subtype name="sc:whitepaper" />
   </type>
</types>

Although in the tutorial, he says that I have to create this file, but after I created the project this file was already there and contained some code so I just deleted the code to put mine instead. Maybe I did not create the project properly even though I followed every step line by line ? Is this file supposed to already be there when you create the project ?

Highlighted
Advanced II

Re: Custom repository

Yes, it is supposed to be there when you create a new SDK project.

But what you did is right.

You just have to clean all the content (that is just a sample) and put your code inside of it.

Highlighted
Established Member

Re: Custom repository

Ok that's a good start if everything is ok. But did you have any problem like this which may have caused the fact that custom models don't appear in share ?

Highlighted
Advanced II

Re: Custom repository

Ah, now I saw what the problem is.

The XML is not well formed.

Try this one instead:

<alfresco-config>
    <!-- Document Library config section -->
    <config evaluator="string-compare" condition="DocumentLibrary">

        <aspects>
            <!-- Aspects that a user can see -->
            <visible>
                <aspect name="sc:webable" />
                <aspect name="sc:productRelated" />
            </visible>

            <!-- Aspects that a user can add. Same as "visible" if left empty -->
            <addable>
            </addable>

            <!-- Aspects that a user can remove. Same as "visible" if left empty -->
            <removeable>
            </removeable>
        </aspects>

        <types>
            <type name="cm:content">
                <subtype name="sc:doc" />
                <subtype name="sc:whitepaper" />
            </type>
            <type name="sc:doc">
                <subtype name="sc:whitepaper" />
            </type>
        </types>
    </config>
</alfresco-config>

The </config> </alfresco-config> was in the wrong place.

Highlighted
Established Member

Re: Custom repository

Yes ! Thank you, it was the problem !