PortletDD portlet) {
HashMap sRefs = new HashMap();
List sSecRoleRefs = servlet.getSecurityRoleRefs();
Iterator i = sSecRoleRefs.iterator();
SecurityRoleRefDD srr;
while(i.hasNext()) {
srr = (SecurityRoleRefDD)i.next();
sRefs.put(srr.getRoleName(), srr);
}
HashMap wRoles = new HashMap();
i = webApp.getSecurityRoles().iterator();
SecurityRoleDD sr;
while(i.hasNext()) {
sr = (SecurityRoleDD)i.next();
wRoles.put(sr.getRoleName(), sr);
}
Collection pRoles = portlet.getSecurityRoleRefs();
Iterator p = pRoles.iterator();
SecurityRoleRefDD pRole;
while(p.hasNext()) {
pRole = (SecurityRoleRefDD) p.next();
if (pRole.getRoleLink()==null
&& wRoles.get(pRole.getRoleName())==null) {
System.out.println(
"Note: The web application has no security role defined which matches the role name \""
+ pRole.getRoleName()
+ "\" of the security-role-ref element defined for the wrapper-servlet with the name '"
+ portlet.getPortletName()
+ "'.");
break;
}
SecurityRoleRefDD sRR = (SecurityRoleRefDD)
sRefs.get(pRole.getRoleName());
if (null != sRR) {
System.out.println("Note: Replaced already existing element of type <security-role-ref> with value \""
+ pRole.getRoleName()
+ "\" for subelement of type <role-name> for the wrapper-servlet with the name '"
+ portlet.getPortletName()
+ "'.");
sSecRoleRefs.remove(sRR);
}
SecurityRoleRefDD dd = new SecurityRoleRefDD();
dd.setDescription(pRole.getDescription());
dd.setRoleLink(pRole.getRoleLink());
dd.setRoleName(pRole.getRoleName());
sSecRoleRefs.add(dd);
}
}