.getService(serviceReference);
String pid = (String) serviceReference
.getProperty(Constants.SERVICE_PID);
AlgorithmWorkflowItem wfi = new AlgorithmWorkflowItem(algorithmLabel,
((NormalWorkflow) currentWorkFlowItem.getWorkflow())
.getUniqueInternalId(), pid);
wfi.setParameters(parameters);
wfi.setWorkflow(currentWorkFlowItem.getWorkflow());
currentWorkFlowItem.getWorkflow().add(wfi);
final AlgorithmItemGUI dataItem = new AlgorithmItemGUI(wfi,
this.currentParentItem, this.brandPluginID);
this.currentParentItem.addChild(dataItem);
this.currentParentItem = dataItem;
refresh(dataItem);
// Create algorithm parameters.
String metatypePID = getMetaTypeID(serviceReference);
// get the input parameters
MetaTypeProvider provider = null;
try {
provider = getPossiblyMutatedMetaTypeProvider(metatypePID, pid,
factory, serviceReference);
} catch (AlgorithmCreationFailedException e) {
String format = "An error occurred when creating the algorithm \"%s\" with the data you "
+ "provided. (Reason: %s)";
String logMessage = String.format(format,
serviceReference.getProperty(AlgorithmProperty.LABEL),
e.getMessage());
return;
} catch (Exception e) {
return;
}
if (parameters == null || parameters.isEmpty())
return;
final GeneralTreeItem paramItem = new GeneralTreeItem("Parameters",
Constant.Label, dataItem, Utils.getImage("parameters.png",
brandPluginID));
dataItem.addChild(paramItem);
ObjectClassDefinition obj = provider.getObjectClassDefinition(
metatypePID, null);
if (obj != null) {
AttributeDefinition[] attr = obj
.getAttributeDefinitions(ObjectClassDefinition.ALL);
for (int i = 0; i < attr.length; i++) {
String id = attr[i].getID();
String name = attr[i].getName();
// add this into the hashmap of Algorithm Item
wfi.add(name, id);
Object valueRaw = parameters.get(id);
String value = "";
if (valueRaw != null) {
value = valueRaw.toString();
}