[jboss-user] [JBoss Seam] - Re: problem with blocking user

ivan.tufegdzic do-not-reply at jboss.com
Tue Jul 3 08:46:21 EDT 2007


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



More information about the jboss-user mailing list