Changeset 4076


Ignore:
Timestamp:
Jan 11, 2008, 4:16:30 PM (15 years ago)
Author:
Martin Svensson
Message:

Fixes #879 Add column holding the filename of last file used for updating reporter annotations. The documentation, reporter importer plugins and web client are now also updated to support this new column.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/src/docbook/developerdoc/api_overview.xml

    r3947 r4076  
    730730       
    731731        <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.
    735746        </para>
    736747      </sect3>
  • trunk/src/core/net/sf/basedb/core/ReporterBatcher.java

    r4075 r4076  
    4343  extends BasicBatcher<ReporterData>
    4444{
     45 
     46  /**
     47    A string to hold the name of the source,
     48    used to update the reporters.
     49   */
     50  private String updateSource = null;
    4551
    4652  /**
     
    4955    @param dc The DbControl to use for database access and
    5056      permission checking
     57    @return A new instance of ReporterBatcher.
    5158    @throws BaseException If there is an error
    5259  */
     
    5663    ReporterBatcher rb = new ReporterBatcher(dc);
    5764    rb.initPermissions(0, 0);
    58     rb.checkPermission(Permission.READ);
     65    rb.checkPermission(Permission.READ);   
    5966    return rb;
    6067  }
     
    155162  {
    156163    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);
    158171  }
    159172  // -------------------------------------------
     
    164177  private org.hibernate.Query findReporter;
    165178 
    166   /**
    167     A string to hold the name of the source,
    168     used to update the reporters.
    169    */
    170   private String updateSource = null;
    171179  /**
    172180    Check if a reporter with a given external id exists in the database or
     
    258266  /**
    259267    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.       
    261270    @param source The source to be set. The format of the source string
    262271      should be like: "[item_type]:[item_name]"   
  • trunk/src/plugins/core/net/sf/basedb/plugins/CdfFileReporterImporter.java

    r4043 r4076  
    463463  {
    464464    ReporterBatcher batcher = ReporterBatcher.getNew(dc);
     465    if (job.getValue("file") != null)
     466    {
     467      batcher.setUpdateSource("File: " + ((File)job.getValue("file")).getName());
     468    }
    465469    ReporterType type = (ReporterType)job.getValue("reporterType");
    466470    String mode = (String)job.getValue("mode");
  • trunk/src/plugins/core/net/sf/basedb/plugins/ReporterFlatFileImporter.java

    r3679 r4076  
    2626package net.sf.basedb.plugins;
    2727
     28import net.sf.basedb.core.File;
    2829import net.sf.basedb.core.FileType;
    2930import net.sf.basedb.core.HibernateUtil;
     
    442443      deleted = HibernateUtil.getDbEngine().caseInsensitiveComparison() ?
    443444        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());
    444449    }
    445450    numInserted = 0;
  • trunk/src/plugins/core/net/sf/basedb/plugins/ReporterMapFlatFileImporter.java

    r3820 r4076  
    423423      addErrorHandler(ItemNotFoundException.class, new SimpleErrorHandler("skip".equals(method)));
    424424    }
     425    if (job.getValue("file") != null)
     426    {
     427      reporterBatcher.setUpdateSource("File: " + ((File)job.getValue("file")).getName());
     428    }
    425429   
    426430    numFeatures = 0;
  • trunk/www/views/reporters/index.jsp

    r3792 r4076  
    4242  import="net.sf.basedb.core.PermissionDeniedException"
    4343  import="net.sf.basedb.core.BaseException"
     44  import="net.sf.basedb.core.User"
    4445  import="net.sf.basedb.util.RemovableUtil"
    4546  import="net.sf.basedb.util.ShareableUtil"
  • trunk/www/views/reporters/list_reporters.jsp

    r3679 r4076  
    243243        exportable="true"
    244244        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"
    245254      />
    246255      <%
     
    424433                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
    425434                <tbl:cell column="lastUpdate" value="<%=item.getLastUpdate()%>" />
     435                <tbl:cell column="lastSource"><%=HTML.encodeTags(item.getLastSource())%></tbl:cell>
    426436                <tbl:cell column="reporterType"
    427437                  ><base:propertyvalue
  • trunk/www/views/reporters/view_reporter.jsp

    r3679 r4076  
    191191        <td><%=dateFormatter.format(reporter.getLastUpdate())%></td>
    192192      </tr>
     193      <tr>
     194        <td class="prompt">Last source</td>
     195        <td><%=HTML.niceFormat(reporter.getLastSource())%></td>
     196      </tr>
    193197      </table>
    194198     
Note: See TracChangeset for help on using the changeset viewer.