Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
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!
Solved! Go to Solution.
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
You can use the API wt.team.TeamHelper.service
Thank you
Binesh Kumar
Anton,
Have you tried below API:
TeamTemplate teamTemplate = TeamTemplate.newTeamTemplate();
teamTemplate.setTeamTemplateIdentity(templateName);
teamTemplate.setContainer(container);
FolderHelper.assignLocation((FolderEntry)teamTemplate, folder);
teamTemplate.setEnabled(true);
teamTemplate = (TeamTemplate)PersistenceHelper.manager.store(teamTemplate);
return teamTemplate;
Regards,
Shirish
Anton,
Do you want to store the Team Template, team instance or context team ?
can you explain your requirement to store/create new team?
Thanks
Shreyas
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