cancel
Showing results for 
Search instead for 
Did you mean: 

listes des Actions

dicou
Champ in-the-making
Champ in-the-making
bonjour,
je créer une action pour ajouter un aspect dans la listes des propriétés d'un document. Mais je peux pas trouver mon action a la listes des actions dans la vue détaillée .
voila le code de mes fichier de classe java.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
     
    <!– Logger Action Bean –>
    <bean id="cv-expert-action" class="org.alfresco.sampl.Actioncvexpert" parent="action-executer">
      <property name="nodeService">
            <ref bean="nodeService"/>
        </property>
    </bean>
      <!– Load the Logger Action Messages –>  
      <bean id="cv-expert-action-messages" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
       <property name="resourceBundles">
          <list>
             <value>org.alfresco.sampl.cv-expert-action-messages</value>
          </list>
       </property>
      </bean>
     
</beans>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
     
    <!– Logger Action Bean –>
    <bean id="cv-expert-action" class="org.alfresco.sampl.Actioncvexpert" parent="action-executer">
      <property name="nodeService">
            <ref bean="nodeService"/>
        </property>
    </bean>
      <!– Load the Logger Action Messages –>  
      <bean id="cv-expert-action-messages" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
       <property name="resourceBundles">
          <list>
             <value>org.alfresco.sampl.cv-expert-action-messages</value>
          </list>
       </property>
      </bean>
     
</beans>
package org.alfresco.sampl;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class CVExpert {
 
   private Connection connexion;
   private Statement instruction;
   private ResultSet resultat;
   
   static private String StaticId;
   

   
   private int Id;
   private String NomSociete;
   
   private String PaysSociete;


   
   
      
   public CVExpert() {
      try {
         Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
         connexion=DriverManager.getConnection("jdbc:sqlserver://xxxx;database=xxxxxx;user=xxxxx;password=xxxxx);
         instruction=connexion.createStatement();
      }catch
         (SQLException e){System.err.println("base de donne introuvable");}
      catch
         (ClassNotFoundException e1) {System.err.println("probleme de pilote");}
      
}

   public void importer()
   {
      String id_expertStr;
int id_expert = 0;
      System.out.println("————–>Dans Importer"+CVExpert.getStaticId());
      if (CVExpert.getStaticId()!= null){
   id_expertStr=CVExpert.getStaticId();
      id_expert= Integer.parseInt(id_expertStr)   ;   
            System.out.println("—————————>"+id_expertStr);
      
      try {
         resultat=instruction.executeQuery("SELECT "    
+" dbo.Pays.Pays , Experts.[N° société partenaire],"
+" dbo.[Sociétés partenaires].[N° société partenaire], dbo.[Sociétés partenaires].[Nom société],"
+" dbo.[Sociétés partenaires].Pays "
+" FROM "
+"  dbo.[Sociétés partenaires]INNER JOIN "
+"  Experts ON  dbo.[Sociétés partenaires].[N° société partenaire]= Experts.[N° société partenaire] FULL OUTER JOIN "
+"  Pays ON dbo.[Sociétés partenaires].Pays = dbo.Pays.[Code pays]"
+" where (Experts.[Numéro]= "+id_expert+")");
         
         while(resultat.next())
         {
         System.out.println("——————>"+id_expert);
         this.setNomSociete(resultat.getString("Nom société"));
         this.setPaysSociete(resultat.getString(1));
         //System.out.println("nom:"+NomSociete);
         //System.out.println("Pays:"+PaysSociete);
         }
      } catch (SQLException e) {
         
         System.err.println("requete invalide");
         e.printStackTrace();
      }
   }
}
   
   public static String getStaticId() {
      return StaticId;
   }
public static void setStaticId(String staticId) {
      StaticId = staticId;
   }
   public int getId() {
      return Id;
   }
   public void setId(int id) {
      Id = id;
   }

   public String getNomSociete() {
      return NomSociete;
   }


   
   public void setNomSociete(String nomsoc) {
      NomSociete = nomsoc;
   }
   public String getPaysSociete() {
      return PaysSociete;
   }

   public void setPaysSociete(String payssoc) {
      PaysSociete = payssoc;
   }


}
package org.alfresco.sampl;

import org.alfresco.service.namespace.QName;



public interface CVExpertModel {

    static final String CVEXPERT_MODEL_URI = "cvc.new.model";
    static final String CVEXPERT_MODEL_PREFIX = "cvc";
   

    static final QName TYPE_CVEXPERT = QName.createQName(CVEXPERT_MODEL_URI, "cv-expert");

  
   
    static final QName PROP_IDEXPERT = QName.createQName(CVEXPERT_MODEL_URI, "id_expert");
    static final QName PROP_NOMSOCIETE = QName.createQName(CVEXPERT_MODEL_URI, "NomSociete");
    static final QName PROP_PAYSSOCIETE = QName.createQName(CVEXPERT_MODEL_URI, "PaysSociete");
   

}
##
## Logger Action I18N file
##

# Action title and description
cv-expert-action.title=cv-expert Action
cv-expert-action.description=…

<?xml version="1.0"?>

<project name="ASPSP ACTION" default="package" basedir=".">

   <property name="project.dir" value="."/>
   <property name="build.dir" value="${project.dir}/build"/>
   <property name="package.file" value="${build.dir}/cv-expert-action.jar"/>
  
   <path id="class.path">
      <dirset dir="${build.dir}" />
      <fileset dir="/alfresco-community-sdk-3.2r2/lib/server" includes="**/*.jar"/>
   </path>
  
   <target name="compile">
      
      <mkdir dir="${build.dir}" />
      <javac classpathref="class.path" srcdir="${project.dir}/src" destdir="${build.dir}" />
   </target>
  
   <target name="package">
      <delete file="${package.file}"/>
      <jar destfile="${package.file}">
         <fileset dir="${build.dir}"/>
      </jar>
   </target>

</project>   
Cordialement.
1 REPLY 1

rivarola
Champ on-the-rise
Champ on-the-rise
Bonjour,

Pour qu'une action soit utilisable depuis les interfaces Alfresco il faut lui associer un Handler dans le web-client-config-custom.xml :
   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         …
      </aspects>
      <action-handlers>
         <handler name="cv-expert-action" class="com.knowings.kmsj.web.bean.actions.handlers.XXXXHandler" />
     </action-handlers>
      <condition-handlers>
         …
      </condition-handlers>
   </config>

La classe associée hérite en général de BaseActionHandler.