在 Alfresco 中创建方面时出错

Error while creating an aspect in Alfresco

我是 Alfresco 的初学者。我尝试在成功添加的 alfresco.It 中创建示例方面,并且我能够将方面标记到某些 documents.The fields/parameters 下,该方面未显示该文档。

这些是我的代码

/extension/kb-model.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- Definition of Knowledge Base Model -->

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

   <!-- Optional meta-data about the model -->
   <description>Knowledge Base Model</description>
   <author>Will Abson</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.alfresco.com/model/knowledgebase/1.0" prefix="kb"/>
   </namespaces>

    <aspects>
      <!-- Definition of new Content Aspect: Knowledge Base Document -->
      <aspect name="kb:referencable">
         <title>Knowledge Base Referencable</title>
         <properties>
            <property name="kb:documentRef">
               <type>d:text</type>
            </property>
         </properties>
      </aspect>
   </aspects>

</model>

/extension/kb-model-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <!-- Registration of new models -->
    <bean id="extension.kb.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/kb-model.xml</value>
            </list>
        </property>
    </bean>

     <bean id="extension.kb.resourceBundle" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
       <property name="resourceBundles">
          <list>
             <value>alfresco.messages.knowledgebase</value>
          </list>
       </property>
    </bean>

</beans>

/web-extension/share-config-custom.xml

     <visible>
            <aspect name="cm:emailed" />
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
            <aspect name="cm:geographic" />
            <aspect name="exif:exif" />
            <aspect name="audio:audio" />
            <aspect name="cm:indexControl" />
            <aspect name="dp:restrictable" />
            <aspect name="kb:referencable" />
         </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>



<config evaluator="aspect" condition="kb:referencable">
   <forms>
      <form>
         <field-visibility>
            <!-- fields from my example aspect -->
            <show id="kb:documentRef" />
         </field-visibility>
        <appearance>
                <field id="kb:documentRef" />
        </appearance>
      </form>
   </forms>
</config>

您忘记关闭第 350 行方面下方的 <config> 标签

--更新--

这部分在 <config> 标签内,应该在标签外

     <!-- Added by vipin kp to add new aspects to alfresco -->
<!--*********************************************************************************************************-->
      <!-- cm:content type (existing nodes) -->

   <!-- cm:content type (existing nodes) -->


<config evaluator="aspect" condition="kb:referencable">
   <forms>
      <form>
         <field-visibility>
            <!-- fields from my example aspect -->
            <show id="kb:documentRef" />
         </field-visibility>
    <appearance>
        <field id="kb:documentRef" />
    </appearance>
      </form>
   </forms>
</config>

<!-- End of Form customization for whitepaper -->

您的 share-config-custom 不正确。 下面是完整的 xml。

    <!-- Global config section -->
    <config replace="true">
        <flags>
            <!--
            Developer debugging setting to turn on DEBUG mode for client scripts in the browser
         -->
            <client-debug>false</client-debug>

            <!--
            LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
            This flag automatically activates logging on page load.
         -->
            <client-debug-autologging>false</client-debug-autologging>
        </flags>
    </config>

    <config evaluator="string-compare" condition="WebFramework">
        <web-framework>
            <!-- SpringSurf Autowire Runtime Settings -->
            <!-- 
              Developers can set mode to 'development' to disable; SpringSurf caches,
              FreeMarker template caching and Rhino JavaScript compilation.
         -->
            <autowire>
                <!-- Pick the mode: "production" or "development" -->
                <mode>production</mode>
            </autowire>

            <!-- Allows extension modules with <auto-deploy> set to true to be automatically deployed -->
            <module-deployment>
                <mode>manual</mode>
                <enable-auto-deploy-modules>true</enable-auto-deploy-modules>
            </module-deployment>



        </web-framework>
    </config>

    <config evaluator="string-compare" condition="CSRFPolicy" replace="true">
        <client>
            <cookie>Alfresco-CSRFToken</cookie>
            <header>Alfresco-CSRFToken</header>
            <parameter>Alfresco-CSRFToken</parameter>
        </client>
        <filter>
            <rule>
                <request>
                    <method>POST</method>
                    <path>^\/page\/caches\/dependency\/clear|^\/page\/index|^\/page\/surfBugStatus|^\/page\/modules\/deploy|^\/page\/modules\/module|^\/page\/api\/javascript\/debugger</path>
                </request>
                <action name="assertReferer">
                    <param name="always">false</param>
                    <param name="referer">https://myfdqn.com/.*</param>
                </action>
                <action name="assertOrigin">
                    <param name="always">false</param>
                    <param name="origin">https://myfdqn.com</param>
                </action>
            </rule>

            <!-- Certain Share POST requests does NOT require a token -->
            <rule>
                <request>
                    <method>POST</method>
                    <path>^/page/dologin.*|^\/page/site\/[^\/]+\/start-workflow|^\/page/start-workflow</path>
                </request>
                <action name="assertReferer">
                    <param name="always">false</param>
                    <param name="referer">https://myfdqn.com/.*</param>
                </action>
                <action name="assertOrigin">
                    <param name="always">false</param>
                    <param name="origin">https://myfdqn.com</param>
                </action>
            </rule>

            <!-- Clear the token when logging out -->
            <rule>
                <request>
                    <method>GET</method>
                    <path>^/page/dologout.*</path>
                </request>
                <action name="clearToken">
                    <param name="session">Alfresco-CSRFToken</param>
                    <param name="cookie">Alfresco-CSRFToken</param>
                </action>
            </rule>

            <!-- Make sure the first token is generated -->
            <rule>
                <request>
                    <session>
                        <attribute name="_alf_USER_ID">.*</attribute>
                        <attribute name="Alfresco-CSRFToken"/>
                        <!-- empty attribute element indicates null -->
                    </session>
                </request>
                <action name="generateToken">
                    <param name="session">Alfresco-CSRFToken</param>
                    <param name="cookie">Alfresco-CSRFToken</param>
                </action>
            </rule>

            <!-- Refresh token on new "page" visit when a user is logged in -->
            <rule>
                <request>
                    <method>GET</method>
                    <path>^/page/.*</path>
                    <session>
                        <attribute name="_alf_USER_ID">.*</attribute>
                        <attribute name="Alfresco-CSRFToken">.*</attribute>
                    </session>
                </request>
                <action name="generateToken">
                    <param name="session">Alfresco-CSRFToken</param>
                    <param name="cookie">Alfresco-CSRFToken</param>
                </action>
            </rule>

            <!-- Verify multipart requests contains the token as a parameter and also correct referer & origin header if available -->
            <rule>
                <request>
                    <method>POST</method>
                    <header name="Content-Type">^multipart/.*</header>
                    <session>
                        <attribute name="_alf_USER_ID">.*</attribute>
                    </session>
                </request>
                <action name="assertToken">
                    <param name="session">Alfresco-CSRFToken</param>
                    <param name="parameter">Alfresco-CSRFToken</param>
                </action>
                <action name="assertReferer">
                    <param name="always">false</param>
                    <param name="referer">https://myfdqn.com/.*</param>
                </action>
                <action name="assertOrigin">
                    <param name="always">false</param>
                    <param name="origin">https://myfdqn.com</param>
                </action>
            </rule>
            <rule>
                <request>
                    <method>POST|PUT|DELETE</method>
                    <session>
                        <attribute name="_alf_USER_ID">.*</attribute>
                    </session>
                </request>
                <action name="assertToken">
                    <param name="session">Alfresco-CSRFToken</param>
                    <param name="header">Alfresco-CSRFToken</param>
                </action>
                <action name="assertReferer">
                    <param name="always">false</param>
                    <param name="referer">https://myfdqn.com/.*</param>
                </action>
                <action name="assertOrigin">
                    <param name="always">false</param>
                    <param name="origin">https://myfdqn.com</param>
                </action>

            </rule>
        </filter>
    </config>


    <config evaluator="string-compare" condition="Replication">
        <share-urls>

        </share-urls>
    </config>
    <config evaluator="aspect" condition="kb:referencable">
        <forms>
            <form>
                <field-visibility>
                    <show id="kb:documentRef" />
                </field-visibility>
                <appearance>
                    <field id="kb:documentRef" />
                </appearance>
            </form>
        </forms>
    </config>
    <config evaluator="string-compare" condition="DocumentLibrary" replace="true">
        <tree>
            <evaluate-child-folders>false</evaluate-child-folders>
            <maximum-folder-count>1000</maximum-folder-count>
            <timeout>7000</timeout>
        </tree>
        <aspects>
            <!-- Aspects that a user can see -->
            <visible>
                <aspect name="cm:generalclassifiable" />
                <aspect name="cm:complianceable" />
                <aspect name="cm:dublincore" />
                <aspect name="cm:effectivity" />
                <aspect name="cm:summarizable" />
                <aspect name="cm:versionable" />
                <aspect name="cm:templatable" />
                <aspect name="cm:emailed" />
                <aspect name="emailserver:aliasable" />
                <aspect name="cm:taggable" />
                <aspect name="app:inlineeditable" />
                <aspect name="cm:geographic" />
                <aspect name="exif:exif" />
                <aspect name="audio:audio" />
                <aspect name="cm:indexControl" />
                <aspect name="dp:restrictable" />
                <aspect name="kb:referencable" />
            </visible>
            <addable>
            </addable>
            <removeable>
            </removeable>
        </aspects>




        <types>
            <type name="cm:content">
            </type>

            <type name="cm:folder">
            </type>

            <type name="trx:transferTarget">
                <subtype name="trx:fileTransferTarget" />
            </type>
        </types>

        <repository-url>http://localhost:8084/alfresco</repository-url>
        <google-docs>

            <enabled>false</enabled>
            <creatable-types>
                <creatable type="doc">application/vnd.openxmlformats-officedocument.wordprocessingml.document</creatable>
                <creatable type="xls">application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</creatable>
                <creatable type="ppt">application/vnd.ms-powerpoint</creatable>
            </creatable-types>
        </google-docs>

        <file-upload>
            <adobe-flash-enabled>true</adobe-flash-enabled>
        </file-upload>
    </config>


    <config evaluator="string-compare" condition="DocLibActions">
        <actionGroups>
            <actionGroup id="document-browse">


            </actionGroup>
        </actionGroups>
    </config>

    <!-- Global folder picker config section -->
    <config evaluator="string-compare" condition="GlobalFolder">
        <siteTree>
            <container type="cm:folder">
                <rootLabel>location.path.documents</rootLabel>
                <uri>slingshot/doclib/treenode/site/{site}/{container}{path}?children={evaluateChildFoldersSite}&amp;max={maximumFolderCountSite}</uri>
            </container>
        </siteTree>
    </config>
    <config evaluator="string-compare" condition="RepositoryLibrary" replace="true">

        <root-node>alfresco://company/home</root-node>

        <tree>
            <evaluate-child-folders>false</evaluate-child-folders>
            <maximum-folder-count>500</maximum-folder-count>
        </tree>

        <visible>true</visible>
    </config>
    <config evaluator="string-compare" condition="KerberosDisabled" replace="true">
        <kerberos>
            <password>secret</password>
            <realm>ALFRESCO.ORG</realm>
            <endpoint-spn>HTTP/repository.server.com@ALFRESCO.ORG</endpoint-spn>
            <config-entry>ShareHTTP</config-entry>
            <stripUserNameSuffix>true</stripUserNameSuffix>
        </kerberos>
    </config>

    <config evaluator="string-compare" condition="Remote">
        <remote>
            <endpoint>
                <id>alfresco-noauth</id>
                <name>Alfresco - unauthenticated access</name>
                <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
                <connector-id>alfresco</connector-id>
                <endpoint-url>http://localhost:8084/alfresco/s</endpoint-url>
                <identity>none</identity>
            </endpoint>

            <endpoint>
                <id>alfresco</id>
                <name>Alfresco - user access</name>
                <description>Access to Alfresco Repository WebScripts that require user authentication</description>
                <connector-id>alfresco</connector-id>
                <endpoint-url>http://localhost:8084/alfresco/s</endpoint-url>
                <identity>user</identity>
            </endpoint>

            <endpoint>
                <id>alfresco-feed</id>
                <name>Alfresco Feed</name>
                <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
                <connector-id>http</connector-id>
                <endpoint-url>http://localhost:8084/alfresco/s</endpoint-url>
                <basic-auth>true</basic-auth>
                <identity>user</identity>
            </endpoint>
        </remote>
    </config>
</alfresco-config>

不知道您使用的是哪个版本,如果是 4.2.x 我认为您应该将文件放在:

/your-amp/src/main/resources/META-INF/share-config-custom.xml