简体   繁体   English

IBM 案例管理器连接

[英]IBM Case Manager Connection

I'm stuck at work for like a week now,我现在被困在工作一周左右,

can some1 with CM JavaAPI exprience guide me what am I doing wrong?有 CM JavaAPI 经验的 some1 可以指导我我做错了什么吗?

I try to connect to the server where the Case Manger is installed and start a session, maybe I'm doing it all wrong but IBM Knowledge Center did not help.我尝试连接到安装了 Case Manger 的服务器并启动会话,也许我做错了,但 IBM 知识中心没有帮助。

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();
        }
    }

}

where P8Connector is a class i wrote that returns an objectstore其中 P8Connector 是我编写的返回对象存储的类

I dont know which version of Case Manager you are talking about.我不知道你说的是哪个版本的 Case Manager。 However, for 5.2.1.x, you will find ample references on IBM's site.但是,对于 5.2.1.x,您会在 IBM 的站点上找到大量参考资料。 For example - here and here .例如 - 这里这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM