Implement Connector

1
0
-1

Bonjour,

J'ai créé une application externe avec une classe Personne ayant comme attributs (id,nom et prenom). Pour faire appel à la persistance de mon objet java au sein de Bonita, j'ai utilisé les connecteurs existants ("Script") pour définir le mien et l’implémenter en fonction du besoin,j'ai importé mon jar(ma classe Personne):

import java.io.Serializable;

public class Personne implements Serializable {

/** * */ private static final long serialVersionUID = 1L; protected Integer id ; protected String nom; protected String prenom;

public Integer getId() { return this.id; } public String getNom() { return this.nom; } public String getPrenom(){ return this.prenom; } public void setId(Integer id) { this.id = id; } public void setNom(String nom) { this.nom = nom; } public void setPrenom(String prenom){ this.prenom=prenom; }

public Personne() {

}

public void listPersonne() { System.out.print("listPersonne done"); }

public static void main(String[] args) { // TODO Auto-generated method stub Personne p= new Personne(); p.listPersonne(); } @Override public String toString() { return "[Personne: id=" + id.toString() + " nom=" + nom + " prenom=" + prenom +"]"; } }

Je veux savoir comment implémenter l'ouverture/fermeture de connexions vers ma base de données externe et la méthode"executeBusinessLogic" ici :

/** * */ package org.mycompany.connector;

import org.bonitasoft.engine.connector.ConnectorException;

/** *The connector execution will follow the steps * 1 - setInputParameters() --> the connector receives input parameters values * 2 - validateInputParameters() --> the connector can validate input parameters values * 3 - connect() --> the connector can establish a connection to a remote server (if necessary) * 4 - executeBusinessLogic() --> execute the connector * 5 - getOutputParameters() --> output are retrieved from connector * 6 - disconnect() --> the connector can close connection to remote server (if any) */ public class PersonneImpl extends AbstractPersonneImpl {

@Override
protected void executeBusinessLogic() throws ConnectorException{
    //Get access to the connector input parameters

    //TODO execute your business logic here 

    //WARNING : Set the output of the connector execution. If outputs are not set, connector fails

 }

@Override
public void connect() throws ConnectorException{
    //[Optional] Open a connection to remote server

}

@Override
public void disconnect() throws ConnectorException{
    //[Optional] Close connection to remote server

}

}

afin que je puisse faire marcher ma méthode "listPesronne" et ajouter des personnes dans ma base externe.

Quelqu'un a une idée svp. J'ai besoin d'aide.Merci beaucoup.

Comments

Submitted by k27 on Thu, 06/26/2014 - 14:49

Quelques propositions svp :) c'est urgent

No answers yet.
Notifications