Rendered problem
morellik Oct 11, 2013 8:14 AMDear,
I've to display an icon and related action only if an user appears in a (ManyToMany) list. I created a method to return True or False but doesn't work.
<a4j:commandLink  id="Share" action="#{localUserEJB.shareUserRequest(n.email, n.firstName, n.lastName, n.creator.email)}"
                                              rendered="#{request.isUserInRole('ADMINISTRATOR') and
                                                          (n.groups.get(0) eq 'UPLOADUSER' || n.groups.get(0) eq 'USER')
                                                          and !localUserEJB.isOwner(n.admin, localUserEJB.principal)
                                            }">
                                <h:graphicImage id="userShare"
                                                name="user-share.png"
                                                library="images"
                                                alt="Share"
                                                />
                            </a4j:commandLink>
public Boolean isOwner(List admin, String principal) {
        Boolean found = Boolean.FALSE;
  
        Class cls = admin.getClass();
        System.out.println(cls.getName());
        for (int i = 0; i < admin.size(); i++) {
            System.out.println(admin.get(i) + " " + principal);
            if (admin.get(i).equals(principal)) {
                System.out.println("TRUE" + admin.get(0));
                found = Boolean.TRUE;
            }
        }
        System.out.println(found);
        return found;
    }
The admin list appears like an org.eclipse.persistence.indirection.IndirectList and I don't know how to compare a String object with each element of the list. I tryied also admin,compare without results. The method returns FALSE.
The output is that:
INFO: org.eclipse.persistence.indirection.IndirectList
INFO: morelli@test.it rossi@test.it
INFO: rossi@test.it rossi@test.it
INFO: false
INFO: org.eclipse.persistence.indirection.IndirectList
INFO: morelli@test.it rossi@test.it
INFO: rossi@test.it rossi@test.it
INFO: false
Where I wrong?
