Changeset 4076
- Timestamp:
- Jan 11, 2008, 4:16:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/src/docbook/developerdoc/api_overview.xml
r3947 r4076 730 730 731 731 <para> 732 The <property>lastUpdate</property> property holds the data and time 733 the reporter information was last updated. The value is managed automatically 734 by the <classname>ReporterBatcher</classname> class. 732 The 733 <property>lastUpdate</property> 734 property holds the data and time the reporter information was last updated. The 735 value is managed automatically by the 736 <classname>ReporterBatcher</classname> 737 class. That goes for 738 <property>lastSource</property> 739 property too, which holds information about where the last update comes from. By 740 default this is set to the name of the logged in user, but it can be changed by 741 calling 742 <methodname>ReporterBatcher.setUpdateSource(String source)</methodname> 743 before the batcher commits the updates to the database. The source-string 744 should have the format: <synopsis>[ITEM_TYPE]:[ITEM_NAME]</synopsis> where,in 745 the file-case, ITEM_TYPE is File and ITEM_NAME is the file's name. 735 746 </para> 736 747 </sect3> -
trunk/src/core/net/sf/basedb/core/ReporterBatcher.java
r4075 r4076 43 43 extends BasicBatcher<ReporterData> 44 44 { 45 46 /** 47 A string to hold the name of the source, 48 used to update the reporters. 49 */ 50 private String updateSource = null; 45 51 46 52 /** … … 49 55 @param dc The DbControl to use for database access and 50 56 permission checking 57 @return A new instance of ReporterBatcher. 51 58 @throws BaseException If there is an error 52 59 */ … … 56 63 ReporterBatcher rb = new ReporterBatcher(dc); 57 64 rb.initPermissions(0, 0); 58 rb.checkPermission(Permission.READ); 65 rb.checkPermission(Permission.READ); 59 66 return rb; 60 67 } … … 155 162 { 156 163 setPropertyValue(data, "lastUpdate", new Date()); 157 setPropertyValue(data, "lastSource", updateSource != null ? updateSource : "n/a"); 164 if (updateSource == null) 165 { 166 int editorId = this.getDbControl().getSessionControl().getLoggedInUserId(); 167 User editor = User.getById(this.getDbControl(), editorId); 168 updateSource = "User: " + editor.getName(); 169 } 170 setPropertyValue(data, "lastSource", updateSource); 158 171 } 159 172 // ------------------------------------------- … … 164 177 private org.hibernate.Query findReporter; 165 178 166 /**167 A string to hold the name of the source,168 used to update the reporters.169 */170 private String updateSource = null;171 179 /** 172 180 Check if a reporter with a given external id exists in the database or … … 258 266 /** 259 267 Set the source that was used when updating the reporters. 260 This must be set before committing this batcher. 268 This must be set before committing this batcher otherwise the column 269 for last update source will be set to n/a. 261 270 @param source The source to be set. The format of the source string 262 271 should be like: "[item_type]:[item_name]" -
trunk/src/plugins/core/net/sf/basedb/plugins/CdfFileReporterImporter.java
r4043 r4076 463 463 { 464 464 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 465 if (job.getValue("file") != null) 466 { 467 batcher.setUpdateSource("File: " + ((File)job.getValue("file")).getName()); 468 } 465 469 ReporterType type = (ReporterType)job.getValue("reporterType"); 466 470 String mode = (String)job.getValue("mode"); -
trunk/src/plugins/core/net/sf/basedb/plugins/ReporterFlatFileImporter.java
r3679 r4076 26 26 package net.sf.basedb.plugins; 27 27 28 import net.sf.basedb.core.File; 28 29 import net.sf.basedb.core.FileType; 29 30 import net.sf.basedb.core.HibernateUtil; … … 442 443 deleted = HibernateUtil.getDbEngine().caseInsensitiveComparison() ? 443 444 new TreeSet<String>(String.CASE_INSENSITIVE_ORDER) : new HashSet<String>(); 445 } 446 if (job.getValue("file") != null) 447 { 448 batcher.setUpdateSource("File: " + ((File)job.getValue("file")).getName()); 444 449 } 445 450 numInserted = 0; -
trunk/src/plugins/core/net/sf/basedb/plugins/ReporterMapFlatFileImporter.java
r3820 r4076 423 423 addErrorHandler(ItemNotFoundException.class, new SimpleErrorHandler("skip".equals(method))); 424 424 } 425 if (job.getValue("file") != null) 426 { 427 reporterBatcher.setUpdateSource("File: " + ((File)job.getValue("file")).getName()); 428 } 425 429 426 430 numFeatures = 0; -
trunk/www/views/reporters/index.jsp
r3792 r4076 42 42 import="net.sf.basedb.core.PermissionDeniedException" 43 43 import="net.sf.basedb.core.BaseException" 44 import="net.sf.basedb.core.User" 44 45 import="net.sf.basedb.util.RemovableUtil" 45 46 import="net.sf.basedb.util.ShareableUtil" -
trunk/www/views/reporters/list_reporters.jsp
r3679 r4076 243 243 exportable="true" 244 244 formatter="<%=timeFormatter%>" 245 /> 246 <tbl:columndef 247 id="lastSource" 248 property="lastSource" 249 datatype="string" 250 title="Last source" 251 sortable="true" 252 filterable="true" 253 exportable="true" 245 254 /> 246 255 <% … … 424 433 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 425 434 <tbl:cell column="lastUpdate" value="<%=item.getLastUpdate()%>" /> 435 <tbl:cell column="lastSource"><%=HTML.encodeTags(item.getLastSource())%></tbl:cell> 426 436 <tbl:cell column="reporterType" 427 437 ><base:propertyvalue -
trunk/www/views/reporters/view_reporter.jsp
r3679 r4076 191 191 <td><%=dateFormatter.format(reporter.getLastUpdate())%></td> 192 192 </tr> 193 <tr> 194 <td class="prompt">Last source</td> 195 <td><%=HTML.niceFormat(reporter.getLastSource())%></td> 196 </tr> 193 197 </table> 194 198
Note: See TracChangeset
for help on using the changeset viewer.