2015-11-05 4 views
-1

Я застрял на работе в течение как недели теперь,IBM Case Manager Connection

может some1 с CM JAVAAPI exprience наставит меня, что я делаю неправильно?

Я пытаюсь подключиться к серверу, на котором установлен Case Manger, и начать сеанс , возможно, я делаю все неправильно, но Центр знаний IBM не помог.

ответ

1

GOT IT!

package *packacge*; 
// jars from the the CM different installation folders on the server 
import java.util.List; 
import java.util.Locale; 

import javax.security.auth.Subject; 
import com.filenet.api.core.Connection; 
import com.filenet.api.core.ObjectStore; 
import com.filenet.api.util.UserContext; 
import com.ibm.casemgmt.api.CaseType; 
import com.ibm.casemgmt.api.DeployedSolution; 
import com.ibm.casemgmt.api.context.CaseMgmtContext; 
import com.ibm.casemgmt.api.context.P8ConnectionCache; 
import com.ibm.casemgmt.api.context.SimpleP8ConnectionCache; 
import com.ibm.casemgmt.api.context.SimpleVWSessionCache; 
import com.ibm.casemgmt.api.objectref.ObjectStoreReference; 


public class CaseMgmtSession { 

    public static void main(String[] args) { 
     P8ConnectionCache connCache = new SimpleP8ConnectionCache(); 
     Connection conn = connCache.getP8Connection("http://*ip of the server CM is installed on*/wsi/FNCEWS40MTOM/"); 
     Subject subject = UserContext.createSubject(conn, *user of CM builder admin*, *pass of CM builder admin*, "FileNetP8WSI"); 
     UserContext uc = UserContext.get(); 
     uc.pushSubject(subject); 
     Locale origLocale = uc.getLocale(); 
     uc.setLocale(Locale.ENGLISH); 
     CaseMgmtContext origCmctx = CaseMgmtContext.set(new CaseMgmtContext(new SimpleVWSessionCache(), connCache)); 
     try { 
      // Code that calls the Case Java API or 
      // directly calls the CE Java API 
      // checking the connection is working 
      ObjectStore os = P8Connector.getObjectStore(*some object store name*); 
      ObjectStoreReference osRef = new ObjectStoreReference(os); 
      DeployedSolution someSolution = DeployedSolution.fetchInstance(osRef, *some deployed solution name*); 
      System.out.println(someSolution.getSolutionName()); 
      List<CaseType> caseTypes = someSolution.getCaseTypes(); 
      for(CaseType ct : caseTypes) { 
       System.out.println(ct.getName()); 
      } 
     } 
     finally { 
      CaseMgmtContext.set(origCmctx); 
      uc.setLocale(origLocale); 
      uc.popSubject(); 
     } 
    } 

} 

где P8Connector класса я написал, возвращающий в ObjectStore

+0

независимо от решения имени я обеспечиваю, он говорит, что не может найти ... и я знаю, что там. Есть ли какое-то странное соглашение об именах о имени решения? – Petar

Смежные вопросы