首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

copy user from team administrator to workflow team

2012-11-15 
copy user from team administrator to workflow team.The code can be used directly in the workflow.No

copy user from team administrator to workflow team.

The code can be used directly in the workflow.

Notice the red?string which should be fixed.

wt.inf.container.WTContainer c = wt.inf.container.WTContainerHelper.getContainer((wt.inf.container.WTContained)primaryBusinessObject);
wt.inf.container.WTContainerRef ref = wt.inf.container.WTContainerRef.newWTContainerRef(c);
wt.team.TeamTemplate team = wt.team.TeamHelper.service.getTeamTemplate(ref,"CostAnalysisReport team");??
java.util.HashMap map = (java.util.HashMap)team.getRolePrincipalMap();?????????
wt.project.Role r = wt.project.Role.toRole("REVIEWER");
wt.team.Team ateam = (wt.team.Team)(((wt.team.TeamManaged)self.getObject()).getTeamId().getObject());
java.util.List l = (java.util.List)map.get(r);
for(int i=0;i<l.size();i++){
wt.org.WTPrincipalReference rf = (wt.org.WTPrincipalReference)l.get(i);
Object obj = rf.getObject();
if (obj instanceof wt.org.WTGroup){
java.util.Enumeration en = ((wt.org.WTGroup)obj).members();
while(en.hasMoreElements()){
wt.org.WTUser user = (wt.org.WTUser)en.nextElement();
wt.team.TeamHelper.service.addRolePrincipalMap(r,user,ateam);
}
}else{
wt.team.TeamHelper.service.addRolePrincipalMap(r,(wt.org.WTUser)obj,ateam);
}
}
ateam = (wt.team.Team)wt.fc.PersistenceHelper.manager.refresh(ateam);
ateam = (wt.team.Team)wt.fc.PersistenceHelper.manager.save(ateam);
wt.team.TeamReference tt = wt.team.TeamReference.newTeamReference(ateam);
wt.team.TeamHelper.service.augmentRoles((wt.lifecycle.LifeCycleManaged)primaryBusinessObject,tt);

热点排行