on 03-13-2009 8:52 AM
Hallo,
I want add emenents of my phases and subphases to a table, but I get this exception:
ContextException: Node(RoadMapVIew.phase_subphase_table): cannot bind or add element, because it is already bound to a node
The code is the following:
int phaseSize = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase().length;
String currentStatus = "";
String currentPhaseId = "";
String currentSubphaseId = "";
String currentNotifyId = "";
String lastStatus = "";
for (int i = 0; i < phaseSize; i++)
{
PhaseT phaseT = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase();
IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElement = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
tableElement.setPhase_desc(phaseT.getSequenceGroup1().getPhaseDesc());
tableElement.setPhase_id(phaseT.getSequenceGroup1().getPhaseId());
int subPhaseSize = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase().length;
for(int j = 0; j< subPhaseSize; j++)
{
SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
tableElement.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
tableElement.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
String status = subPhaseT.getSequenceGroup1().getStatus();
wdContext.nodePhase_subphase_table().addElement(tableElement);
lastStatus = status;
//le fasi/sotofasi sono ordinate perciò la corrente è l'ultima con uno status valido
if (status != null && !status.equals(""))
{
currentStatus = status;
currentPhaseId = phaseT.getSequenceGroup1().getPhaseId();
currentSubphaseId = subPhaseT.getSequenceGroup1().getSubPhaseId();
if (status.equals(DAConst.STATUS_NOTIFY))
{
//currentNotifyId = "notifyId"; //subPhaseT.getSequenceGroup1().getNotifyId();
currentNotifyId = subPhaseT.getSequenceGroup1().getNotifyId();
}
}
}
}
Can anybody help me please?
Thanks,
regards,
Andrea
Hi,
This can be solved by creating a new reference of the node element inside your second for loop.
for(int j = 0; j< subPhaseSize; j++)
{
IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElementNew = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
tableElementNew.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
tableElementNew.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
String status = subPhaseT.getSequenceGroup1().getStatus();
wdContext.nodePhase_subphase_table().addElement(tableElementNew);
lastStatus = status;
Regards,
Jithin
Edited by: jithin james on Mar 13, 2009 10:53 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have solved moving the creation of the reference of the node element and the setting of elements inside the second for loop:
for (int i = 0; i < phaseSize; i++)
{
PhaseT phaseT = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase()<i>;
String phaseDesc=phaseT.getSequenceGroup1().getPhaseDesc();
String phaseId=phaseT.getSequenceGroup1().getPhaseId();
int subPhaseSize = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase().length;
for(int j = 0; j< subPhaseSize; j++)
{
SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElement = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
tableElement.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
tableElement.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
tableElement.setPhase_desc(phaseDesc);
tableElement.setPhase_id(phaseId);
String status = subPhaseT.getSequenceGroup1().getStatus();
wdContext.nodePhase_subphase_table().addElement(tableElement);
lastStatus = status;
Thanks everybody for helps,
Andrea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.