Question
How To Determine Users In a Product Context Role
Hope this helps...
wt.inf.team.ContainerTeam containerteam =
wt.inf.team.ContainerTeamHelper.service.getContainerTeam((wt.inf.team.ContainerTeamManaged)((wt.inf.container.WTContained)wtobject).getContainerReference().getObject());
WTGroup wtgroup =
wt.inf.team.ContainerTeamHelper.service.findContainerTeamGroup(containerteam,"roleGroups",grpname);
if(wtgroup!=null)
{
//WTGroup wtgroup =
wt.inf.team.ContainerTeamHelper.service.findContainerTeamGroup((wt.inf.team.ContainerTeamManaged)((wt.inf.container.WTContained)wtobject).getContainerReference().getObject(),"roles",s2);
Enumeration enumeration =
OrganizationServicesHelper.manager.members(wtgroup);
while(enumeration.hasMoreElements())
{
wtprincipal1 = (WTPrincipal)enumeration.nextElement();
if(wtprincipal1 instanceof WTUser)
{
wtuser = (WTUser)wtprincipal1;
}
}
}
Regards,
Vimal
On Fri, May 28, 2010 at 10:19 PM, Jim VanDragt <
-> wrote:
> Good Day All,
>
> How do I determine which users are contained within a Role for a given
> product context. The code below works to determine all of the roles for the
> product context "ABC", but now I'm stuck on how to find out which users are
> contained in the roles.
>
> String name="ABC";
> Class className = wt.pdmlink.PDMLinkProduct.*class*;
> *int*[] index = *new* *int*[1];
> index[0] = 0;
> QuerySpec queryspec = *new* QuerySpec(className);
> queryspec.appendWhere(*new* SearchCondition(className,
> "containerInfo.name", "=", name), index);
> QueryResult queryresult = PersistenceHelper.manager.find(queryspec);
> System.out.println("Result size :"+ queryresult.size());
>
> *while* (queryresult.hasMoreElements()) {
> Object obj = queryresult.nextElement();
> *if* (obj *instanceof* PDMLinkProduct) {
> PDMLinkProduct product = (PDMLinkProduct) obj;
> String displayIdentifier =
> product.getDisplayIdentifier().toString();
> System.out.println("Product :"+displayIdentifier);
> System.out.println("Container "+ product.getContainerName());
>
> ContainerTeam team =
> ContainerTeamHelper.service.getContainerTeam(product);
>
> Enumeration enumeration = team.getRoles().elements();
> *while* (enumeration.hasMoreElements()) {
> Object roleobj =enumeration.nextElement();
> Role role = (Role) roleobj;
> System.out.println(role);
>
> }
> }
> }
>
> Thanks,
>
> Jim
>
> Jim Van Dragt
> Information Technology
> Herman Miller Inc.
> 616.654.5285 - Office
> 616.836.8394 - Cell
>
>
wt.inf.team.ContainerTeam containerteam =
wt.inf.team.ContainerTeamHelper.service.getContainerTeam((wt.inf.team.ContainerTeamManaged)((wt.inf.container.WTContained)wtobject).getContainerReference().getObject());
WTGroup wtgroup =
wt.inf.team.ContainerTeamHelper.service.findContainerTeamGroup(containerteam,"roleGroups",grpname);
if(wtgroup!=null)
{
//WTGroup wtgroup =
wt.inf.team.ContainerTeamHelper.service.findContainerTeamGroup((wt.inf.team.ContainerTeamManaged)((wt.inf.container.WTContained)wtobject).getContainerReference().getObject(),"roles",s2);
Enumeration enumeration =
OrganizationServicesHelper.manager.members(wtgroup);
while(enumeration.hasMoreElements())
{
wtprincipal1 = (WTPrincipal)enumeration.nextElement();
if(wtprincipal1 instanceof WTUser)
{
wtuser = (WTUser)wtprincipal1;
}
}
}
Regards,
Vimal
On Fri, May 28, 2010 at 10:19 PM, Jim VanDragt <
-> wrote:
> Good Day All,
>
> How do I determine which users are contained within a Role for a given
> product context. The code below works to determine all of the roles for the
> product context "ABC", but now I'm stuck on how to find out which users are
> contained in the roles.
>
> String name="ABC";
> Class className = wt.pdmlink.PDMLinkProduct.*class*;
> *int*[] index = *new* *int*[1];
> index[0] = 0;
> QuerySpec queryspec = *new* QuerySpec(className);
> queryspec.appendWhere(*new* SearchCondition(className,
> "containerInfo.name", "=", name), index);
> QueryResult queryresult = PersistenceHelper.manager.find(queryspec);
> System.out.println("Result size :"+ queryresult.size());
>
> *while* (queryresult.hasMoreElements()) {
> Object obj = queryresult.nextElement();
> *if* (obj *instanceof* PDMLinkProduct) {
> PDMLinkProduct product = (PDMLinkProduct) obj;
> String displayIdentifier =
> product.getDisplayIdentifier().toString();
> System.out.println("Product :"+displayIdentifier);
> System.out.println("Container "+ product.getContainerName());
>
> ContainerTeam team =
> ContainerTeamHelper.service.getContainerTeam(product);
>
> Enumeration enumeration = team.getRoles().elements();
> *while* (enumeration.hasMoreElements()) {
> Object roleobj =enumeration.nextElement();
> Role role = (Role) roleobj;
> System.out.println(role);
>
> }
> }
> }
>
> Thanks,
>
> Jim
>
> Jim Van Dragt
> Information Technology
> Herman Miller Inc.
> 616.654.5285 - Office
> 616.836.8394 - Cell
>
>
