cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy share-config-custom.xml via AMP in 5.0.c

dsmith
Champ on-the-rise
Champ on-the-rise
I'm a bit of a greenhorn to customization but trying to follow along with the ecmarchitect.com tutorials while making accommodations for the differences since 4.x.

I'm developing using the all-in-one archetype of the 2.0 Alfresco SDK on a VM running Debian Jessie.
I have a working installation of Alfresco from the binary installer on the same VM to which I am attempting to apply the AMP files.

Have successfully created two simple content types: mcrd.doc (child of cm:content) and mcrd:will (child of mcrd:doc).  Packaged into AMP via mvn install and copied the resulting repo-amp.amp file to alfresco-5.0.c/amps.  Ran bin/apply_amps.sh which showed the amp being applied to alfresco.war.

I then created a share-config-custom.xml file in my-project-root/share-amp/src/main/resources/META-INF with the following content:


<alfresco-config>

   <!– Document Library config section –>
   <config evaluator="string-compare" condition="DocumentLibrary" replace="true" >

      <types>
         <type name="cm:content">
            <subtype name="mcrd:doc" />
            <subtype name="mcrd:will" />
         </type>

         <type name="mcrd:doc">
            <subtype name="mcrd:will" />
         </type>

      </types>

</alfresco-config>


Again I packaged them with mvn install and copied the share-amp.amp file to alfresco-5.0.c/amps_share.  Ran bin/apply_amps.sh, which showed the amp being applied to share.war.

However, when I start Alfresco and log in to Share, I can't see the custom content types listed when creating rules, or when changing existing content types.

If instead I edit the share_config_custom.xml file in the installed Alfresco instance (in tomcat/shared/classes/alfresco/web-extension), adding my custom types just as above, everything works fine.  New content types are visible and I can change existing content to those types and edit the custom metadata.  So I know my new content types were created successfully, but I'm doing something wrong when packing / applying the AMP to Share.

I've searched through the forums and found lots of posts related to share-config-custom.xml but haven't been able to figure out what I'm doing wrong - I'm sure it's terribly basic and any help would be appreciated.
9 REPLIES 9

drisschelouati
Champ on-the-rise
Champ on-the-rise
Hi,

I think you might have missed the form configuration in share-config-custom.xml in your share tier AMP. You need to configure the default form and the doclib-simple-metadata forms to fully render your custom model into share. ECM architect's content model tutorial explains how to do this. If you still have problems i will share with you my "greenhorn" experience Smiley Happy
But firsti would suggest not using the allinone archetype, but rather build 2 projects, one for the repo tier AMP, and one for the share tier AMP

dsmith
Champ on-the-rise
Champ on-the-rise
Thanks, I'll try switching to separate repo and share tiers in the morning instead of all-in-one.

As I understood the tutorial,the default and doclib-simple-metadata forms deal with how the metadata for the custom content type appears in the document detail view and elsewhere.

Right now I'm still a step back, trying to get my custom content types themselves to appear in menus (such as to change an existing document type to my new type, or to set up a rule involving my custom type). I can make it work perfectly by adding the code in my first post to share-config-custom in my running environment, but can't figure how to do it by applying an amp file created in the SDK.

Hi,

when you create a share tier project with the maven SDK, you can find a file named share-config-custom.xml in "$TUTORIAL_HOME/content-tutorial-share/src/main/resources/META-INF". Instead of making your changes in the original share-config.xml in your alfresco installation, you can simply add your code to the share-config-custom.xml (and dont forget the string localization for share with your .properties file) and compile your AMP. Then, simply follow the installation steps (putting the AMPS in the AMPS folder and AMPS-share folder etc…). This should apply all of your configuration when the server restarts. According to Jeff Potts, it's better not to modify any alfresco original configuration files, but to apply the changes with AMPS. Hope this will help, please tell me if it did work.

That's exactly what I've done (minus the localization, but I assume I should still see the ID string) - made the changes in the code tags on my first post to "$TUTORIAL_HOME/content-tutorial-share/src/main/resources/META-INF/share-config-custom.xml", compiled the AMP and placed it in amps_share folder in my live environment, ran apply_amps.sh and started Alfresco.  In the tutorial, that's all he's done to get the new types to appear in rule definitions and "change type" actions.  But no custom types appear in either for me (unless I make the changes to the live share-config-custom.xml, then they work fine).

I'm not seeing the custom types appear when I run run.sh to preview the changes in the development environment either, so I'm wondering if it's something to do with the all-in-one archetype.  I'm setting up the separate repo and share archetypes now to see if it makes a difference.

Oh geez.  Am I ever embarrassed.
I looked through the status messages generated from mvn integration-test and saw I didn't close my < config > tag.  I'm so used to vim catching my dumb errors with things like begin/end blocks in procedural code and wasn't thinking it wouldn't do the same for XML tags.

Thank you for all the help and sorry to waste your time on such a stupid mistake on my part.  It works perfectly now.

cupps101
Champ in-the-making
Champ in-the-making
I am having the same problem not able to see my changes (i.e Rules, Aspects, Properties) appear in the UI following Jeff tutorial http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#introduct.... I am using the all-in-one archetype. Did you use the all-in-one archetype? Is there an issue using the all-in-one archetype? I was have an error on $PROJECT_ARTIFACTID so change it to a string my artifact id com.fdc.cmspoc_dictionaryBootstrap which i copied from  bootstrap-context.xml. Need your help?
REPO-AMP folder from all-in-one project
Model:
C:\User\cupps101\projects\alfresco-extensions\fdc-cms-poc\repo-amp\src\main\amp\config\alfresco\module\repo-amp\model\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="scSmiley Tongueublished">
                    <type>d:date</type>
                </property>
                <property name="sc:isActive">
                    <type>d:boolean</type>
                    <default>false</default>
                </property>
            </properties>
        </aspect>

        <aspect name="scSmiley TongueroductRelated">
            <title>Someco Product Metadata</title>
            <properties>
                <property name="scSmiley Tongueroduct">
                    <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:
C:\User\cupps101\projects\alfresco-extensions\fdc-cms-poc\repo-amp\src\main\amp\config\alfresco\module\repo-amp\context\service-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!–
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
   
   http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
–>
<beans>
   
    <!– A simple class that is initialized by Spring –>
    <bean id="com.fdc.cmspoc.exampleBean" class="com.fdc.cmspoc.demoamp.Demo" init-method="init" />
   
    <!– A simple module component that will be executed once –>
    <bean id="com.fdc.cmspoc.exampleComponent" class="com.fdc.cmspoc.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="com.fdc.cmspoc_dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
    <property name="models">
        <list>
            <value>alfresco/module/repo-amp/model/scModel.xml</value>
        </list>
    </property>
</bean>

</beans>
Boostrap-context.xml (out of the box) no changes
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <!– The bootstrap-context.xml file is used for patch definitions, importers,
       workflow, and loading custom content models.  –>


    <!– Registration of new models –>
    <bean id="com.fdc.cmspoc.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/${project.artifactId}/model/content-model.xml</value>
                <value>alfresco/module/${project.artifactId}/model/workflow-model.xml</value>

            </list>
        </property>
    </bean>
   

SHARE-AMP folder from all-in-one project
C:\Users\cupps101\projects\alfresco-extensions\fdc-cms-poc\share-amp\src\main\resources\META-INF\share-config-custom.xml
share-config-custom.xml
<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="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>
   
    </config>
    <config evaluator="aspect" condition="sc:webable">
    <forms>
        <form>
            <field-visibility>
                <show id="scSmiley Tongueublished" />
                <show id="sc:isActive" />
            </field-visibility>
            <appearance>                   
                <field id="scSmiley Tongueublished" label-id="prop.sc_published" />
                <field id="sc:isActive" label-id="prop.sc_isActive" />
            </appearance>
        </form>
    </forms>
</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" />
                <!– scSmiley TongueroductRelated –>
                <show id="scSmiley Tongueroduct" />
                <show id="sc:version" />
                <!– sc:webable –>
                <show id="sc:isActive" />
                <show id="scSmiley Tongueublished" />
            </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>
                <!– scSmiley TongueroductRelated –>
                <field id="scSmiley Tongueroduct" 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="scSmiley Tongueublished" label-id="prop.sc_published">
                    <control template="/org/alfresco/components/form/controls/daterange.ftl" />
                </field>
            </appearance>
        </form>
    </forms>
</config>
</alfresco-config>

drisschelouati
Champ on-the-rise
Champ on-the-rise
Really glad i could help you a bit, i made the same tag mistake a while ago so i know how frustrating it can be. now, just check if your custom properties are handled by the search engine, iam currently working on this issue, check also if tags and categories are handled for your custom models ( meaning indexed) cause its not the case for mine. Let me know Smiley Happy regards

tybion
Champ in-the-making
Champ in-the-making
I have exactly the same problem with SDK 2.1 and Alfresco 5.0.d.
I am also using the All-in-one archetype.
The content model has been applied fine, but the share-config-custom.xml in share-amp/src/main/resources/META-INF is not being applied.
I have tried various mvn commands.
I have also done a 'validate' in Eclipse on the xml file - the only warning is 'No grammar constraints referenced in the document'.
I have spent over a day on this, so any help will be appreciated.
By the way, I have already applied the XML file successfully to Alfresco 5.0.d using another (less preferred) method.

tybion
Champ in-the-making
Champ in-the-making
Sorry, my problem is slightly different - RAD does not work with share-config-custom.xml.

It was reported about 18 days ago in github ..

https://github.com/Alfresco/alfresco-sdk/issues/299