View Javadoc

1   /*
2    * ============================================================================
3    *                   GNU Lesser General Public License
4    * ============================================================================
5    *
6    * Taylor - The Java Enterprise Application Framework.
7    * Copyright (C) 2005 John Gilbert jgilbert01@users.sourceforge.net
8    *
9    * This library is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public
11   * License as published by the Free Software Foundation; either
12   * version 2.1 of the License, or (at your option) any later version.
13   *
14   * This library is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   * Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this library; if not, write to the Free Software
21   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
22   *
23   * John Gilbert
24   * Email: jgilbert01@users.sourceforge.net
25   */
26  package net.taylor.audit.entity.editor;
27  import javax.ejb.Stateful;
28  
29  import net.taylor.audit.entity.Action;
30  import net.taylor.audit.entity.AuditEntry;
31  import net.taylor.richfaces.Picker;
32  import net.taylor.seam.AbstractFinderBean;
33  import net.taylor.seam.ComboBox;
34  import net.taylor.seam.Filter;
35  import net.taylor.seam.PieChart;
36  
37  import org.jboss.seam.ScopeType;
38  import org.jboss.seam.annotations.Name;
39  import org.jboss.seam.annotations.Scope;
40  
41  /**
42   * The implementation of the Finder interface.
43   *
44   * @author jgilbert
45   * @generated
46   */
47  @Name("auditEntryFinder")
48  @Stateful
49  @Scope(ScopeType.SESSION)
50  public class AuditEntryFinderBean extends AbstractFinderBean< AuditEntry > implements AuditEntryFinder {
51  
52  	/** @generated */
53  	private static final long serialVersionUID = 1L;
54  	
55  	/** @generated */
56  	public AuditEntryFinderBean() {
57  	}
58  
59  	/** @generated */
60  	protected void initFilter(Filter filter) {
61  		filter.addStringParameter("user");
62  		filter.addDateParameter("timestamp");
63  		filter.addStringParameter("entityName");
64  		filter.addEnumParameter("action", Action.class);
65  	}
66  	
67  	/** @generated */
68  	protected void initColumns() {
69  		// addColumn("id", "ID", true);
70  		addColumn("user", "String", null);
71  		addColumn("timestamp", "Timestamp", null);
72  		addColumn("entityName", "String", null);
73  		addColumn("entityId", "Integer", null);
74  		addColumn("action", "Enum", null);
75  
76  	}
77  
78  	/** @generated */
79  	public boolean isSimpleEntity() {
80  		return false;
81  	}
82  
83  	public boolean isRenderCreate() {
84  		return false;
85  	}
86  
87  	public boolean isRenderEdit() {
88  		return false;
89  	}
90  
91  	public boolean isRenderDelete() {
92  		return false;
93  	}
94  
95  	public boolean isRenderImport() {
96  		return false;
97  	}
98  	
99  	/** @generated */
100 	public PieChart getActionPieChart() {
101 		return new PieChart(getEntityManager(), "AuditEntry", "action");
102 	}
103 
104 	public PieChart getEntityNamePieChart() {
105 		return new PieChart(getEntityManager(), "AuditEntry", "entityName");
106 	}
107 
108 	public PieChart getUserPieChart() {
109 		return new PieChart(getEntityManager(), "AuditEntry", "user");
110 	}
111 	
112 	/**
113 	 * ------------------------------------------------------------------------
114 	 * --- Base ComboBox
115 	 * ------------------------------------------------------------------------
116 	 *
117 	 * @generated
118 	 */
119 	public static class AuditEntryComboBox<COMP, SRC> extends ComboBox<COMP, AuditEntry, SRC> {
120 
121 		/** @generated */
122 		public AuditEntryComboBox(Object component, String name) {
123 			super(component, name);
124 		}
125 
126 		/** @generated */
127 		public AuditEntryComboBox(Object component, String instanceName, String name) {
128 			super(component, instanceName, name);
129 		}
130 		
131 		/** @generated */
132 		protected Class getEntityClass() {
133 			return AuditEntry.class;
134 		}
135 		
136 		/** @generated */
137 		protected String getAlias() {
138 			return "t1";
139 		}
140 		
141 		/** @NOT generated */
142 		protected String getItemLabel() {
143 			return "#{t1.entityName}";
144 		}
145 
146 		/** @NOT generated */
147 		protected String getOrderBy() {
148 			return "t1.entityName";
149 		}
150 	}
151 	
152 	/**
153 	 * ------------------------------------------------------------------------
154 	 * --- Base Picker
155 	 * ------------------------------------------------------------------------
156 	 *
157 	 * @generated
158 	 */
159 	public static class AuditEntryPicker<COMP, SRC> extends
160 		Picker<COMP, AuditEntry, SRC> {
161 
162 		/** @generated */
163 		public AuditEntryPicker(Object component, String name) {
164 			super(component, name);
165 		}
166 
167 		/** @generated */
168 		public AuditEntryPicker(Object component, String instanceName, String name) {
169 			super(component, instanceName, name);
170 		}
171 
172 		/** @generated */
173 		protected Class getEntityClass() {
174 			return AuditEntry.class;
175 		}
176 
177 		/** @generated */
178 		protected String getAlias() {
179 			return "t1";
180 		}
181 		
182 		/** @NOT generated */
183 		protected String getItemLabel() {
184 			return "#{t1.entityName}";
185 		}
186 
187 		/** @NOT generated */
188 		protected String getOrderBy() {
189 			return "t1.entityName";
190 		}
191 	
192 		/** @NOT generated */
193 		protected String getFilterRestriction() {
194 			return "lower(t1.entityName) like :filter";
195 		}
196 	}
197 }