while(i.hasNext()) {
PortletDefinition dd = (PortletDefinition)i.next();
if(portletName.equals(dd.getPortletName())) {
Iterator i2 = dd.getSupports().iterator();
while(i2.hasNext()) {
Supports sd = (Supports)i2.next();
if (sd.getPortletModes()==null){
if (mode.equalsIgnoreCase(PortletMode.VIEW.toString()))
return true;
}
else{
Iterator pd = sd.getPortletModes().iterator();
while(pd.hasNext()) {
if(mode.equalsIgnoreCase((String)pd.next())) {
return true;
}
}