How to store Team object by code?
Hi to all!
I am storing the Team object like:
PersistenceHelper.manager.store(myTeam);
Then I can query this team by name, but RolePrincipalmap is empty.
Anybody know how to store team object correct? Thanks!
Hi to all!
I am storing the Team object like:
PersistenceHelper.manager.store(myTeam);
Then I can query this team by name, but RolePrincipalmap is empty.
Anybody know how to store team object correct? Thanks!
Hi guys!
Thanks for your answers.
I have solved this problem. If you need to store the Team object with non empty RolePrincipalMap you should:
1) Store the Team object like follow (pn is the PromotionNotice object):
Team newTeam = Team.newTeam();
newTeam.setName(pn.getNumber() + "pnTeam");
newTeam.setDomainRef(pn.getDomainRef());
newTeam = (Team)PersistenceHelper.manager.save(newTeam);
2) Create and store RolePrincipalMap objects for all roles and users you need like follow:
RolePrincipalMap rpm = RolePrincipalMap.newRolePrincipalMap();
rpm.setWTRoleHolder2(newTeam);
rpm.setRole(role);
rpm.setPrincipalParticipant(wtpr);
PersistenceHelper.manager.save(rpm);
Then you can query your Team object and getRolePrincipalMap will return you current RolePrincipalmap
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.