AnsweredAssumed Answered

Aspects/Types not showing on Share

Question asked by augustodelucena on Sep 21, 2015
Latest reply on Sep 21, 2015 by augustodelucena
Hey Folks,

I have been following JPotts Custom Content Types Tutorial to try to understand how modeling works on Alfresco and then apply it according to meet my requirements.

Well, the guide is pretty straight-forward, so I followed exactly how it is suggested.

At the end, I tried to test it on the embedded TomCat server by running integration-test and I could not see any of the new aspects/types created, nor use advanced search with custom model and custom properties/aspects.

I thought that it might be something with my maven so I tried to apply it directly to the war file using the apply_amps.sh but this time, I got several different errors:

<blockcode>ERROR [solr.tracker.AbstractTracker] [SolrTrackerScheduler_Worker-1] Tracking failed
ERROR Could not read configuration file from URL [jar:file:/opt/alfresco-5.0.d/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-core-5.0.d.jar!/log4j.properties].
SEVERE: Context [/alfresco] startup failed due to previous errors</blockcode>

I can't understand why this happened since I followed thoroughly every step as instructed for the forth time and doing copy+paste.

I didn't know which logs to attach nor where they are located for the embedded tomcat, if needed please request and I promptly attach them.

Any help will be much appreciated.

PS: I believe that my codes are as they were supposed to be.

scModel.xml

<?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>


service-context.xml

<beans>
   
    <!– A simple class that is initialized by Spring –>
    <bean id="changeme.exampleBean" class="org.alfresco.demoamp.Demo" init-method="init" />
   
    <!– A simple module component that will be executed once –>
    <bean id="changeme.exampleComponent" class="org.alfresco.demoamp.DemoComponent" parent="module.baseComponent" >
        <property name="moduleId" value="${project.artifactId}" />  <!– See module.properties –>
        <property name="name" value="exampleComponent" />
        <property name="description" value="A demonstration component" />
        <property name="sinceVersion" value="2.0" />
        <property name="appliesFromVersion" value="2.0" />
        <property name="nodeService" ref="NodeService" />
        <property name="nodeLocatorService" ref="nodeLocatorService" />
    </bean>
    <!– Registration of new models –>
   <bean id="${project.artifactId}_dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
        <list>
            <value>alfresco/module/${project.artifactId}/model/scModel.xml</value>
        </list>
    </property>
</bean>
   
</beans>


<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>
   <config evaluator="aspect" condition="sc:webable">
    <forms>
        <form>
            <field-visibility>
                <show id="sc:published" />
                <show id="sc:isActive" />
                 <!– surf:widget aspect –>
             <show id="surf:widgetType"/>
             <show id="surf:mid"/>
             <show id="surf:label"/>
              
    <!– sc:doc –>
    <show id="sc:relatedDocuments" />
            </field-visibility>
            <appearance>                   
                <field id="sc:published" label-id="prop.sc_published" />
                <field id="sc:isActive" label-id="prop.sc_isActive" />
                <field id="cm:addressees" read-only="true" />
    <field id="cm:sentdate" read-only="true" />
    <field id="cm:subjectline" read-only="true" />
    <field id="sc:relatedDocuments" label-id="assoc.sc_relatedDocuments" />
            </appearance>
        </form>
    </forms>
</config>
   <config evaluator="aspect" condition="sc:productRelated">
    <forms>
        <form>
            <field-visibility>
                <show id="sc:product" />
                <show id="sc:version" />
                 <!– surf:widget aspect –>
    <show id="surf:widgetType"/>
    <show id="surf:mid"/>
    <show id="surf:label"/>
              
    <!– sc:doc –>
    <show id="sc:relatedDocuments" />   
            </field-visibility>
            <appearance>                   
                <field id="sc:product" label-id="prop.sc_product" />
                <field id="sc:version" label-id="prop.sc_version" />
                <field id="cm:addressees" read-only="true" />
    <field id="cm:sentdate" read-only="true" />
    <field id="cm:subjectline" read-only="true" />
    <field id="sc:relatedDocuments" label-id="assoc.sc_relatedDocuments" />
            </appearance>
        </form>
    </forms>
</config>
<config replace="true" evaluator="string-compare" condition="AdvancedSearch">
    <advanced-search>
        <!– Forms for the advanced search type list –>
        <forms>
            <form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form>
            <form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form>           
            <form labelId="type.sc_whitepaper" descriptionId="search.form.desc.sc_whitepaper">sc:whitepaper</form>
        </forms>
    </advanced-search>
</config>
<!– sc:whitepaper type (new nodes) –>
<config evaluator="model-type" condition="sc:whitepaper">
    <forms>
        <!– Search form –>
        <form id="search">
            <field-visibility>
                <show id="cm:name" />
                <show id="cm:title" force="true" />
                <show id="cm:description" force="true" />
                <show id="mimetype" />
                <show id="cm:modified" />
                <show id="cm:modifier" />
                <!– sc:productRelated –>
                <show id="sc:product" />
                <show id="sc:version" />
                <!– sc:webable –>
                <show id="sc:isActive" />
                <show id="sc:published" />
            </field-visibility>
            <appearance>
                <field id="mimetype">
                    <control template="/org/alfresco/components/form/controls/mimetype.ftl" />
                </field>
                <field id="cm:modifier">
                    <control>
                        <control-param name="forceEditable">true</control-param>
                    </control>
                </field>
                <field id="cm:modified">
                    <control template="/org/alfresco/components/form/controls/daterange.ftl" />
                </field>
                <!– sc:productRelated –>
                <field id="sc:product" label-id="prop.sc_product">
                    <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                </field>
                <field id="sc:version" label-id="prop.sc_version">
                    <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                </field>              
                <!– sc:webable –>
                <field id="sc:isActive" label-id="prop.sc_isActive">
                    <control template="/org/alfresco/components/form/controls/checkbox.ftl" />
                </field>
                <field id="sc:published" label-id="prop.sc_published">
                    <control template="/org/alfresco/components/form/controls/daterange.ftl" />
                </field>
            </appearance>
        </form>
    </forms>
</config>

</alfresco-config>






Outcomes