use of com.centurylink.mdw.plugin.CodeTimer in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method forceUpdateProcess.
/**
* Relies on classic designer page to update the processVO with the reloaded
* data.
*/
public void forceUpdateProcess(WorkflowProcess processVersion, FlowchartPage flowchartPage, boolean validate, boolean lock) throws ValidationException, DataAccessException, RemoteException {
CodeTimer timer = new CodeTimer("forceUpdateProcess()");
Graph graph = flowchartPage.getProcess();
graph.save_temp_vars();
if (validate)
new ProcessValidator(processVersion.getProcessVO()).validate(getNodeMetaInfo());
if (!processVersion.getProject().checkRequiredVersion(5, 5))
flowchartPage.setProcessVersions(flowchartPage.getProcess(), // not
!processVersion.getProject().checkRequiredVersion(5, 2));
// sure
// why
// this
// was
// ever
// needed
Graph reloaded = null;
try {
reloaded = flowchartPage.saveProcess(graph, mainFrame, PersistType.UPDATE, 0, lock);
} catch (ValidationException ex) {
if (ex.getMessage() != null && ex.getMessage().contains(ORA_02292))
throw new ValidationException(INCOMPATIBLE_INSTANCES);
else
throw ex;
}
flowchartPage.setProcess(reloaded);
processVersion.setProcessVO(reloaded.getProcessVO());
cacheRefresh.fireRefresh(reloaded.getProcessVO().hasDynamicJavaActivity());
timer.stopAndLog();
}
use of com.centurylink.mdw.plugin.CodeTimer in project mdw-designer by CenturyLinkCloud.
the class DesignerProxy method setPackage.
public void setPackage(WorkflowPackage workflowPackage) throws DataAccessException, RemoteException {
if (workflowPackage.isDefaultPackage())
return;
CodeTimer timer = new CodeTimer("setPackage()");
Long pkgId = dataAccess.getDesignerDataAccess().savePackage(workflowPackage.getPackageVO());
workflowPackage.getPackageVO().setPackageId(pkgId);
workflowPackage.getProject().fireElementChangeEvent(workflowPackage, ChangeType.VERSION_CHANGE, workflowPackage.getVersionString());
workflowPackage.fireElementChangeEvent(ChangeType.VERSION_CHANGE, workflowPackage.getVersionString());
timer.stopAndLog();
}
use of com.centurylink.mdw.plugin.CodeTimer in project mdw-designer by CenturyLinkCloud.
the class Importer method importProcess.
public WorkflowProcess importProcess(final WorkflowPackage targetPackage, final WorkflowProcess targetProcess, final String xml) throws DataAccessException, RemoteException, XmlException, ValidationException {
CodeTimer timer = new CodeTimer("importProcess()");
ProcessVO importedProcessVO = null;
int schemaVersion = dataAccess.getSchemaVersion();
ProcessImporter importer = DataAccess.getProcessImporter(schemaVersion);
importedProcessVO = importer.importProcess(xml);
if (targetProcess != null && !importedProcessVO.getName().equals(targetProcess.getName()))
throw new ValidationException("Process in XML (" + importedProcessVO.getName() + ") is not " + targetProcess.getName());
for (WorkflowProcess existing : targetPackage.getProject().getAllProcesses()) {
if (existing.getName().equals(importedProcessVO.getName())) {
if (existing.getVersion() == importedProcessVO.getVersion())
throw new ValidationException(existing.getLabel() + " already exists in " + targetPackage.getProject().getLabel() + ".");
if (existing.getVersion() > importedProcessVO.getVersion())
throw new ValidationException(existing.getLabel() + " already exists in " + targetPackage.getProject().getLabel() + " with a version greater than the imported process (v" + importedProcessVO.getVersionString() + ").");
}
}
// designer fix for backward compatibility
ProcessWorker worker = new ProcessWorker();
worker.convert_to_designer(importedProcessVO);
worker.convert_from_designer(importedProcessVO, syncNodeMetaInfo(dataAccess.getDesignerDataModel().getNodeMetaInfo(), importedProcessVO));
if (!importedProcessVO.isInRuleSet()) {
// fix pseudo variables
for (VariableVO varVO : importedProcessVO.getVariables()) varVO.setVariableId(null);
}
importedProcessVO.setPackageName(targetPackage.getName());
WorkflowProcess alreadyInPackage = null;
if (targetPackage.getProject().getProcess(importedProcessVO.getName()) == null)
dataAccess.getDesignerDataAccess().createProcess(importedProcessVO);
else {
alreadyInPackage = targetPackage.getProcess(importedProcessVO.getName());
dataAccess.getDesignerDataAccess().updateProcess(importedProcessVO, importedProcessVO.getVersion(), false);
}
ProcessVO reloaded = dataAccess.getDesignerDataAccess().getProcessDefinition(importedProcessVO.getProcessName(), importedProcessVO.getVersion());
importedProcessVO.setProcessId(reloaded.getProcessId());
if (targetPackage.getProject().getDataAccess().getSupportedSchemaVersion() < DataAccess.schemaVersion52)
updateSubProcessIdAttributes(importedProcessVO);
WorkflowProcess importedProcess = new WorkflowProcess(targetPackage.getProject(), importedProcessVO);
dataAccess.getProcesses(false).add(importedProcess.getProcessVO());
if (alreadyInPackage != null)
targetPackage.removeProcess(alreadyInPackage);
targetPackage.addProcess(importedProcess);
importedProcess.setPackage(targetPackage);
dataAccess.auditLog(Action.Import, importedProcess);
timer.stopAndLog();
return importedProcess;
}
use of com.centurylink.mdw.plugin.CodeTimer in project mdw-designer by CenturyLinkCloud.
the class CacheRefresh method doRefresh.
public void doRefresh(boolean silent, final boolean includeDynamicJava) {
try {
if (silent) {
if (workflowProject.isUpdateServerCache()) {
// run as background job
new Job("MDW Cache Refresh: " + restfulServer.getMdwWebUrl()) {
protected IStatus run(IProgressMonitor monitor) {
try {
CodeTimer timer = new CodeTimer("CacheRefresh.doRefresh()");
refreshStatusMessage = restfulServer.refreshCache(workflowProject.isRemote(), workflowProject.isOldNamespaces(), includeDynamicJava);
timer.stopAndLog();
} catch (Exception ex) {
if (MdwPlugin.getSettings().isLogConnectErrors())
PluginMessages.log(ex);
}
return Status.OK_STATUS;
}
}.schedule();
}
} else {
String progressMsg = "Refreshing Caches and Properties for '" + workflowProject.getLabel() + "'";
String errorMsg = "Refresh Cache";
DesignerRunner designerRunner = new DesignerRunner(progressMsg, errorMsg, workflowProject) {
public void perform() throws ValidationException, DataAccessException, RemoteException {
try {
CodeTimer timer = new CodeTimer("CacheRefresh.doRefresh()");
refreshStatusMessage = restfulServer.refreshCache(workflowProject.isRemote(), workflowProject.isOldNamespaces(), includeDynamicJava);
timer.stopAndLog();
} catch (Exception ex) {
PluginMessages.uiError(ex, ex.getMessage(), REFRESH_CACHES, workflowProject);
}
}
};
designerRunner.run();
if (refreshStatusMessage == null) {
PluginMessages.uiError(workflowProject.getName() + " Refresh Caches and Properties failed. Make sure baseline event handlers are registered.", REFRESH_CACHES, workflowProject);
} else if (refreshStatusMessage.getMDWStatusMessage().getStatusCode() != 0) {
String message = refreshStatusMessage.getMDWStatusMessage().getStatusMessage();
PluginMessages.uiMessage(workflowProject.getName() + " Refresh Caches and Properties:\n" + message, "Refresh Caches", workflowProject, PluginMessages.INFO_MESSAGE);
}
}
} catch (Exception ex) {
if (!silent)
PluginMessages.uiError(ex, ex.getMessage(), REFRESH_CACHES, workflowProject);
}
}
use of com.centurylink.mdw.plugin.CodeTimer in project mdw-designer by CenturyLinkCloud.
the class CacheRefresh method fireRefresh.
/**
* Don't wait for response
*/
public void fireRefresh(final boolean includeDynamicJava) {
if (workflowProject.isUpdateServerCache()) {
new Thread(new Runnable() {
public void run() {
CodeTimer timer = new CodeTimer("fireProcessCacheRefresh()");
try {
restfulServer.refreshCache(workflowProject.isRemote(), workflowProject.isOldNamespaces(), includeDynamicJava);
} catch (Exception ex) {
if (MdwPlugin.getSettings().isLogConnectErrors())
PluginMessages.log(ex.toString());
if ("true".equals(System.getProperty("mdw.designer.show.connect.stack.trace")))
PluginMessages.log(ex);
}
timer.stopAndLog();
}
}).start();
}
}
Aggregations