AnsweredAssumed Answered

Problem in adding Custom Action

Question asked by mialfresco on Jun 23, 2009
Latest reply on Jul 24, 2009 by andrea9
Hi team,
I'm trying to add our custom action "tagging" for a space as a rule followed by
'>http://wiki.alfresco.com/wiki/Custom_Action_UI
But this is not regestering. to do this i'm using "SDK CustomAction"  example from sdk labs 3.0 stable.

what i have done is i have a custom class called TagActionExecuter.java which extends ActionExecuterAbstractBase.java
tagging-context.xml inside the alfresco.extension under the source directory.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>


   <bean id="tags.dictionaryBootstrap"
      parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
         <list>
            <value>alfresco/extension/tagsModel.xml</value>
         </list>
      </property>
   </bean>


   <bean id="tag" class="org.alfresco.sample.TagActionExecuter"
      parent="action-executer">
      <property name="nodeService">
         <ref bean="nodeService" />
      </property>
   </bean>
   <bean id="tag-action-messages"
      class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>
               org.alfresco.sample.tag-action-messages
            </value>
         </list>
      </property>
   </bean>


</beans>

and i'm having tagsModel.xml under the same directory with the following code.
<?xml version="1.0" encoding="UTF-8"?>

<!– Definition of new Model –>
<model name="tag:tagsmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>  
   <description>Tagging Model</description>
   <author>Gavin Cornwell</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="extension.tags" prefix="tag"/>
   </namespaces>
 
    <aspects>
     
      <!– Definition of new Taggable Aspect –>
      <aspect name="tag:taggable">
         <title>Taggable</title>
         <properties>
            <property name="tag:tags">
               <title>Tags</title>
               <type>d:text</type>
               <multiple>true</multiple>
            </property>
         </properties>
      </aspect>
     
   </aspects>
  
</model>

and under org.alfresco.sample package i have two files named with TagActionExecuter.java and tag-action-messages.properties


package org.alfresco.sample;

import java.util.List;

import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;

/**

* This action will adds a custom tag "Tag" to the properties of the document.
*
*
*/
public class TagActionExecuter extends ActionExecuterAbstractBase

{
   public static final String NAME = "tag";

      private NodeService nodeService;

      public void setNodeService(NodeService nodeService)
      {
         this.nodeService = nodeService;
      }
     
      protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
      {
         if (this.nodeService.exists(actionedUponNodeRef) == true)
         {
            // add the aspect if it is not already present on the node
            QName tagAspect = QName.createQName("extension.tags", "taggable");
            if (this.nodeService.hasAspect(actionedUponNodeRef, tagAspect) == false)
            {
               this.nodeService.addAspect(actionedUponNodeRef, tagAspect, null);
            }
         }
     }
     
      @Override
      protected void addParameterDefinitions(List<ParameterDefinition> paramList)
      {
         // there are no parameters
      }

}

tag.title=Add tags to item
tag.description=This action adds tags to the matched item

and in web-client-config-custom.xml i have added the following stuff

<!– added for adding tag property –>
<config evaluator="aspect-name" condition="tag:taggable">
   <property-sheet>
      <show-property name="tag:tags" />
   </property-sheet>
</config>


and thats it what i have done and i'm getting the following error. do i miss some thing.
Please help me.

perties file from class path resource [alfresco/file-servers.properties]
13:03:19,231  ERROR [web.context.ContextLoader] Context initialization failed
java.util.MissingResourceException: Can't find bundle for base name
                                        org.alfresco.sample.tag-action-messages
                                , locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle
.java:836)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:726)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
        at org.alfresco.i18n.I18NUtil.getLocaleProperties(I18NUtil.java:427)
        at org.alfresco.i18n.I18NUtil.getMessage(I18NUtil.java:311)
        at org.alfresco.i18n.I18NUtil.getMessage(I18NUtil.java:341)
        at org.alfresco.i18n.I18NUtil.getMessage(I18NUtil.java:328)
        at org.alfresco.util.LogUtil.error(LogUtil.java:106)
        at org.alfresco.repo.domain.schema.SchemaBootstrap.onBootstrap(SchemaBoo
tstrap.java:1189)
        at org.alfresco.util.AbstractLifecycleBean.onApplicationEvent(AbstractLi
fecycleBean.java:62)
        at org.springframework.context.event.SimpleApplicationEventMulticaster$1
.run(SimpleApplicationEventMulticaster.java:77)
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecut
or.java:49)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.m
ulticastEvent(SimpleApplicationEventMulticaster.java:75)
        at org.springframework.context.support.AbstractApplicationContext.publis
hEvent(AbstractApplicationContext.java:246)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:355)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:244)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:187)
        at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:49)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3843)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
342)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)

        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719
)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:117)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
16)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Jun 23, 2009 1:03:19 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jun 23, 2009 1:03:19 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/alfresco] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class
reloading, using NOPLoggerRepository.
13:03:36,455  INFO  [web.site.FrameworkHelper] Successfully Initialized Web Fram
ework
13:03:44,114  INFO  [web.scripts.DeclarativeRegistry] Registered 67 Web Scripts
(+0 failed), 71 URLs
13:03:44,130  INFO  [web.scripts.AbstractRuntimeContainer] Initialised Presentat
ion Web Script Container (in 1761.777ms)
13:04:46,292  INFO  [web.scripts.DeclarativeRegistry] Registered 101 Web Scripts
(+0 failed), 105 URLs
13:04:46,292  INFO  [web.scripts.AbstractRuntimeContainer] Initialised WebFramew
ork Web Script Container (in 62066.742ms)
13:04:46,433  INFO  [web.site.FrameworkHelper] Successfully Initialized Web Fram
ework
13:04:53,138  INFO  [web.scripts.DeclarativeRegistry] Registered 23 Web Scripts
(+0 failed), 25 URLs
13:04:53,185  INFO  [web.scripts.AbstractRuntimeContainer] Initialised Presentat
ion Web Script Container (in 517.2845ms)
13:04:53,951  INFO  [web.scripts.DeclarativeRegistry] Registered 61 Web Scripts
(+0 failed), 63 URLs
13:04:53,998  INFO  [web.scripts.AbstractRuntimeContainer] Initialised WebFramew
ork Web Script Container (in 744.06287ms)
13:04:54,060  INFO  [web.site.FrameworkHelper] Successfully Initialized Web Fram
ework
Jun 23, 2009 1:04:54 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jun 23, 2009 1:04:54 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 195057 ms


Outcomes