}
else{
iSeq = TSequence.Factory.newInstance();
//transitions case (1.transition)
if(TPick.class.isInstance(begin.getBpelCode())){
TPick iPick = iSeq.addNewPick();
iPick.set(begin.getBpelCode());
}
else if(TIf.class.isInstance(begin.getBpelCode())){
TIf iIf = iSeq.addNewIf();
iIf.set(begin.getBpelCode());
}
else if(TAssign.class.isInstance(begin.getBpelCode())){
TAssign iAss = iSeq.addNewAssign();
iAss.set(begin.getBpelCode());
}
else if(TFlow.class.isInstance(begin.getBpelCode())){
TFlow iFlowSub = iSeq.addNewFlow();
iFlowSub.set(begin.getBpelCode());
}
else if(TEmpty.class.isInstance(begin.getBpelCode())){
TEmpty iEmpty = iSeq.addNewEmpty();
iEmpty.set(begin.getBpelCode());
}
else if(TWait.class.isInstance(begin.getBpelCode())){
TWait iWait = iSeq.addNewWait();
iWait.set(begin.getBpelCode());
}
else if(TReceive.class.isInstance(begin.getBpelCode())){
TReceive iReceive = iSeq.addNewReceive();
iReceive.set(begin.getBpelCode());
}
else if(TReply.class.isInstance(begin.getBpelCode())){
TReply iReply = iSeq.addNewReply();
iReply.set(begin.getBpelCode());
}
else if(TInvoke.class.isInstance(begin.getBpelCode())){
TInvoke iInvoke = iSeq.addNewInvoke();
iInvoke.set(begin.getBpelCode());
}
else if(TWhile.class.isInstance(begin.getBpelCode()))
{
TWhile iwhile = iSeq.addNewWhile();
iwhile.set(begin.getBpelCode());
}
}
//place between transitions
AbstractElement<?> tmp = begin.get_first_post_element();
//2.transition
tmp = tmp.get_first_post_element();
//if the 2.transition is a SequenceTransition
if (SequenceTransition.class.isInstance(tmp)){
TSequence helpSequence = (TSequence)tmp.getBpelCode();
XmlCursor cursSeq = iSeq.newCursor();
XmlCursor cursSub = helpSequence.newCursor();
cursSeq.toEndToken();
cursSub.copyXmlContents(cursSeq);
}
else{
//transitions case (2.transition)
if(TPick.class.isInstance(tmp.getBpelCode())){
TPick iPick = iSeq.addNewPick();
iPick.set(tmp.getBpelCode());
}
else if(TIf.class.isInstance(tmp.getBpelCode())){
TIf iIf = iSeq.addNewIf();
iIf.set(tmp.getBpelCode());
}