[JBoss Seam] - Re: ResourceBundle in Database
by Zerg-Spirit
Still can't make it work.
I changed my bean so that it's now a SFSB (in order to use @Create):
@Stateful
| @Name("dbResourceBundle")
| @Scope(SESSION)
| public class DBResourceBundle extends ResourceBundle implements iDBResourceBundle{
| ...
Here's the @Create method:
@Create
| public void fillAvailableResourceBundle(){
| try{
| availableResourceBundles = em.createQuery("select rb from CustomResourceBundle rb").getResultList();
| }
| catch(Exception e){
|
| e.printStackTrace();
|
| }
|
|
| }
According to my tests, this method is never called.
I think my implementation of the ResourceBundle is correct though, since it calls the handleGetObject method in my DBResourceBundle class when I refer to "messages['something'] in my jsf pages.
So I just have to fix that EntiyManager issue.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059937#4059937
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059937
18Â years, 9Â months
[JBoss Seam] - Re: problem with blocking user
by ivan.tufegdzic
Yes. Sorry.
| <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
| xmlns:t="http://myfaces.apache.org/tomahawk"
| template="/layout/templateallpage.xhtml">
| <ui:define name="body">
| <a4j:form>
| <rich:dataTable cellpadding="0" cellspacing="0" border="0" var="row"
| id="userTable" value="#{userList.resultList}" width="100%">
| <f:facet name="header">
| <rich:columnGroup>
| <rich:column colspan="8">
| <table width="100%">
| <tr>
| <td align="left" width="25%"></td>
| <td align="center" width="50%"><h:outputText
| value="#{messages.users}"></h:outputText></td>
| <td align="right" width="25%"><h:inputText id="value"
| required="false" value="#{tableSearch.value}" /> <rich:spacer
| width="5"></rich:spacer> <a4j:commandLink id="peopleSearch"
| reRender="userTable"
| action="#{tableSearch.search(userList)}">
| <t:graphicImage value="/images/search.gif" title="#{messages.search}"></t:graphicImage>
| </a4j:commandLink> <rich:spacer width="5"></rich:spacer> <a4j:commandLink
| id="stopSearch" reRender="userTable"
| action="#{tableSearch.clear(userList)}">
| <t:graphicImage value="/images/kreuz.gif" title="#{messages.clearsearch}"></t:graphicImage>
| </a4j:commandLink></td>
| </tr>
| </table>
|
| </rich:column>
| <rich:column breakBefore="true">
| <h:outputText value="#{messages.action}" />
| </rich:column>
| <rich:column>
| <s:link styleClass="columnHeader"
| value="#{messages.created} #{userList.order=='created asc' ? messages.down : ( userList.order=='created desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='created asc' ? 'created desc' : 'created asc'}" />
| </s:link>
| </rich:column>
| <rich:column>
| <s:link styleClass="columnHeader"
| value="#{messages.modified} #{userList.order=='modified asc' ? messages.down : ( userList.order=='modified desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='modified asc' ? 'modified desc' : 'modified asc'}" />
| </s:link>
| </rich:column>
| <rich:column>
| <s:link styleClass="columnHeader"
| value="#{messages.name} #{userList.order=='name asc' ? messages.down : ( userList.order=='name desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='name asc' ? 'name desc' : 'name asc'}" />
| </s:link>
| </rich:column>
| <rich:column>
| <s:link styleClass="columnHeader"
| value="#{messages.newUserDescription} #{userList.order=='description asc' ? messages.down : ( userList.order=='description desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='description asc' ? 'description desc' : 'description asc'}" />
| </s:link>
| </rich:column>
| <rich:column>
| <f:facet name="header">
| <s:link styleClass="columnHeader"
| value="#{messages.email} #{userList.order=='email asc' ? messages.down : ( userList.order=='email desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='email asc' ? 'email desc' : 'email asc'}" />
| </s:link>
| </f:facet>
| </rich:column>
| <rich:column>
| <s:link styleClass="columnHeader"
| value="#{messages.deactive} #{userList.order=='disabledflag asc' ? messages.down : ( userList.order=='disabledflag desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='disabledflag asc' ? 'disabledflag desc' : 'disabledflag asc'}" />
| </s:link>
| </rich:column>
| <rich:column>
| <s:link styleClass="columnHeader"
| value="#{messages.phone} #{userList.order=='phone asc' ? messages.down : ( userList.order=='phone desc' ? messages.up : '' )}">
| <f:param name="order"
| value="#{userList.order=='phone asc' ? 'phone desc' : 'phone asc'}" />
| </s:link>
| </rich:column>
| </rich:columnGroup>
| </f:facet>
|
| <rich:column>
| <a4j:commandLink id="locker" action="#{row.toggleLock}"
| reRender="userTable">
| <f:param name="conversationId" value="#{conversation.id}" />
| <t:graphicImage
| value="#{row.disabledflag ? '/images/red.gif' : '/images/green.gif'}" />
| </a4j:commandLink>
| <rich:spacer width="10"></rich:spacer>
| <t:commandLink action="#{adminUser.redirectUser(row)}"
| title="#{messages.administrationuser}">
| <t:graphicImage value="/images/edit.gif" />
| </t:commandLink>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.created}"></h:outputText>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.modified}"></h:outputText>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.name}"></h:outputText>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.description}"></h:outputText>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.email}"></h:outputText>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.disabledflag}"></h:outputText>
| </rich:column>
| <rich:column>
| <h:outputText value="#{row.phone}"></h:outputText>
| </rich:column>
| </rich:dataTable>
| </a4j:form>
| </ui:define>
| </ui:composition>
|
Entity
| @Table(name = "user")
| @Entity
| public class User implements Serializable {
|
| /**
| *
| */
| private static final long serialVersionUID = 1L;
|
| private boolean disabledflag; // DISABLEDFLAG
|
| private String login = null; // LOGIN
|
| private String password = null; // PASSWORD
|
| private Set roles = new HashSet(0);
|
| private List rolesList;
|
| .
| .
| .
|
| /**
| * This is many to many realtionship.
| * @return roles Set of roles for this user
| * @author Ivan Tufegdzic
| */
| @ManyToMany(cascade=CascadeType.ALL)
| public Set getRoles() {
| return roles;
| }
|
| /**
| * @param roles
| * the set of ROLE to set
| */
| public void setRoles(Set roles) {
| this.roles = roles;
| }
|
| /**
| * @return rolesList List of roles as collection for this user
| * @author Ivan Tufegdzic
| */
| @Transient
| public List getRolesAsCollection() {
| if (rolesList == null) {
| rolesList = new LinkedList();
| rolesList.addAll(getRoles());
| }
| return rolesList;
| }
|
| /**
| * @param rolesList
| * the List of ROLE to set
| */
| public void setRolesAsCollection(List rolesList) {
| setRoles(new HashSet(rolesList));
| this.rolesList = rolesList;
| }
|
| /**
| * @return the DISABLEDFLAG
| */
| public boolean isDisabledflag() {
| return disabledflag;
| }
|
| /**
| * @param disabledflag
| * the DISABLEDFLAG to set
| */
| public void setDisabledflag(boolean disabledflag) {
| this.disabledflag = disabledflag;
| }
|
| /**
| * Seting disabled flag for user
| */
| @ItemAction(icon = "#{row.disabledflag ? '/images/red.gif' : '/images/green.gif'}", partial = true)
| public void toggleLock() {
| setModified(new Date());
| setDisabledflag(!isDisabledflag());
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059936#4059936
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059936
18Â years, 9Â months
[JBoss Portal] - Re: JBOSS Portal 2.6 and OpenLDAP (looking for an example ld
by egandt
Sorry the fatwire, was lack of scrubbing the data. as for the other dc=fatwire.com I fixed that to be dc=example,dc=com
The typo of dc=fatwire.com was the problem authentication is now working for openLDAP. I'm including the working LDIF and ldap-identity-config.xml from my install as this may help others in the future. Before use fix the passwords from the users ldapuser and admin as well as the login for openLDAP. My setup assumes that openLDAP is installed on the same server as jboss portal 2.6.
LDIF from OpenLDAP:
| dn: dc=example,dc=com
| dc: example
| description: OpenLDAP pre_cs_setup
| objectClass: dcObject
| objectClass: organization
| o: Example Software
|
| dn: cn=Manager, dc=example,dc=com
| objectClass: organizationalRole
| cn: Manager
|
| dn: ou=People, dc=example,dc=com
| ou: People
| objectClass: organizationalUnit
| objectClass: top
|
| dn: ou=Groups, dc=example,dc=com
| ou: Groups
| objectClass: organizationalUnit
| objectClass: top
|
| dn: cn=admin,ou=People, dc=example,dc=com
| userPassword: {SSHA}XXXXXX
| objectClass: top
| objectClass: organizationalPerson
| objectClass: person
| sn: admin
| cn: admin
|
| dn: cn=ldapuser,ou=People, dc=example,dc=com
| userPassword: {SSHA}XXXXXX
| description: JBoss Portal ldapuser User for test LDAP integration password=username
| objectClass: top
| objectClass: organizationalPerson
| objectClass: person
| sn: ldapuser
| cn: ldapuser
|
| dn: cn=User,ou=Groups, dc=example,dc=com
| description: the JBoss Portal user group
| objectClass: top
| objectClass: groupOfUniqueNames
| uniqueMember: cn=ldapuser,ou=People,dc=example,dc=com
| cn: User
|
| dn: cn=Admin,ou=Groups, dc=example,dc=com
| description: the JBoss Portal admin group
| objectClass: top
| objectClass: groupOfUniqueNames
| uniqueMember: cn=admin,ou=People,dc=example,dc=com
| cn: Admin
|
ldap_identity-config.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <!--<!DOCTYPE identity-configuration PUBLIC
| "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
| "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
| <identity-configuration>
| <datasources>
| <datasource>
| <name>LDAP</name>
| <config>
| <option>
| <name>host</name>
| <value>127.0.0.1</value>
| </option>
| <option>
| <name>port</name>
| <value>389</value>
| </option>
| <option>
| <name>adminDN</name>
| <value>cn=Manager,dc=example,dc=com</value>
| </option>
| <option>
| <name>adminPassword</name>
| <value>XXXXXXX</value>
| </option>
| </config>
| </datasource>
| </datasources>
| <modules>
| <module>
| <!--type used to correctly map in IdentityContext registry-->
| <type>User</type>
| <implementation>LDAP</implementation>
| <config/>
| </module>
| <module>
| <type>Role</type>
| <implementation>LDAP</implementation>
| <config/>
| </module>
| <module>
| <type>Membership</type>
| <implementation>LDAP</implementation>
| <config/>
| </module>
| <module>
| <type>UserProfile</type>
| <implementation>DELEGATING</implementation>
| <config>
| <option>
| <name>ldapModuleJNDIName</name>
| <value>java:/portal/LDAPUserProfileModule</value>
| </option>
| </config>
| </module>
| <module>
| <type>DBDelegateUserProfile</type>
| <implementation>DB</implementation>
| <config>
| <option>
| <name>randomSynchronizePassword</name>
| <value>true</value>
| </option>
| </config>
| </module>
| <module>
| <type>LDAPDelegateUserProfile</type>
| <implementation>LDAP</implementation>
| <config/>
| </module>
| </modules>
|
| <options>
| <option-group>
| <group-name>common</group-name>
| <option>
| <name>userCtxDN</name>
| <value>ou=People,dc=example,dc=com</value>
| </option>
| <option>
| <name>uidAttributeID</name>
| <value>cn</value>
| </option>
| <option>
| <name>passwordAttributeID</name>
| <value>userPassword</value>
| </option>
|
| <option>
| <name>roleCtxDN</name>
| <value>ou=Groups,dc=example,dc=com</value>
| </option>
| <option>
| <name>ridAttributeId</name>
| <value>cn</value>
| </option>
| <option>
| <name>roleDisplayNameAttributeID</name>
| <value>cn</value>
| </option>
| <option>
| <name>membershipAttributeID</name>
| <value>uniqueMember</value>
| </option>
| <option>
| <name>membershipAttributeIsDN</name>
| <value>true</value>
| </option>
| </option-group>
| <option-group>
| <group-name>userCreateAttibutes</group-name>
| <option>
| <name>objectClass</name>
| <!--This objectclasses should work with Red Hat Directory-->
| <value>top</value>
| <value>person</value>
| <value>organizationalPerson</value>
| </option>
| <!--Schema requires those to have initial value-->
| <option>
| <name>cn</name>
| <value>none</value>
| </option>
| <option>
| <name>sn</name>
| <value>none</value>
| </option>
| </option-group>
|
| <option-group>
| <group-name>roleCreateAttibutes</group-name>
| <option>
| <name>objectClass</name>
| <value>top</value>
| <value>groupOfUniqueNames</value>
| </option>
| <!--Schema requires those to have initial value-->
| <option>
| <name>cn</name>
| <value>none</value>
| </option>
| <!--Some directory servers require this attribute to be valid DN-->
| <!--For safety reasons point to the admin user here-->
| <option>
| <name>member</name>
| <value>cn=admin,ou=People,dc=example,dc=com</value>
| </option>
| </option-group>
| </options>
| </identity-configuration>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059931#4059931
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059931
18Â years, 9Â months