Questo argomento si applica solo alla configurazione IBM Business Automation Workflow Advanced.

Sviluppo tabella query

Le tabelle di query supplementari e composite in Business Process Choreographer vengono sviluppate durante lo sviluppo dell'applicazione utilizzando Query Table Builder. Le tabelle di query predefinite non possono essere sviluppate o distribuite. Sono disponibili quando è installato Business Process Choreographer e forniscono una vista semplice sulle risorse utente nello schema del database Business Process Choreographer .

Il generatore di tabelle di query è disponibile come plug-in Eclipse e può essere scaricato sul sito SupportPacs . Ricercare PA71 WebSphere Process Server - Query Table Builder. Per accedere al link, consultare la relativa sezione dei riferimenti di questo argomento.

Le tabelle di query influiscono sul modo in cui le applicazioni vengono sviluppate e distribuite. La seguente procedura descrive i ruoli coinvolti quando si progetta e si sviluppa un'applicazione Business Process Choreographer che utilizza tabelle di query.
Tabella 1. Passi di sviluppo delle tabelle di interrogazione
Fase Chi Descrizione
1. Analisi Business analyst, sviluppatore client Analizzare quali tabelle di query sono necessarie nell'applicazione client. Le domande a cui rispondere sono:
  • Quanti elenchi di attività o processi vengono forniti all'utente? Esistono elenchi di attività o processi che possono condividere la stessa tabella di query?
  • Che tipo di autorizzazione viene utilizzato? Autorizzazione basata sull'istanza, autorizzazione basata sul ruolo o nessuna?
  • Ci sono altre tabelle di query già definite nel sistema che possono essere riutilizzate?
  • Le tabelle di query devono fornire il contenuto in più lingue? In tal caso, i criteri di selezione sulle tabelle di query allegate devono essere LOCALE=$LOCALE.
2. Sviluppo di tabelle di query Sviluppatore client, analista di business Sviluppare le tabelle query utilizzate nell'applicazione client. Provare a specificare la definizione delle tabelle di query in modo da ottenere le migliori prestazioni con le query delle tabelle di query.
3. Distribuzione della tabella di query Amministratore Le tabelle di query devono essere distribuite al runtime prima di poter essere utilizzate. Questo passaggio viene eseguito con il comando manageQueryTable.py wsadmin.
4. Query tabella query Sviluppatore client L'esecuzione di query su tabelle di query è l'ultima fase di sviluppo della tabella di query. Lo sviluppatore del client deve conoscere il nome della tabella query e i suoi attributi.

Il seguente è un codice di esempio, che utilizza l'API della tabella di query per eseguire la query di una tabella di query. Gli esempi 1 e 2 vengono forniti per interrogare la tabella di query predefinita TASK per motivi di semplicità. Gli esempi 3 e 4 interrogano una tabella di query composita, che si presume sia distribuita sul sistema. Nello sviluppo dell'applicazione, è necessario utilizzare le tabelle di query composite piuttosto che interrogare direttamente le tabelle di query predefinite.

Esempio 1

   // get the naming context and lookup the Business
   // Flow Manager Enterprise JavaBeans home; note that the Business Flow 
   // Manager Enterprise JavaBeans home should be cached for performance 
   // reasons; also, it is assumed that there's an Enterprise JavaBeans 
   // reference to the local business flow manager Enterprise JavaBeans
   Context ctx = new InitialContext();
   LocalBusinessFlowManagerHome home = 
   	(LocalBusinessFlowManagerHome) 
   	ctx.lookup("java:comp/env/ejb/BFM");
   
   // if the human task manager Enterprise JavaBeans is used, do:
   // LocalHumanTaskManagerHome home =
   //   (LocalHumanTaskManagerHome) ctx.lookup("java:comp/env/ejb/HTM");
   // assuming that a EJB reference to the human task manager EJB
   // has been defined
   
   // create the business flow manager client-side stub
   LocalBusinessFlowManager bfm = home.create();
   // if the human task manager EJB is used, do:
   // LocalHumanTaskManager htm = home.create();
   // note that the human task manager Enterprise JavaBeans provides the
   // same methods as the business flow manager Enterprise JavaBeans 
   // *************************************************
   // ******************* example 1 *******************
   // *************************************************
   
   // run a query against the TASK predefined query 
   // table; this relates to a simple My ToDo's task list
   EntityResultSet ers = null;
   ers = bfm.queryEntities("TASK", null, null, null);
   
   // print the result to STDOUT
   EntityInfo entityInfo = ers.getEntityInfo();
   List attList = entityInfo.getAttributeInfo();
   int attSize = attList.size();

   Iterator iter = ers.getEntities().iterator();
   while (iter.hasNext()) {
   	System.out.print("Entity: ");
   	Entity entity = (Entity) iter.next();
   	for (int i = attSize - 1; i >= 0; i--) {
   		AttributeInfo ai = (AttributeInfo) attList.get(i);
   		System.out.print(
      	entity.getAttributeValue(ai.getName()));
   	}
   	System.out.println();
   }
 

Esempio 2

   // *************************************************
   // ******************* example 2 *******************
   // *************************************************
   
   // same example as example 1, but using the row-based
   // query approach
   RowResultSet rrs = null;
   rrs = bfm.queryRows("TASK", null, null, null);
   
   attList = rrs.getAttributeInfo();
   attSize = attList.size();

   // print the result to STDOUT
   while (rrs.next()) {
   	System.out.print("Row: ");
   	for (int i = attSize - 1; i >= 0; i--) {
   		AttributeInfo ai = (AttributeInfo) attList.get(i);
   		System.out.print(
      	rrs.getAttributeValue(ai.getName()));
   	}
   	System.out.println();
   }
   
    

Esempio 3

   // *************************************************
   // ******************* example 3 *******************
   // *************************************************
   
   // run a query against a composite query table
   // that has been deployed on the system before;
   // the name is assumed to be COMPANY.TASK_LIST
   ers = bfm.queryEntities(
   		"COMPANY.TASK_LIST", null, null, null);
^
   // 	print the result to STDOUT ...

Esempio 4

   // *************************************************
   // ******************* example 4 *******************
   // *************************************************
   
   // query against the same query table as in example 3,
   // but with customized options
   FilterOptions fo = new FilterOptions();

   // return only objects which are in state ready
   fo.setQueryCondition("STATE=STATE_READY");
   
   // sort by the id of the object
   fo.setSortAttributes("ID");
   
   // limit the number of entities to 50
   fo.setThreshold(50);
   
   // only get a sub-set of the defined attributes
   // on the query table
   fo.setSelectedAttributes("ID, STATE, DESCRIPTION");
   
   AuthorizationOptions ao = new AuthorizationOptions();
   
   // do not return objects that everybody is allowed
   // to see
   ao.setEverybodyUsed(Boolean.FALSE);
   
   ers = bfm.queryEntities(
   		"COMPANY.TASK_LIST", fo, ao, null);

   // 	print the result to STDOUT ...