String jiraDriveQuery = variableContext.getParameter("jiraquery");
if (jiraDriveQuery != null) {
int i = 0;
while (i < ds.getChildCount()) {
SpecificationNode oldNode = ds.getChild(i);
if (oldNode.getType().equals(JOB_STARTPOINT_NODE_TYPE)) {
ds.removeChild(i);
break;
}
i++;
}
SpecificationNode node = new SpecificationNode(JOB_STARTPOINT_NODE_TYPE);
node.setAttribute(JOB_QUERY_ATTRIBUTE, jiraDriveQuery);
ds.addChild(ds.getChildCount(), node);
}
String securityOn = variableContext.getParameter("specsecurity");
if (securityOn != null) {
// Delete all security records first
int i = 0;
while (i < ds.getChildCount()) {
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(JOB_SECURITY_NODE_TYPE))
ds.removeChild(i);
else
i++;
}
SpecificationNode node = new SpecificationNode(JOB_SECURITY_NODE_TYPE);
node.setAttribute(JOB_VALUE_ATTRIBUTE,securityOn);
ds.addChild(ds.getChildCount(),node);
}
String xc = variableContext.getParameter("tokencount");
if (xc != null) {
// Delete all tokens first
int i = 0;
while (i < ds.getChildCount()) {
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(JOB_ACCESS_NODE_TYPE))
ds.removeChild(i);
else
i++;
}
int accessCount = Integer.parseInt(xc);
i = 0;
while (i < accessCount) {
String accessDescription = "_"+Integer.toString(i);
String accessOpName = "accessop"+accessDescription;
xc = variableContext.getParameter(accessOpName);
if (xc != null && xc.equals("Delete")) {
// Next row
i++;
continue;
}
// Get the stuff we need
String accessSpec = variableContext.getParameter("spectoken"+accessDescription);
SpecificationNode node = new SpecificationNode(JOB_ACCESS_NODE_TYPE);
node.setAttribute(JOB_TOKEN_ATTRIBUTE,accessSpec);
ds.addChild(ds.getChildCount(),node);
i++;
}
String op = variableContext.getParameter("accessop");
if (op != null && op.equals("Add"))
{
String accessspec = variableContext.getParameter("spectoken");
SpecificationNode node = new SpecificationNode(JOB_ACCESS_NODE_TYPE);
node.setAttribute(JOB_TOKEN_ATTRIBUTE,accessspec);
ds.addChild(ds.getChildCount(),node);
}
}
return null;