*/
public Result execute(Context context)
{
try
{
ResultImpl im = null;
if (Utils.isFull(context.in_1_link()))
{
String content = new String(context.in_1_link().content().bytes());
// [TODO: make this a parameter taken from the second input]
String split = "\n";
int i = content.indexOf(split);
int t = content.length()
- i - split.length();
if (i > 0)
{
String head = content.substring(0, i);
String tail = content.substring(i
+ split.length(), content.length());
if (tail.length() > 0)
{
return new ResultImpl(context, true, true, new DataImpl(head.getBytes()), new DataImpl(tail.getBytes()));
}
else
{
// [TODO: optimize by prefabricating the NetworkImpl]
NetworkImpl network = new NetworkParser().parse(replaceWorkflow.getBytes());
// Returns the Workflow.
return new WorkflowImpl(new ResultImpl(context, true, true, new DataImpl(head.getBytes()), null), network);
}
}
else
{
// [TODO: optimize by prefabricating the NetworkImpl]
NetworkImpl network = new NetworkParser().parse(replaceWorkflow.getBytes());
// Returns the Workflow.
return new WorkflowImpl(new ResultImpl(context, true, true, context.in_1_link().content(), null), network);
}
}
else
{
throw new Exception("first input needs to be full");
}
}
catch (Throwable e1)
{
return new ResultImpl(context, true, true, null, org.syrup.helpers.Utils.manageError(logger, e1, "Concat error"));
}
}