use of org.wso2.siddhi.query.api.annotation.Element in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method fillProcessInfo.
/**
* Fill in the <code>ProcessInfo</code> element of the transfer object.
*
* @param info destination XMLBean
* @param pconf process configuration object (from store)
* @param custom used to customize the quantity of information produced in the
* info
* @param tenantProcessStore Tenant's Process store
* @throws ProcessManagementException If an error occurred while filling process information
*/
private void fillProcessInfo(ProcessInfoType info, ProcessConf pconf, ProcessInfoCustomizer custom, TenantProcessStoreImpl tenantProcessStore) throws ProcessManagementException {
if (pconf == null) {
String errMsg = "Process configuration cannot be null.";
log.error(errMsg);
throw new ProcessManagementException(errMsg);
}
info.setPid(pconf.getProcessId().toString());
// Active process may be retired at the same time
if (pconf.getState() == ProcessState.RETIRED) {
info.setStatus(ProcessStatus.RETIRED);
info.setOlderVersion(AdminServiceUtils.isOlderVersion(pconf, tenantProcessStore));
} else if (pconf.getState() == ProcessState.DISABLED) {
info.setStatus(ProcessStatus.DISABLED);
info.setOlderVersion(0);
} else {
info.setStatus(ProcessStatus.ACTIVE);
info.setOlderVersion(0);
}
info.setVersion(pconf.getVersion());
DefinitionInfo defInfo = new DefinitionInfo();
defInfo.setProcessName(pconf.getType());
BpelDefinition bpelDefinition = new BpelDefinition();
bpelDefinition.setExtraElement(getProcessDefinition(pconf));
defInfo.setDefinition(bpelDefinition);
info.setDefinitionInfo(defInfo);
DeploymentInfo depInfo = new DeploymentInfo();
depInfo.setPackageName(pconf.getPackage());
depInfo.setDocument(pconf.getBpelDocument());
depInfo.setDeployDate(AdminServiceUtils.toCalendar(pconf.getDeployDate()));
// TODO: Need to fix this by adding info to process conf.
depInfo.setDeployer(org.wso2.carbon.bpel.core.BPELConstants.BPEL_DEPLOYER_NAME);
info.setDeploymentInfo(depInfo);
if (custom.includeInstanceSummary()) {
InstanceSummary instanceSummary = new InstanceSummary();
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.ACTIVE);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.COMPLETED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.FAILED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.SUSPENDED);
addInstanceSummaryEntry(instanceSummary, pconf, InstanceStatus.TERMINATED);
addFailuresToInstanceSummary(instanceSummary, pconf);
info.setInstanceSummary(instanceSummary);
}
if (custom.includeProcessProperties()) {
ProcessProperties processProps = new ProcessProperties();
for (Map.Entry<QName, Node> propEntry : pconf.getProcessProperties().entrySet()) {
QName key = propEntry.getKey();
if (key != null) {
Property_type0 prop = new Property_type0();
prop.setName(new QName(key.getNamespaceURI(), key.getLocalPart()));
OMFactory omFac = OMAbstractFactory.getOMFactory();
OMElement propEle = omFac.createOMElement("PropertyValue", null);
propEle.setText(propEntry.getValue().getNodeValue());
prop.addExtraElement(propEle);
processProps.addProperty(prop);
}
}
info.setProperties(processProps);
}
fillPartnerLinks(info, ((ProcessConfigurationImpl) pconf).getProcessDeploymentInfo());
}
use of org.wso2.siddhi.query.api.annotation.Element in project carbon-business-process by wso2.
the class ScopeImpl method getTerminationHandlerIcon.
/**
* At start: xLeft=0, yTop=0
*
* @param doc SVG document which defines the components including shapes, gradients etc. of the activity
* @return Element(represents an element in a XML) which contains the TerminationHandler icon and arrow flows
*/
public Element getTerminationHandlerIcon(SVGDocument doc) {
// Get the coordinates of the start arrow of the TerminationHandler
SVGCoordinates coords = getStartTerminationCoords();
int xLeft = 0;
int yTop = 0;
if (layoutManager.isVerticalLayout()) {
xLeft = coords.getXLeft() - getHandlerIconWidth();
yTop = coords.getYTop() - (getHandlerIconHeight() / 2);
} else {
xLeft = coords.getXLeft() - (getHandlerIconWidth() / 2);
yTop = coords.getYTop() - getHandlerIconHeight();
}
// Gets the icon path of the activity
String iconPath = BPEL2SVGIcons.TERMINATIONHANDLER_ICON;
// width
return getImageDefinition(doc, iconPath, xLeft, yTop, getHandlerIconWidth(), getHandlerIconHeight(), getId());
}
use of org.wso2.siddhi.query.api.annotation.Element in project carbon-business-process by wso2.
the class ScopeImpl method getFaultHandlerIcon.
/**
* At start: xLeft=0, yTop=0
*
* @param doc SVG document which defines the components including shapes, gradients etc. of the activity
* @return Element(represents an element in a XML) which contains the FaultHandler icon and arrow flows
*/
public Element getFaultHandlerIcon(SVGDocument doc) {
// Get the coordinates of the start arrow of the FaultHandler
SVGCoordinates coords = getStartFaultCoords();
int xLeft = 0;
int yTop = 0;
if (layoutManager.isVerticalLayout()) {
xLeft = coords.getXLeft() - getHandlerIconWidth();
yTop = coords.getYTop() - (getHandlerIconHeight() / 2);
} else {
xLeft = coords.getXLeft() - (getHandlerIconWidth() / 2);
yTop = coords.getYTop() - getHandlerIconHeight();
}
// Gets the icon path of the activity
String iconPath = BPEL2SVGIcons.FAULTHANDLER_ICON;
// width
return getImageDefinition(doc, iconPath, xLeft, yTop, getHandlerIconWidth(), getHandlerIconHeight(), getId());
}
use of org.wso2.siddhi.query.api.annotation.Element in project carbon-business-process by wso2.
the class BPELUploadExecutor method validateBPELPackage.
public void validateBPELPackage(String directoryPath) throws Exception {
DeploymentUnitDir du;
try {
du = new DeploymentUnitDir(new File(directoryPath));
} catch (IllegalArgumentException iae) {
log.error("BPEL Package Validation Failure.", iae);
throw new Exception("BPEL Package Validation Failure.", iae);
}
// check package for illegal charactors which registry does not support. (~!@#$;%^*()+={}[]|\<>)
List<File> packageFiles = du.allFiles();
for (File packageFile : packageFiles) {
if (!packageFile.getName().matches("[^\\~\\!\\@\\#\\$\\;\\%\\^\\*\\(\\)\\+ " + "/\\=\\{\\}\\[\\]\\\\|\\<\\>\"\\'\\`]+")) {
log.error("BPEL Package Validation Failure: one or many of the following illegal characters are in " + "the package.\n ~!@#$;%^*()+={}[]| \\<>\"'`");
throw new Exception("BPEL Package Validation Failure: one or many of the following illegal characters" + " " + "are in the package. ~!@#$;%^*()+={}[]| \\<>\"'`");
}
}
try {
du.compile();
} catch (RuntimeException ce) {
log.error("BPEL Process Compilation Failure.", ce);
throw new Exception("BPEL Compilation Failure!", ce);
} catch (Exception e) {
log.error("BPEL Process Compilation Failure.", e);
throw new Exception("BPEL Compilation Failure!", e);
}
du.scan();
DeployDocument dd = du.getDeploymentDescriptor();
for (TDeployment.Process processDD : dd.getDeploy().getProcessList()) {
QName processType = processDD.getType() != null ? processDD.getType() : processDD.getName();
DeploymentUnitDir.CBPInfo cbpInfo = du.getCBPInfo(processType);
if (cbpInfo == null) {
// removeDeploymentArtifacts(deploymentContext, du);
String logMessage = "Aborting deployment. Cannot find Process definition for type " + processType + ".";
log.error(logMessage);
throw new Exception(logMessage);
}
for (TProvide tProvide : processDD.getProvideList()) {
if (tProvide.getService() == null) {
String errMsg = "Service element missing for the provide element in deploy.xml";
log.error(errMsg);
throw new Exception(errMsg);
}
}
for (TInvoke tInvoke : processDD.getInvokeList()) {
if (tInvoke.getService() == null) {
String errMsg = "Service element missing for the invoke element in deploy.xml";
log.error(errMsg);
throw new Exception(errMsg);
}
}
}
}
use of org.wso2.siddhi.query.api.annotation.Element in project carbon-business-process by wso2.
the class ForEachImpl method getArrows.
/**
* Get the arrow coordinates of the activities
*
* @param doc SVG document which defines the components including shapes, gradients etc. of the activity
* @return An element which contains the arrow coordinates of the ForEach activity and its subActivities
*/
protected Element getArrows(SVGDocument doc) {
Element subGroup = null;
// Creating an SVG Container "g"
subGroup = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
// Checks for the subActivities
if (subActivities != null) {
ActivityInterface activity = null;
String id = null;
SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
SVGCoordinates myExitCoords = getEndIconEntryArrowCoords();
SVGCoordinates activityExitCoords = null;
SVGCoordinates activityEntryCoords = null;
Iterator<ActivityInterface> itr = subActivities.iterator();
// Iterates through all the subActivities
while (itr.hasNext()) {
activity = itr.next();
id = activity.getId();
// Gets the entry and exit coordinates of the iterated activity
activityExitCoords = activity.getExitArrowCoords();
activityEntryCoords = activity.getEntryArrowCoords();
// Gives the coordinates of the entry arrow to the first activity from the startIcon
subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
// Gives the coordinates of the entry arrow to the endIcon of ForEach
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
}
return subGroup;
}
Aggregations