use of com.centurylink.mdw.designer.DesignerDataAccess in project mdw-designer by CenturyLinkCloud.
the class ProcessExplorerActionGroup method refreshRolePermissions.
private void refreshRolePermissions(WorkflowProject project) throws NamingException, RemoteException, DataAccessException {
DesignerDataAccess dao = project.getDesignerDataAccess();
boolean isVCS = project.isFilePersist();
String user = project.getUser().getUsername();
if (!dao.isRolesRefreshed() && isVCS) {
DesignerDataAccess localDao = new DesignerDataAccess(restServer, null, user, null, project.isOldNamespaces(), isVCS);
DesignerDataModel model = project.getDesignerDataModel();
model.reloadRoleNames(localDao);
model.reloadPriviledges(localDao, user);
model.reloadGroups(localDao);
dao.setRolesRefreshed(localDao.isRolesRefreshed());
}
}
use of com.centurylink.mdw.designer.DesignerDataAccess in project mdw-designer by CenturyLinkCloud.
the class LogWatcher method handleLogMessage.
private synchronized void handleLogMessage(String message) {
Matcher matcher = pattern.matcher(message);
if (matcher.matches()) {
String time = matcher.group(1);
final Long procId = new Long(matcher.group(2));
final Long procInstId = new Long(matcher.group(3));
String subtype = matcher.group(4);
String id = matcher.group(5);
String msg = matcher.group(6);
try {
ProcessInstanceVO processInstanceInfo = processInstances.get(procInstId);
if (processInstanceInfo == null) {
processInstanceInfo = new DesignerDataAccess(dataAccess).getProcessInstanceBase(procInstId, null);
// only interested in one masterRequestId
if (processInstanceInfo.getMasterRequestId().equals(masterRequestId))
processInstances.put(procInstId, processInstanceInfo);
}
if (!processInstanceInfo.getMasterRequestId().equals(masterRequestId))
return;
// log the message
outputStream.println(message);
if (watchProcess) {
openInstance(processInstanceInfo);
synchronized (this) {
ProcessInstancePage processInstancePage = processInstancePages.get(processInstanceInfo.getId());
accumulated.offer(new ProcessInstanceUpdater(procId, procInstId, processInstancePage, subtype, time, id, msg));
}
}
if (msg.startsWith(WorkStatus.LOGMSG_PROC_COMPLETE) && procId.equals(process.getId()))
scheduleShutdown = true;
} catch (Exception ex) {
PluginMessages.log(ex);
shutdown();
}
}
}
use of com.centurylink.mdw.designer.DesignerDataAccess in project mdw-designer by CenturyLinkCloud.
the class LogWatcher method startup.
public void startup(boolean watchProcess) {
this.watchProcess = watchProcess;
if (logListener != null)
// already started
return;
pattern = Pattern.compile(MESSAGE_REG_EX, Pattern.DOTALL);
processInstancePages = new HashMap<Long, ProcessInstancePage>();
processInstances = new HashMap<Long, ProcessInstanceVO>();
accumulated = new LinkedList<ProcessInstanceUpdater>();
scheduleShutdown = false;
MessageConsole console = MessageConsole.findConsole("Live View Log", icon, display);
console.setRunnableEntity(this);
console.setDefaultShowPref(true);
console.setStatus(MessageConsole.STATUS_RUNNING);
console.clearConsole();
outputStream = console.newMessageStream();
try {
dataAccess = new DesignerDataAccess(process.getProject().getDesignerProxy().getDesignerDataAccess());
logListener = new LogSubscriberSocket(dataAccess, serverSettings.getLogWatcherPort(), process.getProject().isOldNamespaces()) {
protected void handleMessage(String message) {
handleLogMessage(message);
}
};
logListener.start(true);
new Thread(new Runnable() {
public void run() {
processQueue();
}
}).start();
} catch (Exception ex) {
if (outputStream != null)
ex.printStackTrace(new PrintStream(outputStream));
if (logListener != null && !logListener.isClosed()) {
logListener.shutdown();
logListener = null;
}
PluginMessages.uiError(ex, "Monitor Logs", process.getProject());
}
}
use of com.centurylink.mdw.designer.DesignerDataAccess in project mdw-designer by CenturyLinkCloud.
the class ImageServletHelper method generateImageForTaskInstance.
/**
* Generate a process image from the designer server.
*/
public BufferedImage generateImageForTaskInstance(Long pTaskInstId) throws ServletException {
try {
DesignerDataAccess dao = new DesignerDataAccess(new Server(), null, onServer);
ProcessInstanceVO pi = dao.getCauseForTaskInstance(pTaskInstId);
if (pi == null) {
throw new ServletException("Failed to locate the ProcessInstance for TaskInstanceId:" + pTaskInstId);
}
return generateImage(pi, dao);
} catch (Exception ex) {
log(ex);
throw new ServletException(ex);
}
}
use of com.centurylink.mdw.designer.DesignerDataAccess in project mdw-designer by CenturyLinkCloud.
the class WorkflowProject method getMdwVersion.
/**
* Also populates appVersion to avoid two server calls if first one fails.
* Does not attempt to populate if not initialized (ie not expanded in proc
* exp view).
*/
public String getMdwVersion() {
if (isRemote() && mdwVersion == null && designerProxy != null) {
mdwVersion = "Unknown";
appVersion = "Unknown";
AppSummary appSummary = getRemoteAppSummary(false);
if (appSummary != null && appSummary.getMdwVersion() != null) {
mdwVersion = appSummary.getMdwVersion();
appVersion = appSummary.getAppVersion();
try {
// force parse (triggering exception for unparseable -- eg:
// @mdw.version@)
MdwVersion vers = new MdwVersion(mdwVersion);
vers.getMajorVersion();
vers.getMinorVersion();
vers.getBuildId();
} catch (Exception ex) {
mdwVersion = "Unknown";
PluginMessages.log(ex);
}
} else {
if (isFilePersist()) {
// minimum supported version (TODO:
mdwVersion = "5.5";
// future versions)
} else {
// server may not be running -- infer version from db
// structure
String jdbcUrl = getMdwDataSource().getJdbcUrlWithCredentials();
if (jdbcUrl != null) {
try {
// don't initialize designerProxy just to infer
// version from db
RestfulServer server = new RestfulServer(jdbcUrl, getUser().getUsername(), getServiceUrl());
DesignerDataAccess dao = new DesignerDataAccess(server, new ArrayList<Server>(), getUser().getUsername());
int dbSchemaVersion = dao.getDatabaseSchemaVersion();
int major = dbSchemaVersion / 1000;
int minor = dbSchemaVersion % 1000;
mdwVersion = major + "." + minor;
} catch (Exception ex) {
// dataAccessFailed
PluginMessages.log(ex);
}
}
}
}
}
return mdwVersion;
}
Aggregations