[weld-commits] Weld SVN: r6481 - in examples/trunk/jsf/pastecode/src/main: java/org/jboss/weld/examples/pastecode/session and 1 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Thu Jun 17 15:54:39 EDT 2010


Author: pete.muir at jboss.org
Date: 2010-06-17 15:54:38 -0400 (Thu, 17 Jun 2010)
New Revision: 6481

Removed:
   examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java
Modified:
   examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
   examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
   examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java
   examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java
   examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
Log:
add messages, remove Note, AccessLog

Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java	2010-06-17 18:44:00 UTC (rev 6480)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java	2010-06-17 19:54:38 UTC (rev 6481)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.model;
-
-import static javax.persistence.GenerationType.AUTO;
-
-import java.util.Date;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
- at Entity
-public class AccessLog
-{
-   
-   @Id @GeneratedValue(strategy = AUTO)
-   private int id;
-   
-   @Temporal(TemporalType.TIMESTAMP)
-   private Date datetime;
-   
-   @ManyToOne
-   private CodeFragment codeFragment;
-   
-   private String access;
-   
-   public AccessLog(CodeFragment codeFragment, Date dateTime, String access)
-   {
-      this.codeFragment = codeFragment;
-      this.datetime = dateTime;
-      this.access = access;
-   }
-   
-   public int getId()
-   {
-      return id;
-   }
-
-   public void setId(int id)
-   {
-      this.id = id;
-   }
-
-   public CodeFragment getCodeFragment()
-   {
-      return codeFragment;
-   }
-
-   public void setCodeFragment(CodeFragment codeFragment)
-   {
-      this.codeFragment = codeFragment;
-   }
-
-   public String getAccess()
-   {
-      return access;
-   }
-
-   public void setAccess(String access)
-   {
-      this.access = access;
-   }
-
-   public Date getDatetime()
-   {
-      return this.datetime;
-   }
-
-   public void setDatetime(Date datetime)
-   {
-      this.datetime = datetime;
-   }
-
-}

Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java	2010-06-17 18:44:00 UTC (rev 6480)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java	2010-06-17 19:54:38 UTC (rev 6481)
@@ -25,9 +25,7 @@
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.List;
 
-import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
@@ -35,7 +33,6 @@
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import javax.persistence.Lob;
-import javax.persistence.OneToMany;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.validation.constraints.Size;
@@ -67,9 +64,6 @@
    private Language language;
 
    @Lob
-   private String note;
-
-   @Lob
    @Size(min=1, message="Must enter some text!")
    private String text;
 
@@ -77,9 +71,6 @@
 
    private String hash;
 
-   @OneToMany(mappedBy = "codeFragment", cascade = CascadeType.REMOVE)
-   List<AccessLog> largeCodeFragmentAccessLog;
-
    public int getId()
    {
       return id;
@@ -174,16 +165,6 @@
       this.language = language;
    }
 
-   public String getNote()
-   {
-      return this.note;
-   }
-
-   public void setNote(String note)
-   {
-      this.note = note;
-   }
-
    public String getText()
    {
       return this.text;
@@ -203,14 +184,4 @@
    {
       this.user = user;
    }
-
-   public List<AccessLog> getLargeCodeFragmentAccessLog()
-   {
-      return largeCodeFragmentAccessLog;
-   }
-
-   public void setLargeCodeFragmentAccessLog(List<AccessLog> largeCodeFragmentAccessLog)
-   {
-      this.largeCodeFragmentAccessLog = largeCodeFragmentAccessLog;
-   }
 }
\ No newline at end of file

Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java	2010-06-17 18:44:00 UTC (rev 6480)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java	2010-06-17 19:54:38 UTC (rev 6481)
@@ -192,10 +192,6 @@
       {
          predicates.add( builder.equal(root.get(CodeFragment_.language), codeFragment.getLanguage()) );
       }
-      if (!isEmpty(codeFragment.getNote()))
-      {
-         predicates.add( builder.like(root.get(CodeFragment_.note), codeFragment.getNote().toLowerCase()) );
-      }
       if (!isEmpty(codeFragment.getText()))
       {
          predicates.add( builder.like(root.get(CodeFragment_.text), codeFragment.getText().toLowerCase()) );

Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java	2010-06-17 18:44:00 UTC (rev 6480)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java	2010-06-17 19:54:38 UTC (rev 6481)
@@ -81,8 +81,8 @@
             st.nextToken();
             c.setLanguage(Language.valueOf(st.nextToken()));
             st.nextToken();
-            c.setNote(st.nextToken());
             st.nextToken();
+            st.nextToken();
             c.setUser(st.nextToken());
             st.nextToken();
             c.setText(st.nextToken());

Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java	2010-06-17 18:44:00 UTC (rev 6480)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java	2010-06-17 19:54:38 UTC (rev 6481)
@@ -22,8 +22,9 @@
 package org.jboss.weld.examples.pastecode.session;
 
 import javax.ejb.EJBException;
-import javax.enterprise.inject.Model;
+import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
+import javax.inject.Named;
 
 import org.jboss.weld.examples.pastecode.model.CodeFragment;
 
@@ -31,7 +32,8 @@
  * PasteWindow holds the code fragment and other selections when a code fragment is viewed and entered
  *
  */
- at Model
+ at Named
+ at RequestScoped
 public class PasteWindow
 {
    private CodeFragment codeFragment;

Modified: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml	2010-06-17 18:44:00 UTC (rev 6480)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml	2010-06-17 19:54:38 UTC (rev 6481)
@@ -14,7 +14,7 @@
    	
    	<ui:define name="mainarea">
 	   			   		
-	   	<div class="contentHeader">Post a new PasteCode</div>
+	   	<div class="contentHeader">Post a new PasteCode <h:messages style="color: red" /></div>
 	   		
 	   	<h:inputTextarea id="text" styleClass="pastecode" value="#{pasteWindow.codeFragment.text}"/>
 



More information about the weld-commits mailing list