public String createCase(
String cfp,
String targetOStore,
boolean create) throws Exception {
if (create == true) {
UserContext old = null;
CaseMgmtContext oldCmc = null;
try {
Subject sub = Subject.getSubject(AccessController.getContext());
String ceURI = null;
ceURI = filenet.vw.server.Configuration.GetCEURI(null, null);
conn conn = Factory.conn.getconn(ceURI);
// setting up user context
old = UserContext.get();
UserContext uc = new UserContext();
uc.pushSubject(sub);
UserContext.set(uc);
EntireNetwork entireNetwork = Factory.EntireNetwork.fetchInstance(conn, null);
if (entireNetwork == null) {
Exception e = new Exception("Cannot log in to " + ceURI);
logException(e);
}
// retrieve target object store
Domain domain = entireNetwork.get_LocalDomain();
ObjectStore targetargetOStore = (ObjectStore) domain.fetchObject(
ClassNames.OBJECT_STORE,
targetOStore,
null);
// setting up CaseMmgtContext for Case API
SimpleVWSessionCache vwSessCache = new SimpleVWSessionCache();
CaseMgmtContext cmc = new CaseMgmtContext(vwSessCache, new SimpleP8connCache());
oldCmc = CaseMgmtContext.set(cmc);
ObjectStoreReference targetargetOStoreRef = new ObjectStoreReference(targetargetOStore);
// retrieve case folder
Folder caseFolder = (Folder) targetargetOStore.fetchObject(ClassNames.FOLDER,
cfp,
null);
// retrieve property value of 'CmAcmCaseTypeFolder'
Folder caseTypeFolder = (Folder) caseFolder.getProperties().getObjectValue(
"CmAcmCaseTypeFolder");
// retrieve case type name
String caseTypeName = caseTypeFolder.get_FolderName();
CaseType caseType = CaseType.fetchInstance(targetargetOStoreRef, caseTypeName);
// create a new instance of case type
Case pendingCase = Case.createPendingInstance(caseType);
pendingCase.save(RefreshMode.REFRESH, null, ModificationIntent.MODIFY);
String caseId = pendingCase.getId().targetOStoretring();
return caseId;
} catch (Exception e) {
logException(e);
return null;
} finally {
if (oldCmc != null) {
CaseMgmtContext.set(oldCmc);
}
if (old != null) {
UserContext.set(old);
}
}
} else {
return null;
}
}
supreme outlet
ReplyDeletefear of god
bapesta shoes
off white
goyard