public String salvar() { cadastroOfertante.cadastrarOfertante(ofertante); if (!conversation.isTransient()) { conversation.end(); } return "principal?faces-redirect=true"; }
public void beginConversation() { if (conversation.isTransient()) { System.out.println("beginning conversation : " + this.conversation); conversation.begin(); System.out.println("---> Init Conversation"); } }
private void printInfo(PrintWriter writer) { writer.append("message: " + message.getValue()); writer.append("\n"); writer.append("cid: [" + conversation.getId()); writer.append("]"); writer.append("\n"); writer.append("transient: " + conversation.isTransient()); writer.append("\n"); }
/** Inicializa el bakend bean de control */ public void initNewObject() { if (bandera == Boolean.FALSE) { if (conversation.isTransient()) { conversation.begin(); } bandera = Boolean.TRUE; inicializarVariables(); } busqueda(); }
@Override public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url) { Conversation conversation = container.getCurrentConversation(cycle); if (conversation == null || conversation.isTransient()) { return; } if (propagation == ConversationPropagation.ALL) { // propagate cid to bookmarkable pages via urls url.setQueryParameter(CID, conversation.getId()); } }
public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler) { Conversation conversation = container.getCurrentConversation(cycle); if (conversation == null || conversation.isTransient()) { return; } // propagate a converastion across non-bookmarkable page instances Page page = getPage(handler); if (page != null && !conversation.isTransient()) { page.setMetaData(CID_KEY, conversation.getId()); } if (propagation == ConversationPropagation.ALL) { // propagate cid to a scheduled bookmarkable page PageParameters parameters = getPageParameters(handler); if (parameters != null) { parameters.add(CID, conversation.getId()); } } }
@Override public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler) { Conversation conversation = container.getCurrentConversation(cycle); if (conversation == null) { return; } // propagate a conversation across non-bookmarkable page instances Page page = getPage(handler); if (!conversation.isTransient() && page != null) { page.setMetaData(CID_KEY, conversation.getId()); } }
/** * Deletes the customer from the registry * * @return to showCustomers if the delete was success */ public String action() { if (!conv.isTransient()) { conv.end(); Logger.getAnonymousLogger().log(Level.INFO, "CONVERSATION ENDS"); } try { String userName = deleteCustomerBackingBean.getUserName(); customerRegistryBean.remove(userName); return "showCustomers?faces-redirect=true"; // Go back } catch (Exception e) { // Not implemented // return "error?faces-redirect=true&cause=" + e.getMessage(); return null; } }
public void retrieve() { if (FacesContext.getCurrentInstance().isPostback()) { return; } if (conversation.isTransient()) { conversation.begin(); } if (id == null) { author = example; } else { author = findById(getId()); } }
/** * Prepares the DeleteCustomerBackingBean with data to show which customer the admin is deleting * * @param ae */ public void actionListener(ActionEvent ae) { Customer customer = (Customer) ae.getComponent().getAttributes().get("customer"); if (conv.isTransient()) { conv.begin(); Logger.getAnonymousLogger() .log(Level.INFO, "CONVERSATION BEGINS: Got customer {0}", customer); } else { } deleteCustomerBackingBean.setFname(customer.getFname()); deleteCustomerBackingBean.setLname(customer.getLname()); deleteCustomerBackingBean.setEmail(customer.getEmail()); deleteCustomerBackingBean.setUserName(customer.getUserName()); Address address; address = customer.getAddress(); deleteCustomerBackingBean.setAddress(address); }
public void endConversation() { if (!conversation.isTransient()) { conversation.end(); System.out.println("Finalizando la conversación en Users"); } }
public void conversationBegin() { if (conversation.isTransient()) { conversation.begin(); } }
public void setOfertante(Ofertante ofertante) { if (ofertante.getId() != null && conversation.isTransient()) { conversation.begin(); } this.ofertante = ofertante; }
public String cancelar() { if (!conversation.isTransient()) { conversation.end(); } return "principal?faces-redirect=true"; }
@Test(description = "A simple test to check conversation replication") public void testConversationReplication() throws Exception { TestContainer container1 = bootstrapContainer(1, Collections.singletonList(Baz.class)); BeanManagerImpl beanManager1 = getBeanManager(container1); TestContainer container2 = bootstrapContainer(2, Collections.singletonList(Baz.class)); BeanManagerImpl beanManager2 = getBeanManager(container2); use(1); // Set up the conversation context BoundRequest request1 = new BoundRequestImpl(container1.getSessionStore()); BoundConversationContext conversationContext1 = Utils.getReference(beanManager1, BoundConversationContext.class); conversationContext1.associate(request1); conversationContext1.activate(); // Set a value into Baz1 Baz baz1 = Utils.getReference(beanManager1, Baz.class); baz1.setName("pete"); // Begin the conversation Conversation conversation1 = Utils.getReference(beanManager1, Conversation.class); conversation1.begin(); // refetch the test bean and check it has the right value baz1 = Utils.getReference(beanManager1, Baz.class); assert baz1.getName().equals("pete"); // Simulate ending the request (from the POV of the conversation only!) assert !conversation1.isTransient(); String cid = conversation1.getId(); conversationContext1.invalidate(); conversationContext1.deactivate(); conversationContext1.dissociate(request1); // and start another, propagating the conversation request1 = new BoundRequestImpl(container1.getSessionStore()); conversationContext1.associate(request1); conversationContext1.activate(cid); // refetch the test bean and check it has the right value baz1 = Utils.getReference(beanManager1, Baz.class); assert baz1.getName().equals("pete"); assert !conversation1.isTransient(); replicateSession(1, container1, 2, container2); use(2); // Set up the conversation context BoundRequest request2 = new BoundRequestImpl(container2.getSessionStore()); BoundConversationContext conversationContext2 = Utils.getReference(beanManager2, BoundConversationContext.class); conversationContext2.associate(request2); conversationContext2.activate(cid); Baz baz2 = Utils.getReference(beanManager2, Baz.class); assert baz2.getName().equals("pete"); Conversation conversation2 = Utils.getReference(beanManager2, Conversation.class); assert !conversation2.isTransient(); use(2); container2.stopContainer(); use(1); container1.stopContainer(); }
public boolean isTransient() { return delegate.isTransient(); }
public void beginConversation() { if (conversation.isTransient()) { conversation.begin(); System.out.println("========> INICIANDO CONVERSACION: "); } }
public void endConversation() { if (!conversation.isTransient()) { conversation.end(); System.out.println("========> FINALIZANDO CONVERSACION: "); } }
public void conversationEnd() { if (!conversation.isTransient()) { conversation.end(); } }
public void beginConversation() { if (conversation.isTransient()) { conversation.begin(); System.out.println("Iniciando la conversación en users"); } }