use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method remoteRetrieveProcess.
public ProcessVO remoteRetrieveProcess(String name, int version) throws DataAccessException {
try {
String path = "Processes?name=" + name;
if (version != 0)
path += "&version=" + RuleSetVO.formatVersion(version);
String pkgXml = ((RestfulServer) currentServer).invokeResourceService(path);
ProcessImporter importer = DataAccess.getProcessImporter(getDatabaseSchemaVersion());
PackageVO pkg = importer.importPackage(pkgXml);
ProcessVO process = pkg.getProcesses().get(0);
process.setPackageName(pkg.getName());
process.setPackageVersion(pkg.getVersionString());
if (isVcsPersist())
process.setId(currentServer.getVersionControl().getId(getLogicalFile(process)));
return process;
} catch (IOException ex) {
throw new DataAccessException("Error retrieving process: " + name + " v" + RuleSetVO.formatVersion(version), ex);
}
}
use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method retryActivity.
public void retryActivity(Long activityId, Long activityInstId) throws DataAccessException, XmlException, IOException {
if (currentServer.isSchemaVersion61()) {
((RestfulServer) currentServer).retryActivityInstance(activityInstId, ActivityResultCodeConstant.RESULT_RETRY);
} else {
String request = currentServer.buildRetryActivityInstanceRequest(activityId, activityInstId, false);
String response = this.engineCall(request);
try {
String result = currentServer.getErrorMessageFromResponse(response);
if (result == null || result.length() > 0)
throw new RemoteException(result);
auditLog(Action.Retry, Entity.ActivityInstance, activityInstId, null);
} catch (XmlException e) {
throw new DataAccessException("Response is not an MDWStatusMessage");
}
}
}
use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method createRemoteAccess.
private RemoteAccess createRemoteAccess(String logicalServerName) throws DataAccessException, RemoteException {
// and hence requires the remote server to be running
for (Server s : serverList) {
if (logicalServerName.equals(s.getApplicationName())) {
String curenv = currentServer.getEnvironment();
String senv = s.getEnvironment();
if (curenv == null)
curenv = "";
if (senv == null)
senv = "";
if (curenv.equals(senv)) {
String remoteDbInfo = s.getDatabaseUrl();
if (remoteDbInfo == null)
remoteDbInfo = getDatabaseCredentialFromServer(s.getServerUrl());
return new RemoteAccess(logicalServerName, remoteDbInfo);
}
}
}
if (currentServer.getServerUrl() != null) {
String remoteServerUrl = this.getStringProperty(PropertyNames.MDW_REMOTE_SERVER + "." + logicalServerName);
if (remoteServerUrl == null)
throw new DataAccessException("Cannot find translation for logical server name " + logicalServerName);
String remoteDbInfo = this.getDatabaseCredentialFromServer(remoteServerUrl);
return new RemoteAccess(logicalServerName, remoteDbInfo);
}
throw new DataAccessException("Cannot find translation for logical server name " + logicalServerName);
}
use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method executeUnitTest.
public String executeUnitTest(String message, Map<String, String> headers) throws DataAccessException {
try {
HttpHelper httpHelper = currentServer.getHttpHelper(currentServer.getMdwWebUrl() + "/Services/com/centurylink/mdw/testing/AutomatedTests/unit");
httpHelper.setConnectTimeout(getConnectTimeout());
httpHelper.setReadTimeout(getReadTimeout());
httpHelper.setHeaders(headers);
String res = httpHelper.post(message);
return res == null ? null : res.trim();
} catch (IOException ex) {
throw new DataAccessException(0, IOEXCEPTION, ex);
}
}
use of com.centurylink.mdw.common.exception.DataAccessException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getDocumentContent.
public String getDocumentContent(DocumentReference docref, String type) throws RemoteException, DataAccessException {
if (type.equals(Object.class.getName())) {
if (currentServer.getServerUrl() != null) {
StringBuilder sb = new StringBuilder();
sb.append("<_mdw_document_content>");
sb.append("<document_id>").append(docref.getDocumentId().toString()).append("</document_id>");
sb.append("<type>").append(type).append("</type>");
sb.append("</_mdw_document_content>");
String result = this.engineCall(sb.toString());
if (result.startsWith(ERROR))
throw new DataAccessException(result);
return result;
} else {
return rtinfo.getDocument(docref.getDocumentId()).getContent();
}
} else {
if (docref.getServer() != null) {
RemoteAccess rao = remoteAccess.get(docref.getServer());
if (rao == null) {
rao = createRemoteAccess(docref.getServer());
remoteAccess.put(docref.getServer(), rao);
}
return rao.getRuntimeDataAccess().getDocument(docref.getDocumentId()).getContent();
} else {
return rtinfo.getDocument(docref.getDocumentId()).getContent();
}
}
}
Aggregations