use of com.centurylink.mdw.dataaccess.RuntimeDataAccess in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method updateVariableInstanceInDb.
public void updateVariableInstanceInDb(VariableInstanceInfo varInstInfo, String newValue, boolean isDocument) throws DataAccessException {
// needs a separate db connection for some reason?
DatabaseAccess db = new DatabaseAccess(currentServer.getDatabaseUrl());
try {
RuntimeDataAccess runtimeDao = DataAccess.getRuntimeDataAccess(dbSchemaVersion, dbSupportedSchemaVersion, db, getVariableTypes());
db.openConnection();
if (isDocument) {
DocumentReference docRef = (DocumentReference) varInstInfo.getData();
runtimeDao.updateDocumentContent(docRef.getDocumentId(), newValue);
} else {
varInstInfo.setStringValue(newValue);
runtimeDao.updateVariableInstance(varInstInfo);
}
} catch (SQLException ex) {
throw new DataAccessException(-1, ex.getMessage(), ex);
} finally {
db.closeConnection();
}
auditLog(Action.Change, Entity.VariableInstance, varInstInfo.getInstanceId(), varInstInfo.getName());
}
use of com.centurylink.mdw.dataaccess.RuntimeDataAccess in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getProcessInstanceList.
public ProcessList getProcessInstanceList(Map<String, String> pMap, int pageIndex, int pageSize, ProcessVO procdef, String orderBy) throws DataAccessException {
if (procdef != null && procdef.isRemote()) {
RuntimeDataAccess runTimeInfo = remoteAccess.get(procdef.getRemoteServer()).getRuntimeDataAccess();
ProcessList ret = runTimeInfo.getProcessInstanceList(pMap, pageIndex, pageSize, orderBy);
for (ProcessInstanceVO one : ret.getProcesses()) {
one.setRemoteServer(procdef.getRemoteServer());
}
return ret;
} else {
return rtinfo.getProcessInstanceList(pMap, pageIndex, pageSize, orderBy);
}
}
use of com.centurylink.mdw.dataaccess.RuntimeDataAccess in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getChildProcessInstance.
/**
* Does not work for embedded subprocs in asset processes.
*/
public List<ProcessInstanceVO> getChildProcessInstance(Long processInstanceId, ProcessVO childProcess, ProcessVO parentProcess) throws DataAccessException {
Map<String, String> pMap = new HashMap<>();
if (childProcess.isRemote()) {
RuntimeDataAccess runTimeInfo = remoteAccess.get(childProcess.getRemoteServer()).getRuntimeDataAccess();
List<ProcessInstanceVO> ret;
String ownerType = OwnerType.PROCESS_INSTANCE;
if (parentProcess.isRemote()) {
if (!parentProcess.getRemoteServer().equals(childProcess.getRemoteServer()))
ownerType = parentProcess.getRemoteServer();
} else {
ownerType = currentServer.getApplicationName();
}
pMap.put("owner", ownerType);
pMap.put("ownerId", processInstanceId.toString());
pMap.put(PROCESSID, childProcess.getProcessId().toString());
ProcessList procList = runTimeInfo.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, null);
ret = procList.getProcesses();
for (ProcessInstanceVO one : ret) {
one.setRemoteServer(childProcess.getRemoteServer());
}
return ret;
} else {
pMap.put("owner", OwnerType.PROCESS_INSTANCE);
pMap.put("ownerId", processInstanceId.toString());
pMap.put(PROCESSID, childProcess.getProcessId().toString());
return getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, childProcess, null).getProcesses();
}
}
Aggregations