[jboss-user] [JBoss Seam] - Re: Update transactions occurring prematurely in Seam app

asookazian do-not-reply at jboss.com
Thu Dec 20 13:46:50 EST 2007


SEAM 2.0.0.GA
JBOSS 4.2.1.GA

So I tried using SMPC and it still updates the record prematurely (before @End submit method is executed).  There is another SFSB (session-scope) but it should not have anything to do with this particular table persistence.  Here is the current code:

SFSB:

package com.cox.beans.session;
  | 
  | import java.util.ArrayList;
  | import java.util.List;
  | 
  | import javax.annotation.PostConstruct;
  | import javax.annotation.PreDestroy;
  | import javax.ejb.PostActivate;
  | import javax.ejb.PrePassivate;
  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | import javax.ejb.TransactionAttribute;
  | import javax.ejb.TransactionAttributeType;
  | import javax.faces.model.SelectItem;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | import javax.persistence.PersistenceContextType;
  | 
  | import org.jboss.seam.annotations.Begin;
  | import org.jboss.seam.annotations.Destroy;
  | import org.jboss.seam.annotations.End;
  | import org.jboss.seam.annotations.Factory;
  | import org.jboss.seam.annotations.FlushModeType;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.datamodel.DataModel;
  | import org.jboss.seam.annotations.datamodel.DataModelSelectionIndex;
  | import org.jboss.seam.log.Log;
  | import org.jboss.seam.security.Identity;
  | 
  | import com.cox.beans.entity.TblSecurityAuditNote;
  | import com.cox.beans.entity.TblSecurityAuditWorking;
  | import com.cox.beans.entity.User;
  | import com.cox.util.SecurityAuditConstants;
  | import com.cox.util.SecurityAuditProperties;
  | 
  | 
  | 
  | 
  | @Stateful
  | @Name("securityAuditAction")
  | public class SecurityAuditAction implements SecurityAuditLocal {
  | 	
  | 	@Logger 
  | 	private Log log;
  | 	
  | 	@In
  | 	private Identity identity;
  | 			
  | 	// using EXTENDED for PersistenceContextType was causing premature update transaction commit to DB when clicking 'no' on radio button...
  | 	// 12/17/07 - org.hibernate.PersistentObjectException: detached entity passed to persist: com.cox.beans.entity.TblSecurityAuditNote
  | 	/*
  | 	 * http://www.jboss.org/index.html?module=bb&op=viewtopic&t=107263
  | 
  | 	“what are the reasons for the PersistentObjectException to occur?”
  | 
  | 	“If the entity is detached ;) You need to make sure your persistence context spans the life all 
  | 	the operations you perform with that instance of the entity.” <-- P. Muir
  | 	
  | 	attempting to fix this exception by using Extended PersistenceContextType again...  now entites will not detach from persistence context
  | 	
  | 	12/18/07 - now attempting SMPC as per section 8.3.3 of Seam ref pdf: we would prefer that all changes are held in memory and only written 
  | 				to the database when the conversation ends successfully. This allows for truly atomic conversations
  | 	 */
  | 	
  | 	//@PersistenceContext(unitName="boIcomsSecurityAudit", type=PersistenceContextType.EXTENDED)
  | 	//private EntityManager emICOMS;
  | 	
  | 	@In(value="BoIcomsEntityManager") 
  | 	EntityManager emICOMS;
  | 	
  | 	@In(required=false) @Out
  | 	private User user;
  | 		
  | 	@In(required=false)	
  | 	private List<TblSecurityAuditNote[]> noteList = new ArrayList<TblSecurityAuditNote[]>();
  | 	
  | 	@In(create=true)
  | 	private NoteLocal noteAction;
  | 	
  | 	@In(create=true)
  | 	private PeerLocal peerAction;
  | 	
  | 	private List<SelectItem> myRadioButtonList;
  | 
  | 	private List noteLoadList;
  | 		
  | 	@DataModel(value="myAuditList")
  | 	private List myAuditList;
  | 	
  | 	private String networkId = "";
  | 			
  | 	@DataModelSelectionIndex(value="myAuditList")
  | 	//this is the row number of the underlying collection
  | 	private int currentRowNum;	
  | 		
  | 	//adding empty constructor callback lifecycle methods for debugging purposes (interceptor will output when they get called)
  | 	
  | 	public SecurityAuditAction() {}
  | 	
  | 	@PostConstruct
  | 	public void postConstruct() {
  | 		log.info("in postConstruct");
  | 	}
  | 	
  | 	@PostActivate
  | 	public void postActivate() {
  | 		log.info("in postActivate");
  | 	}
  | 	
  | 	@PrePassivate
  | 	public void prePassivate() {
  | 		log.info("in prePassivate");
  | 		
  | 	}
  | 	
  | 	@PreDestroy
  | 	public void preDestroy() {
  | 		log.info("in preDestroy");
  | 		
  | 	}
  | 	
  | 	private Object[] getMyAuditListSelection() {
  | 		return (Object[])myAuditList.get(currentRowNum);
  | 	}
  | 			
  | 	// 12-03/07 - got following exception when I clicked cancel in modalPanel:
  | 	// Caused by java.lang.IllegalStateException with message: "begin method invoked from a long-running conversation, try using @Begin(join=true) on method: findAuditList" 
  | 	// adding join=true...
  | 		
  | 	@Begin(join=true, flushMode=FlushModeType.MANUAL)   // <-- use this with SMPC
  | 	//@Begin(join=true)
  |     @Factory("myAuditList")
  |     public void findAuditList()
  |     {			
  | 		Boolean hardCodeEmployeeId = Boolean.parseBoolean(SecurityAuditProperties.getPropertyObject().getProperty(SecurityAuditConstants.HARD_CODE_EMPLOYEE_ID));
  | 		Integer employeeId;
  | 		
  | 		if (hardCodeEmployeeId) {  //if true in props file then we're testing only...
  | 			
  | 			employeeId = peerAction.getEmployeeId();
  | 			
  | 			if (employeeId == null) {	
  | 				
  | 				employeeId = Integer.parseInt(SecurityAuditProperties.getPropertyObject().getProperty(SecurityAuditConstants.EMPLOYEE_ID)); //using btkach id for now;
  | 			}
  | 		}
  | 		else {
  | 			log.info("in getAuditList(): user.getUserId() = " + user.getUserId() + " user.getBillingId() = " + user.getBillingId());   	
  |     	    
  | 			//employeeId = getEmployeeId();
  | 			
  | 			employeeId = peerAction.getEmployeeId();
  | 	    	
  | 		}	
  | 			myAuditList = emICOMS.createQuery("SELECT gem, tsaw "+
  | 										"FROM TblSecurityAuditWorking tsaw, "+					
  | 										"GlobalEmployeeMaster gem "+				
  | 										"WHERE tsaw.id.siteId 		= gem.id.siteId "+
  | 										"AND tsaw.id.employeeNumber = gem.id.employeeNumber "+				
  | 										"AND tsaw.reportToId 		= :employeeId " +
  | 										"ORDER BY tsaw.id.employeeNumber ASC")
  | 										.setParameter("employeeId", employeeId)
  | 										.getResultList();    	
  | 		    
  | 			//instantiate null valued noteList
  | 	    	noteAction.initialize(myAuditList);
  | 	    	    	
  | 	    	log.info("in findAuditList(): myAuditList.size() = " + myAuditList.size());
  | 	    	
  | 	    	noteLoadList = emICOMS.createQuery("SELECT saw.id.siteId, saw.id.employeeNumber, "+
  | 								    	"("+
  | 								    	"SELECT count(san) as AcctApprovedNoteCount "+
  | 								    	"FROM TblSecurityAuditNote san "+
  | 								    	"WHERE san.siteId = saw.id.siteId "+
  | 								    	"AND san.employeeNumber = saw.id.employeeNumber "+
  | 								    	"AND san.noteType = 'accountApproved' "+
  | 								    	") as AcctApprovedCount, "+
  | 								    	"("+
  | 								    	"SELECT count(san) as secLevelApprovedNoteCount "+
  | 								    	"FROM TblSecurityAuditNote san "+
  | 								    	"WHERE san.siteId = saw.id.siteId "+
  | 								    	"AND san.employeeNumber = saw.id.employeeNumber "+
  | 								    	"AND san.noteType = 'secLevelApproved' "+
  | 								    	") as secLevelApprovedCount, "+
  | 								    	"("+
  | 								    	"SELECT count(san) as adjLimitApprovedNoteCount "+
  | 								    	"FROM TblSecurityAuditNote san "+
  | 								    	"WHERE san.siteId = saw.id.siteId "+
  | 								    	"AND san.employeeNumber = saw.id.employeeNumber "+
  | 								    	"AND san.noteType = 'adjLimitApproved' "+
  | 								    	") as adjLimitApprovedCount "+
  | 								    	"FROM TblSecurityAuditWorking saw")
  | 								    	.getResultList();
  | 	    	
  | 	    	
  | 	    	
  | 	    	log.info("in findAuditList(): noteLoadList.size() = " + noteLoadList.size());
  | 	    	
  |     	
  |     	
  |     }
  | 	
  | 	
  | 	public Boolean getLoadedNote(Integer rowIndex, String colName) {
  | 		if (rowIndex > -1) {
  | 			Object[] myArray = (Object[])noteLoadList.get(rowIndex);  
  | 			Long count = (Long)myArray[convertColName(colName).intValue()];
  | 			if (count > 0)
  | 				return true;
  | 			else
  | 				return false;
  | 		}
  | 		else
  | 			return false;
  | 	}
  | 	
  | 	private Integer convertColName(String colName) {
  | 		
  | 		if (SecurityAuditConstants.COL_ONE_NAME.equals(colName)) {
  | 			return SecurityAuditConstants.SECURITY_ACTION_COL_ONE_VALUE;
  | 		}
  | 		else if (SecurityAuditConstants.COL_TWO_NAME.equals(colName)) {
  | 			return SecurityAuditConstants.SECURITY_ACTION_COL_TWO_VALUE;
  | 		}
  | 		else if (SecurityAuditConstants.COL_THREE_NAME.equals(colName)) {
  | 			return SecurityAuditConstants.SECURITY_ACTION_COL_THREE_VALUE;
  | 		}
  | 		else
  | 			return 0;
  | 		
  | 	}
  |     
  |     public List<SelectItem> getSecurityAuditRadioButtons() {
  | 		myRadioButtonList = new ArrayList<SelectItem>();
  | 		myRadioButtonList.add(new SelectItem("true", "Yes", "Yes it is"));
  | 		myRadioButtonList.add(new SelectItem("false", "No", "No it isn't"));
  | 		return myRadioButtonList;
  | 	}
  |         
  |     public String getHeader() {    	
  |     	return "Please enter your note for the associate";		
  | 	}
  |     
  |     @End
  |     @TransactionAttribute(TransactionAttributeType.REQUIRED)  //REQUIRED is default, but added for clarity
  |     public void submit() {
  |     	
  |     	Object[] myAuditListSelection = getMyAuditListSelection();
  |     	
  |     	TblSecurityAuditWorking tsaw = (TblSecurityAuditWorking)myAuditListSelection[1];
  |     	    	
  |     	//determine what status to assign to each row/employee based on answers to radio buttons...
  |     	
  |     	//RULES: if yes/yes/yes --> green
  |     	//       if any no(s)  --> yellow
  |     	//       if none selected --> red
  |     	
  |     	Boolean icomsAccountApproved 	= tsaw.getIcomsAccountApproved()==null?false:tsaw.getIcomsAccountApproved();    	
  |     	Boolean adjustmentLimitApproved = tsaw.getAdjustmentLimitApproved()==null?false:tsaw.getAdjustmentLimitApproved();    	
  |     	Boolean securityLevelApproved 	= tsaw.getSecurityLevelApproved()==null?false:tsaw.getSecurityLevelApproved();
  |     	 
  |     	if ( icomsAccountApproved && adjustmentLimitApproved && securityLevelApproved ) {
  |     		//green    		
  |     		tsaw.setAuditProgress(SecurityAuditConstants.AUDIT_COMPLETE);
  |     	}
  |     	else if ( !icomsAccountApproved || !adjustmentLimitApproved || !securityLevelApproved ) {
  |     		//yellow    		 
  |     		tsaw.setAuditProgress(SecurityAuditConstants.AUDIT_WAITING_ICOMS);
  |     	}    	
  |     	else {
  |     		//yellow    		
  |     		tsaw.setAuditProgress(SecurityAuditConstants.AUDIT_WAITING_ICOMS);
  |     	}
  |             	
  |     	emICOMS.merge(tsaw);
  |     	    	    	
  |     	//check to see if there are any notes for each radio button for this employee/row
  |     	//then update/insert accordingly
  |     	
  |     	//TO DO: move the hard-coding 3 for # of updateable columns in dataTable to resource bundle
  |     	
  |     	// TO DO: noteAction.submit() was moved to action listener attribute in modalPanels...
  |     	//call submit to ensure new note is added to array
  |     	//noteAction.submit();
  |     	    	
  |     	for (int i = 0; i < 3; i++) {    		
  |     		TblSecurityAuditNote note = getTblSecurityAuditNote(currentRowNum, i);
  |     		if (note != null) {
  |     			log.info("myNotes["+currentRowNum+"]["+i+"]: noteText = " + note.getNoteText());    			
  |     			emICOMS.persist(note);
  |     		}
  |     	}
  |     	
  |     	emICOMS.flush();
  |  
  |     }
  |         
  |     private TblSecurityAuditNote getTblSecurityAuditNote(Integer rowIndex, Integer colNum) {		
  | 		rowIndex = rowIndex==null?0:rowIndex;
  | 		colNum 	 = colNum==null?0:colNum;
  | 				
  | 		if (noteList != null) {
  | 			try {
  | 				TblSecurityAuditNote[] myNoteArray = noteList.get(rowIndex);
  | 				return myNoteArray[colNum];
  | 			}
  | 			catch (IndexOutOfBoundsException e) {
  | 				if (rowIndex != null && rowIndex < 0) {
  | 					e.printStackTrace();
  | 					throw e;
  | 				}
  | 				return null;
  | 			}
  | 		}
  | 		else {
  | 			return null;
  | 		}
  | 	}
  |     
  | 	public String processGraphicImage(Integer auditProgress) {		
  | 		switch (auditProgress) {
  | 	        case 0:  return SecurityAuditConstants.RED_GRAPHIC;
  | 	        case 1:  return SecurityAuditConstants.YELLOW_GRAPHIC; 
  | 	        case 2:  return SecurityAuditConstants.GREEN_GRAPHIC;         
  | 	        default: return SecurityAuditConstants.RED_GRAPHIC;
  | 		}
  |     }
  | 
  | 	private String getNetworkId() {
  |     	if (networkId.equals("")) 
  |     		return identity.getUsername();    	
  |     	else 
  |     		return networkId;
  |     }
  | 	
  |     private void setNetworkId(String networkId) {
  |     	//log.info("in setNetworkId(): networkId = " + networkId);
  |     	this.networkId = networkId;
  |     }
  |     
  |     private Integer getEmployeeId() {
  |     	String networkId = getNetworkId()==null?"":getNetworkId();
  | 		
  | 		List myList = emICOMS.createQuery("from User u where u.networkId = :networkId").setParameter("networkId", networkId).getResultList(); 
  | 		User newUser = (User)myList.get(0);
  | 		
  | 		Integer employeeId = newUser.getEmployeeId().intValue();
  | 		
  | 		return employeeId; 
  |     }
  | 		
  | 		
  |         
  | 	@Remove @Destroy
  | 	public void destroy() {
  | 		
  | 	}
  | 
  | 		
  | 	 
  | 
  | }

xhtml:

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  |                       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <ui:composition xmlns="http://www.w3.org/1999/xhtml"
  |                 xmlns:s="http://jboss.com/products/seam/taglib"
  |                 xmlns:ui="http://java.sun.com/jsf/facelets"
  |                 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:c="http://java.sun.com/jstl/core"          
  |                 template="layout/template.xhtml">
  |                 
  | 
  | 
  | <ui:define name="mainContent">
  | 
  | 	<script type="text/javascript" 
  | 	  src="seam/resource/remoting/resource/remote.js">
  | 	</script>
  | 	
  | 	<script type="text/javascript" 
  | 	  src="seam/resource/remoting/interface.js?noteAction">
  | 	</script>
  | 	
  | 	<script type="text/javascript" 
  | 	  src="seam/resource/remoting/interface.js?securityAuditAction">
  | 	</script>
  | 	
  | 	<script type="text/javascript" 
  | 	  src="js/securityAudit.js">
  | 	</script>
  | 	
  | 	<h:messages styleClass="message"/>
  | 	    
  | 	<rich:panel>
  | 		<h:form id="peerForm">
  |    			<h:selectOneMenu id="selectPeer" value="#{peerAction.employeeId}">
  |    				<a4j:support event="onchange"   						     
  |    						     action="#{securityAuditAction.findAuditList}"
  |    						     ajaxSingle="true"
  |    						     reRender="mainForm"/> 
  | 			  <f:selectItems value="#{peerAction.peers}" />
  | 			</h:selectOneMenu>			
  |    		</h:form>    
  | 	</rich:panel>
  |    		
  |     <rich:panel>
  |         <h:form id="mainForm">
  | 	    		     	    		 
  | 	    		<h:outputText value="No Direct Reports" rendered="#{myAuditList != null and myAuditList.rowCount==0}"/>
  | 			 	<h:dataTable id="dataTable1" value="#{myAuditList}" var="myRow" rendered="#{myAuditList != null and myAuditList.rowCount > 0}"
  | 			 				 styleClass="dataTable" rowClasses="oddRow, evenRow" frame="hsides">
  | 			 		<h:column>
  | 			 			<f:facet name="header">Status</f:facet>
  | 			 			
  | 			 			<h:graphicImage id="statusImage" value="#{securityAuditAction.processGraphicImage(myRow[1].auditProgress)}"/>		    							
  | 			 		</h:column>
  | 		    		<h:column>
  | 			    		<f:facet name="header">Employee Name</f:facet>	    		
  | 			    		
  | 			    		<!-- siteId and employeeNumber hidden fields are used for all radio buttons -->
  | 			    		<h:outputText id="employeeName" value="#{myRow[0].id.employeeName}"/>		 
  | 			    		<h:inputHidden id="employeeNameHidden" value="#{myRow[0].id.employeeName}"/>  		    		
  | 			    		<h:inputHidden id="siteId" value="#{myRow[0].id.siteId}"/> 		
  | 			    		<h:inputHidden id="employeeNumber" value="#{myRow[0].id.employeeNumber}"/>
  | 		    		</h:column>
  | 		    		
  | 		    		<h:column>
  | 			    		<f:facet name="header">SiteId</f:facet>	    		
  | 			    		
  | 			    		<h:outputText value="#{myRow[0].id.siteId}"/>		   		    		
  | 		    		</h:column>
  | 		    		
  | 		    		<h:column>
  | 			    		<f:facet name="header">EmployeeNumber</f:facet>	    		
  | 			    		
  | 			    		<h:outputText value="#{myRow[0].id.employeeNumber}"/>		   		    		
  | 		    		</h:column>
  | 		    		
  | 		    		<h:column>
  | 			    		<f:facet name="header">Adjustment Limit</f:facet>	    		
  | 			    		
  | 			    		<h:outputText value="#{myRow[0].id.employeeNumber}"/>		   		    		
  | 		    		</h:column>
  | 		    				    
  | 		    		 		
  | 	    		    	<h:column>
  | 			    			<f:facet name="header">Account Approved?</f:facet>		    					    	
  | 		    					
  | 		    					<h:panelGrid columns="2">
  | 					    			<h:selectOneRadio id="accountApprovedRB" value="#{myRow[1].icomsAccountApproved}">		
  | 					    			     							  
  | 					    				<a4j:support event="onclick" 
  | 					    						     oncomplete="processNote(#{myAuditList.getRowIndex()}, 'accountApproved')"
  | 					    						     action="#{noteAction.setCurrentData(myAuditList.getRowIndex(), 'accountApproved', myAuditList)}"
  | 					    						     ajaxSingle="true"					    						     				    						     
  | 					    						     reRender="mainForm"/>
  | 					    			      
  | 										<f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
  | 									</h:selectOneRadio>
  | 									
  | 									<h:graphicImage  id="acctGraphic" value="/img/icon_edit.gif"
  | 					    							 rendered="#{noteAction.getRenderNoteGraphic(myAuditList.getRowIndex(), 'accountApproved') || 
  | 					    						     			securityAuditAction.getLoadedNote(myAuditList.getRowIndex(), 'accountApproved')}">
  | 					    				<a4j:support event="onclick"
  | 					    							 onclick="editNote(#{myAuditList.getRowIndex()}, 'accountApproved')"  
  | 					    							 actionListener="#{noteAction.setCurrentData(myAuditList.getRowIndex(), 'accountApproved', myAuditList)}"/>
  | 					    			</h:graphicImage>  
  | 					    		</h:panelGrid>
  | 			    		</h:column>
  | 			    		
  | 			    		
  | 			    		<h:column>
  | 			    			<f:facet name="header">Security Level Approved?</f:facet>
  | 			    			
  | 			    			<h:panelGrid columns="2">
  | 				    			<h:selectOneRadio id="securityLevelApprovedRB" value="#{myRow[1].securityLevelApproved}"			    							  	    							  
  | 				    							  rendered="#{noteAction.getRenderRadioButtons(myAuditList.getRowIndex())}">
  | 				    					<a4j:support event="onclick" 
  | 					    						     oncomplete="processNote(#{myAuditList.getRowIndex()}, 'secLevelApproved')"
  | 					    						     action="#{noteAction.setCurrentData(myAuditList.getRowIndex(), 'secLevelApproved', myAuditList)}"/>     		    						
  | 									<f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
  | 								</h:selectOneRadio>									 
  | 								<h:graphicImage id="securityLevelGraphic" value="/img/icon_edit.gif"												
  | 												rendered="#{noteAction.getRenderNoteGraphic(myAuditList.getRowIndex(), 'secLevelApproved') || 
  | 				    						     			securityAuditAction.getLoadedNote(myAuditList.getRowIndex(), 'secLevelApproved')}"> 
  | 				    				<a4j:support event="onclick"		
  | 				    							 onclick="editNote(#{myAuditList.getRowIndex()}, 'secLevelApproved')"	
  | 				    							 action="#{noteAction.setCurrentData(myAuditList.getRowIndex(), 'secLevelApproved', myAuditList)}"				    							
  | 				    							 reRender="out3"
  | 				    							 />
  | 				    			</h:graphicImage>								    	
  | 							</h:panelGrid>   			
  | 			    		</h:column>
  | 			    		
  | 			    		
  | 			    		<h:column>
  | 			    			<f:facet name="header">Adjustment Limit Approved?</f:facet>
  | 			    			
  | 			    			<!-- <h:panelGrid columns="2">  -->
  | 			    			<h:panelGrid columns="3">
  | 				    			<h:selectOneRadio id="adjustmentLimitApprovedRB" value="#{myRow[1].adjustmentLimitApproved}"
  | 				    							  rendered="#{noteAction.getRenderRadioButtons(myAuditList.getRowIndex())}">  
  | 										<a4j:support event="onclick" 
  | 					    						     oncomplete="processNote(#{myAuditList.getRowIndex()}, 'adjLimitApproved')"
  | 					    						     action="#{noteAction.setCurrentData(myAuditList.getRowIndex(), 'adjLimitApproved', myAuditList)}"/>        
  | 									<f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
  | 								</h:selectOneRadio>	  
  | 								<h:graphicImage id="adjLimitGraphic" value="/img/icon_edit.gif"
  | 												rendered="#{noteAction.getRenderNoteGraphic(myAuditList.getRowIndex(), 'adjLimitApproved') || 
  | 					    						     			securityAuditAction.getLoadedNote(myAuditList.getRowIndex(), 'adjLimitApproved')}">
  | 					    						<a4j:support event="onclick"		
  | 					    							 oncomplete="editNote(#{myAuditList.getRowIndex()}, 'adjLimitApproved')"	
  | 					    							 actionListener="#{noteAction.setCurrentData(myAuditList.getRowIndex(), 'adjLimitApproved', myAuditList)}"
  | 					    							 reRender="mpNoteAndEmployeeSubmit"/>
  | 					    		</h:graphicImage>     			  	
  | 					    		<h:commandButton id="submitEmployee" value="Submit" actionListener="#{securityAuditAction.submit}" style="visibility:hidden"/>
  | 							</h:panelGrid>
  | 			    		</h:column>
  | 		    					    
  | 		    	</h:dataTable>
  | 		    			    		    	
  | 		</h:form>
  | 	</rich:panel>
  | 	
  | 	<center>
  | 		<a4j:status>
  | 	        <f:facet name="start">
  | 	           <h:graphicImage value="/img/spinner.gif" height="50" width="50"/>
  | 	       </f:facet>
  | 	    </a4j:status>
  | 	</center>
  | 	
  | 	<!-- note only -->
  |     <rich:modalPanel  id="mpNote" minHeight="200" minWidth="450" 
  |             height="500" width="500" zindex="2000">
  |                         
  |             <f:facet name="header">
  |                 <a4j:form id="a4jHeaderForm1">
  |                 	<h:outputText id="headerText1" value=""/>
  |                 </a4j:form>
  |             </f:facet>
  |             
  |             
  |             <h:form id="noteLogList1">
  | 	            <h:dataTable value="#{noteAction.getNoteLogList()}" var="myRow" rendered="noteAction.getNoteLogList() != null">
  | 			        <h:column width="400">
  | 				   		<f:facet name="header">NoteText</f:facet>	   
  | 				   		<h:outputText value="#{myRow.noteText}"/>		   		    		
  | 			  		</h:column>
  | 			  	
  | 			  		<h:column>
  | 				   		<f:facet name="header">TimeStamp</f:facet>
  | 				   		<h:outputText value="#{myRow.timeStamp}">		   		    		
  | 				   			<s:convertDateTime dateStyle="short" timeStyle="medium" type="both"/>
  | 				   		</h:outputText>
  | 			  		</h:column>
  | 				</h:dataTable>
  | 			</h:form>   
  |                   
  |                     
  |            	<a4j:form id="a4jMainForm1"> 
  |            		<h:panelGrid columns="2" style="vertical-align:middle">		
  |            			<h:outputText id="description1" 			value=""/>
  |            			<BR/>
  | 					<h:inputTextarea id="noteText1" 			value="#{noteAction.noteText}" rows="6" cols="50">		
  | 						 <a4j:support event="onkeyup" reRender="out1" />
  | 					</h:inputTextarea>	
  | 														
  |    					<h:inputHidden id="modalPanelName" value="mpNote"/>	
  | 										
  | 					<h:panelGroup id="out1">					
  | 						<a4j:commandButton id="submit1" value="submit" action="#{noteAction.submit}" 
  | 									   onclick="Richfaces.hideModalPanel('mpNote')"
  | 									   oncomplete="selectFalseCurrentRadioButton()"
  | 									   rendered="#{not empty noteAction.noteText2}"
  | 									   reRender="mainForm"/>									   	
  | 					</h:panelGroup>
  | 					<BR/>
  | 					<a4j:commandButton value="cancel" onclick="Richfaces.hideModalPanel('mpNote');unselectCurrentRadioButton()"/>				
  | 				</h:panelGrid>
  | 			</a4j:form>
  |     </rich:modalPanel>
  |     
  |     <!-- no note, row data submit only -->
  |     <rich:modalPanel  id="mpEmployeeSubmit" minHeight="200" minWidth="450" 
  |             height="500" width="500" zindex="2000">
  |                         
  |             <f:facet name="header">
  |                 <a4j:form id="a4jHeaderForm2">
  |                 	<h:outputText id="headerText2" value=""/>
  |                 </a4j:form>
  |             </f:facet>
  |             
  |            	<a4j:form id="a4jMainForm2"> 
  |            		<h:panelGrid columns="2" style="vertical-align:middle">		
  |            			<h:outputText id="description2" 			value=""/>
  |            			<BR/>
  |            			
  |            			<h:inputHidden id="modalPanelName" value="mpEmployeeSubmit"/>	
  |            								
  | 					<a4j:commandButton value="submit" oncomplete="clickDataTableSubmit();Richfaces.hideModalPanel('mpEmployeeSubmit')"/>						
  | 					<BR/>
  | 					<a4j:commandButton value="cancel" onclick="Richfaces.hideModalPanel('mpEmployeeSubmit');unselectCurrentRadioButton()"/>	
  | 								
  | 				</h:panelGrid>
  | 			</a4j:form>
  |     </rich:modalPanel>
  |     
  |     <!-- note and row data submit -->
  |     
  |     <rich:modalPanel  id="mpNoteAndEmployeeSubmit" minHeight="200" minWidth="450" 
  |             height="500" width="500" zindex="2000">    
  |                           
  | 	            <f:facet name="header">
  | 	                <a4j:form id="a4jHeaderForm3">
  | 	                	<h:outputText id="headerText3" value=""/>
  | 	                </a4j:form>
  | 	            </f:facet>
  | 	     <a4j:outputPanel id="out3" ajaxRendered="true">         
  | 	            <h:form id="noteLogList2">	            
  | 					<rich:datascroller align="left"  for="myList" maxPages="20" rendered="#{noteAction.getNoteLogList() ne null}"/>
  | 		            <rich:spacer height="30" rendered="#{noteAction.getNoteLogList() ne null}"/>
  | 		            <rich:dataTable width="483" id="myList" rows="10" 
  | 		                value="#{noteAction.getNoteLogList()}" var="myRow" 
  | 		                rendered="#{noteAction.getNoteLogList() ne null}">
  | 		                <f:facet name="header">
  | 		                    <rich:columnGroup>
  | 		                        <h:column>
  | 		                            <h:outputText styleClass="headerText" value="NoteText" />
  | 		                        </h:column>
  | 		                        <h:column>
  | 		                            <h:outputText styleClass="headerText" value="TimeStamp" />
  | 		                        </h:column>		                        
  | 		                    </rich:columnGroup>
  | 		                </f:facet>
  | 		
  | 		                <h:column>
  | 		                    <h:outputText value="#{myRow.noteText}"/>	
  | 		                </h:column>
  | 		                <h:column>
  | 		                    <h:outputText value="#{myRow.timeStamp}">		   		    		
  | 				   				<s:convertDateTime dateStyle="short" timeStyle="medium" type="both"/>
  | 				   			</h:outputText>
  | 		                </h:column>
  | 	            	</rich:dataTable>
  | 				</h:form>   
  | 	     </a4j:outputPanel>       
  | 	           	<a4j:form id="a4jMainForm3"> 
  | 	           		<h:panelGrid columns="2" style="vertical-align:middle">		
  | 	           			<h:outputText id="description3" 			value=""/>
  | 	           			<BR/>
  | 											
  | 						<h:inputTextarea id="noteText3" 			value="#{noteAction.noteText}" rows="6" cols="50">		
  | 							 <a4j:support event="onkeyup" reRender="out3" />
  | 						</h:inputTextarea>
  | 						
  | 						<h:inputHidden id="modalPanelName" value="mpNoteAndEmployeeSubmit"/>	
  | 											
  | 						<h:panelGroup id="out3">					
  | 							<a4j:commandButton id="submit3" value="submit" action="#{noteAction.submit}" oncomplete="clickDataTableSubmit();Richfaces.hideModalPanel('mpNoteAndEmployeeSubmit')" 
  | 										   rendered="#{not empty noteAction.noteText2}">
  | 			    			</a4j:commandButton>			   	
  | 						</h:panelGroup>
  | 						
  | 						<BR/>
  | 						
  | 						<a4j:commandButton value="cancel" onclick="Richfaces.hideModalPanel('mpNoteAndEmployeeSubmit');unselectCurrentRadioButton()"/>				
  | 					</h:panelGrid>
  | 				</a4j:form>
  | 		
  |     </rich:modalPanel>
  | 
  |  	    
  | </ui:define> 
  | </ui:composition>

components.xml:

<?xml version="1.0" encoding="UTF-8"?>
  | <components xmlns="http://jboss.com/products/seam/components"
  |             xmlns:core="http://jboss.com/products/seam/core"
  |             xmlns:persistence="http://jboss.com/products/seam/persistence"
  |             xmlns:drools="http://jboss.com/products/seam/drools"
  |             xmlns:bpm="http://jboss.com/products/seam/bpm"
  |             xmlns:security="http://jboss.com/products/seam/security"
  |             xmlns:mail="http://jboss.com/products/seam/mail"
  |             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |             xsi:schemaLocation=
  |                 "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd 
  |                  http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd 
  |                  http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
  |                  http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
  |                  http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
  |                  http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
  |                  http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
  | 
  |    <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
  |         
  |    <core:manager concurrent-request-timeout="500" 
  |                  conversation-timeout="120000" 
  |                  conversation-id-parameter="cid"/>
  |     
  |    <persistence:managed-persistence-context name="CoxIMEntityManager"
  |                                      		auto-create="true"
  |                       						persistence-unit-jndi-name="java:/securityAuditCoxIMEntityManagerFactory"/>
  |    <persistence:managed-persistence-context name="CoxDSSEntityManager"
  |                  							auto-create="true"
  |    											persistence-unit-jndi-name="java:/securityAuditCoxDSSEntityManagerFactory"/>
  |    <persistence:managed-persistence-context name="BoIcomsEntityManager"
  |                   							auto-create="true"
  |    											persistence-unit-jndi-name="java:/securityAuditCoxIMEntityManagerFactory"/>
  | 
  |    <drools:rule-base name="securityRules">
  |        <drools:rule-files>
  |            <value>/security.drl</value>
  |        </drools:rule-files>
  |    </drools:rule-base>
  | 
  |    <security:identity authenticate-method="#{authenticator.authenticate}"
  |                            security-rules="#{securityRules}"/>
  |    
  |    <event type="org.jboss.seam.notLoggedIn">
  |        <action execute="#{redirect.captureCurrentView}"/>
  |    </event>
  |    <event type="org.jboss.seam.postAuthenticate">
  |        <action execute="#{redirect.returnToCapturedView}"/>
  |    </event>
  |    
  |    <mail:mail-session host="localhost" port="2525" username="test" password="test" />
  |         
  |    <!-- For use with jBPM pageflow or process management -->
  |    <!--  
  |    <bpm:jbpm>
  |       <bpm:process-definitions></bpm:process-definitions>
  |       <bpm:pageflow-definitions></bpm:pageflow-definitions>
  |    </bpm:jbpm>
  |    -->
  |       
  | </components>

persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
  | <!-- Persistence deployment descriptor for dev profile -->
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
  |              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |              xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
  |              version="1.0">
  |              
  |    <persistence-unit name="boIcomsSecurityAudit">
  |       <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |       <jta-data-source>java:/boIcomsSecurityAuditDatasource</jta-data-source>
  |       <properties>         
  |          <property name="jboss.entity.manager.factory.jndi.name" value="java:/securityAuditBoIcomsEntityManagerFactory"/>         
  |       </properties>
  |    </persistence-unit>
  |       
  |    <persistence-unit name="coxDSSDatasource">
  |       <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |       <jta-data-source>java:/coxDSSDatasource</jta-data-source> 
  |       <properties>         
  |          <property name="jboss.entity.manager.factory.jndi.name" value="java:/securityAuditCoxDSSEntityManagerFactory"/>         
  |       </properties>
  |    </persistence-unit>
  |    
  |    <persistence-unit name="coxIMDatasource">
  |       <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |       <jta-data-source>java:/coxIMDatasource</jta-data-source> 
  |       <properties>         
  |          <property name="jboss.entity.manager.factory.jndi.name" value="java:/securityAuditCoxIMEntityManagerFactory"/>         
  |       </properties>
  |    </persistence-unit>
  |     
  | </persistence>

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

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




More information about the jboss-user mailing list