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

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


Hi,
Thanks for answer.
Page :

<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">
							
								
									
									<h:outputText
										value="#{messages.users}"></h:outputText>
									<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>
								
							

						</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>


But I don't have backing bean for that. Action method for blocking is located in entity bean.

@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());
	}

Best regards
it


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059914#4059914

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059914



More information about the jboss-user mailing list