Now I am trying to read module parameters from excel and update the channels. My code is working fine...except for one small glitch. In my channel there are two 'ModuleKey' 'ParameterName' and 'ParameterValue' groups under 'Module Configuration' in channel. However when I execute the code below...only the last of the two groups gets created and the 1st group gets removed.
List<ParameterGroupType> PGTypes = new ArrayList<ParameterGroupType>();
ParameterGroupType PGType = new ParameterGroupType();
List<ProcessStepType> PSTypes = new ArrayList<ProcessStepType>();
ProcessStepType PSType = new ProcessStepType();
List<RestrictedGenericPropertyType> RGPTypes = new ArrayList<RestrictedGenericPropertyType>();
RestrictedGenericPropertyType RGPType = new RestrictedGenericPropertyType();
ModuleProcessType module = new ModuleProcessType();
int pgSize = 0;
while (row.getCell(c) != null && row.getCell(c).getStringCellValue().startsWith("MCPG:<PGName>"))
{
int pos1 = row.getCell(c).getStringCellValue().indexOf("MCPG:<PGName>") + "MCPG:<PGName>".length();
PGType.setParameterGroupID(row.getCell(c).getStringCellValue().substring(row.getCell(c).getStringCellValue().indexOf("</PGValue><PGID>")+"</PGValue><PGID>".length(),row.getCell(c).getStringCellValue().indexOf("</PGID>")));
RGPType.setName(row.getCell(c).getStringCellValue().substring(pos1,row.getCell(c).getStringCellValue().indexOf("</PGName><PGValue>")));
RGPType.setValue(row.getCell(c).getStringCellValue().substring(row.getCell(c).getStringCellValue().indexOf("</PGName><PGValue>")+"</PGName><PGValue>".length(),row.getCell(c).getStringCellValue().indexOf("</PGValue><PGID>")));
RGPTypes.add(RGPType);
PGType.getParameter().add(RGPTypes.get(pgSize));
PGTypes.add(PGType);
RGPType = new RestrictedGenericPropertyType();
PGType = new ParameterGroupType();
pgSize++;
c++;
}
for (int j = 0; j < PGTypes.size(); j++) {
module.getParameterGroup().add(PGTypes.get(j));
channel.setModuleProcess(module);
}
Please advice.