Changeset 7015


Ignore:
Timestamp:
Nov 17, 2015, 1:57:57 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #1966: The user that delete an item should see the item in the trashcan

Replaced RemovableData.isRemoved() with RemovableData.getRemovedBy(). Existing classes has been updated to implement the new methods.

The schema update will fix existing items that has been flagged for removal by setting the removedBy property to the owner or to the root user and then removed the removed column from all tables.

Existing code that query the database has been updated to use removedBy instead of removed.

The trashcan still has the old functionality since we only check for NULL/NOT NULL.

Location:
trunk/src/core
Files:
60 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r6996 r7015  
    11631163      SELECT count(*)
    11641164      FROM MessageData msg
    1165       WHERE msg.to = :user AND msg.read = false AND msg.removed = false
     1165      WHERE msg.to = :user AND msg.read = false AND msg.removedBy IS NULL
    11661166    </sql>
    11671167    <description>
     
    13491349      WHERE job.status = :status
    13501350      AND job.type = :type
    1351       AND job.removed = false
     1351      AND job.removedBy IS NULL
    13521352      ORDER BY job.priority ASC, job.scheduled ASC
    13531353    </sql>
     
    13661366      WHERE job.status = :status
    13671367      AND job.type = :type
    1368       AND job.removed = false
     1368      AND job.removedBy IS NULL
    13691369      AND job.pluginDefinition.useInternalJobQueue = true
    13701370      AND job.jobAgentId IS NULL
     
    13841384      FROM JobData job
    13851385      WHERE job.type = :type
    1386       AND job.removed = false
     1386      AND job.removedBy IS NULL
    13871387      AND NOT job.signalTransporter IS NULL
    13881388    </sql>
     
    20322032      SELECT trash
    20332033      FROM net.sf.basedb.core.data.RemovableData trash
    2034       WHERE trash.removed = true
     2034      WHERE NOT trash.removedBy IS NULL
    20352035    </sql>
    20362036    <description>
  • trunk/src/core/net/sf/basedb/core/BioAssaySet.java

    r7002 r7015  
    240240  public boolean isRemoved()
    241241  {
    242     return getData().isRemoved();
     242    return getData().getRemovedBy() != null;
    243243  }
    244244  @Override
     
    247247  {
    248248    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    249     getData().setRemoved(removed);
     249    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    250250  }
    251251  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/BioPlateEventType.java

    r6874 r7015  
    192192  public boolean isRemoved()
    193193  {
    194     return getData().isRemoved();
     194    return getData().getRemovedBy() != null;
    195195  }
    196196  @Override
     
    199199  {
    200200    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    201     getData().setRemoved(removed);
     201    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    202202  }
    203203  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/BioPlateType.java

    r6875 r7015  
    150150  public boolean isRemoved()
    151151  {
    152     return getData().isRemoved();
     152    return getData().getRemovedBy() != null;
    153153  }
    154154  @Override
     
    157157  {
    158158    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    159     getData().setRemoved(removed);
     159    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    160160  }
    161161  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/CommonItem.java

    r6874 r7015  
    8282  public boolean isRemoved()
    8383  {
    84     return getData().isRemoved();
     84    return getData().getRemovedBy() != null;
    8585  }
    8686  @Override
     
    8989  {
    9090    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    91     getData().setRemoved(removed);
     91    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    9292  }
    9393 
  • trunk/src/core/net/sf/basedb/core/DataFileType.java

    r6881 r7015  
    402402  public boolean isRemoved()
    403403  {
    404     return getData().isRemoved();
     404    return getData().getRemovedBy() != null;
    405405  }
    406406  @Override
     
    409409  {
    410410    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    411     getData().setRemoved(removed);
     411    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    412412  }
    413413  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Directory.java

    r6881 r7015  
    506506  public boolean isRemoved()
    507507  {
    508     return getData().isRemoved();
    509   }
    510 
     508    return getData().getRemovedBy() != null;
     509  }
    511510  @Override
    512511  public void setRemoved(boolean removed)
     
    514513  {
    515514    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    516     getData().setRemoved(removed);
     515    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    517516  }
    518517  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/ExtraValueType.java

    r6881 r7015  
    205205  public boolean isRemoved()
    206206  {
    207     return getData().isRemoved();
     207    return getData().getRemovedBy() != null;
    208208  }
    209209  @Override
     
    212212  {
    213213    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    214     getData().setRemoved(removed);
     214    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    215215  }
    216216  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/File.java

    r6898 r7015  
    18211821      data.setCompressed(compress);
    18221822      data.setLocation(Location.PRIMARY.getValue());
    1823       data.setRemoved(false);
     1823      data.setRemovedBy(null);
    18241824      data.setUrl(null);
    18251825      if (md5 != null)
  • trunk/src/core/net/sf/basedb/core/Group.java

    r6881 r7015  
    224224  public boolean isRemoved()
    225225  {
    226     return getData().isRemoved();
     226    return getData().getRemovedBy() != null;
    227227  }
    228228  @Override
     
    231231  {
    232232    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    233     getData().setRemoved(removed);
     233    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    234234  }
    235235  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/HibernateUtil.java

    r6966 r7015  
    476476      {
    477477        log.info("Adding 'isRemoved' filter to "+c.getName());
    478         defineFilter(classTag, itemType, "isRemoved", ":removed = `removed`", filterTemplate);
     478        defineFilter(classTag, itemType, "isRemoved", ":removed <> (`removed_by` IS NULL)", filterTemplate);
    479479      }
    480480      if (AnnotatableData.class.isAssignableFrom(c))
  • trunk/src/core/net/sf/basedb/core/Install.java

    r6996 r7015  
    118118    method.
    119119  */
    120   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(128).intValue();
     120  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(130).intValue();
    121121 
    122122  public static synchronized int createTables(SchemaGenerator.Mode mode, ProgressReporter progress,
  • trunk/src/core/net/sf/basedb/core/InternalJobQueue.java

    r6881 r7015  
    329329        WHERE job.status = :status
    330330        AND job.type = :type
    331         AND job.removed = false
     331        AND job.removedBy IS NULL
    332332        [AND job.pluginDefinition.useInternalJobQueue = true]
    333333        [AND job.jobAgentId IS NULL]
     
    404404        FROM JobData job
    405405        AND job.type = :type
    406         AND job.removed = false
     406        AND job.removedBy IS NULL
    407407        AND NOT job.signalTransporter IS NULL
    408408      */
  • trunk/src/core/net/sf/basedb/core/ItemSubtype.java

    r6898 r7015  
    316316  public boolean isRemoved()
    317317  {
    318     return getData().isRemoved();
     318    return getData().getRemovedBy() != null;
    319319  }
    320320  @Override
     
    323323  {
    324324    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    325     getData().setRemoved(removed);
     325    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    326326  }
    327327  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Message.java

    r6874 r7015  
    146146      SELECT count(*)
    147147      FROM MessageData msg
    148       WHERE msg.to = :user AND msg.read = false AND msg.removed = false
     148      WHERE msg.to = :user AND msg.read = false AND msg.removedBy IS NULL
    149149    */
    150150    query.setInteger("user", user == null ? dc.getSessionControl().getLoggedInUserId() : user.getId());
     
    242242  public boolean isRemoved()
    243243  {
    244     return getData().isRemoved();
     244    return getData().getRemovedBy() != null;
    245245  }
    246246  @Override
     
    249249  {
    250250    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    251     getData().setRemoved(removed);
     251    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    252252  }
    253253  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/MimeType.java

    r6874 r7015  
    225225  public boolean isRemoved()
    226226  {
    227     return getData().isRemoved();
     227    return getData().getRemovedBy() != null;
    228228  }
    229229  @Override
     
    232232  {
    233233    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    234     getData().setRemoved(removed);
     234    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    235235  }
    236236  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/News.java

    r6874 r7015  
    164164  public boolean isRemoved()
    165165  {
    166     return getData().isRemoved();
     166    return getData().getRemovedBy() != null;
    167167  }
    168168  @Override
     
    171171  {
    172172    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    173     getData().setRemoved(removed);
     173    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    174174  }
    175175  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/PlateEventType.java

    r6881 r7015  
    189189  public boolean isRemoved()
    190190  {
    191     return getData().isRemoved();
     191    return getData().getRemovedBy() != null;
    192192  }
    193193  @Override
     
    196196  {
    197197    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    198     getData().setRemoved(removed);
     198    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    199199  }
    200200  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/PlateGeometry.java

    r6881 r7015  
    168168  public boolean isRemoved()
    169169  {
    170     return getData().isRemoved();
     170    return getData().getRemovedBy() != null;
    171171  }
    172172  @Override
     
    175175  {
    176176    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    177     getData().setRemoved(removed);
     177    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    178178  }
    179179  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Platform.java

    r6881 r7015  
    250250  public boolean isRemoved()
    251251  {
    252     return getData().isRemoved();
     252    return getData().getRemovedBy() != null;
    253253  }
    254254  @Override
     
    257257  {
    258258    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    259     getData().setRemoved(removed);
     259    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    260260  }
    261261  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/PlatformVariant.java

    r6881 r7015  
    252252  public boolean isRemoved()
    253253  {
    254     return getData().isRemoved();
     254    return getData().getRemovedBy() != null;
    255255  }
    256256  @Override
     
    259259  {
    260260    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    261     getData().setRemoved(removed);
     261    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    262262  }
    263263  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/PluginDefinition.java

    r6898 r7015  
    459459  public boolean isRemoved()
    460460  {
    461     return getData().isRemoved();
     461    return getData().getRemovedBy() != null;
    462462  }
    463463  @Override
     
    466466  {
    467467    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    468     getData().setRemoved(removed);
     468    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    469469  }
    470470  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/PluginType.java

    r6875 r7015  
    224224  public boolean isRemoved()
    225225  {
    226     return getData().isRemoved();
     226    return getData().getRemovedBy() != null;
    227227  }
    228228  @Override
     
    231231  {
    232232    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    233     getData().setRemoved(removed);
     233    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    234234  }
    235235  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Project.java

    r6875 r7015  
    211211  public boolean isRemoved()
    212212  {
    213     return getData().isRemoved();
     213    return getData().getRemovedBy() != null;
    214214  }
    215215  @Override
     
    218218  {
    219219    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    220     getData().setRemoved(removed);
     220    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    221221  }
    222222  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Quantity.java

    r6898 r7015  
    419419  public boolean isRemoved()
    420420  {
    421     return getData().isRemoved();
     421    return getData().getRemovedBy() != null;
    422422  }
    423423  @Override
     
    426426  {
    427427    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    428     getData().setRemoved(removed);
     428    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    429429  }
    430430  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Quota.java

    r6881 r7015  
    214214  public boolean isRemoved()
    215215  {
    216     return getData().isRemoved();
     216    return getData().getRemovedBy() != null;
    217217  }
    218218  @Override
     
    221221  {
    222222    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    223     getData().setRemoved(removed);
     223    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    224224  }
    225225  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/ReporterType.java

    r6881 r7015  
    167167  public boolean isRemoved()
    168168  {
    169     return getData().isRemoved();
     169    return getData().getRemovedBy() != null;
    170170  }
    171171  @Override
     
    174174  {
    175175    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    176     getData().setRemoved(removed);
     176    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    177177  }
    178178  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Role.java

    r6874 r7015  
    219219  public boolean isRemoved()
    220220  {
    221     return getData().isRemoved();
     221    return getData().getRemovedBy() != null;
    222222  }
    223223  @Override
     
    226226  {
    227227    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    228     getData().setRemoved(removed);
     228    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    229229  }
    230230  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/SessionControl.java

    r7014 r7015  
    452452    }
    453453   
    454     if (userData.isRemoved())
     454    if (userData.getRemovedBy() != null)
    455455    {
    456456      throw new PermissionDeniedException("The user with login '" + login + "' is flagged for deletion."); 
  • trunk/src/core/net/sf/basedb/core/Transformation.java

    r6874 r7015  
    216216  public boolean isRemoved()
    217217  {
    218     return getData().isRemoved();
     218    return getData().getRemovedBy() != null;
    219219  }
    220220  @Override
     
    223223  {
    224224    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    225     getData().setRemoved(removed);
     225    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    226226  }
    227227  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Trashcan.java

    r6954 r7015  
    104104            org.hibernate.Query query = HibernateUtil.createQuery(session,
    105105              "SELECT trash FROM " + item.getDataClass().getName() + " trash " +
    106               "WHERE trash.removed = TRUE");
     106              "WHERE NOT trash.removedBy IS NULL");
    107107            removed.addAll(HibernateUtil.loadList(RemovableData.class, query, sc));
    108108          }
     
    115115          SELECT trash
    116116          FROM RemovableData trash
    117           WHERE trash.removed
     117          WHERE NOT trash.removedBy IS NULL
    118118        */
    119119        removed = HibernateUtil.loadList(RemovableData.class, query, sc);
  • trunk/src/core/net/sf/basedb/core/Unit.java

    r6941 r7015  
    255255  public boolean isRemoved()
    256256  {
    257     return getData().isRemoved();
     257    return getData().getRemovedBy() != null;
    258258  }
    259259  @Override
     
    262262  {
    263263    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    264     getData().setRemoved(removed);
     264    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    265265  }
    266266  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/Update.java

    r6989 r7015  
    2929import java.util.HashSet;
    3030import java.util.Iterator;
     31import java.util.LinkedHashMap;
    3132import java.util.LinkedHashSet;
    3233import java.util.List;
     
    5960import net.sf.basedb.core.data.QuantityData;
    6061import net.sf.basedb.core.data.RawBioAssayData;
     62import net.sf.basedb.core.data.RemovableData;
    6163import net.sf.basedb.core.data.ReporterCloneTemplateData;
    6264import net.sf.basedb.core.data.RoleKeyData;
     
    292294    </td>
    293295  </tr>
     296  <tr>
     297    <td>129 and 130</td>
     298    <td>
     299      Added {@link RemovableData#getRemovedBy()} and removed <code>RemovableData.isRemoved()</code>.
     300      Existing items that has been flagged for removal are updated by setting the <code>removedBy</code>
     301      property to either the owner of the item or, if the item doesn't have an owner, to the root
     302      user (update 129). In a second step (update 130) the <code>removed</code> columns are dropped
     303      from all tables.
     304    </td>
     305  </tr>
    294306  </table>
    295307
     
    475487        schemaVersion = setSchemaVersionInTransaction(session, 128);
    476488        progress_current += 2 * progress_step;
     489      }
     490     
     491      if (schemaVersion < 130)
     492      {
     493        if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 130...");
     494        schemaVersion = updateToSchemaVersion130(session, schemaVersion);
     495        progress_current += 2 * progress_step;       
    477496      }
    478497   
     
    15321551 
    15331552  /**
     1553    Set the 'removed_by' column to owner of item if 'removed=true'
     1554    @return The new schema version (=130)
     1555  */
     1556  private static int updateToSchemaVersion130(org.hibernate.Session session, int currentSchemaVersion)
     1557    throws BaseException
     1558  {
     1559    final int schemaVersion = 130;
     1560    try
     1561    {
     1562      // Load tables names and set a flag if it has an 'owner' column or not
     1563      Map<String, Boolean> tables = new LinkedHashMap<String, Boolean>();
     1564      for (Item item : Metadata.getRemovableItems())
     1565      {
     1566        String tableName = HibernateUtil.getClassMapping(item.getDataClass().getName()).getRootTable().getName();
     1567        // Multiple items may be mapped to the same table (eg. BioMaterials) -- Only add each table once
     1568        if (!tables.containsKey(tableName))
     1569        {
     1570          // Check if 'removed' column exists
     1571          // It is not present in new tables (eg. Kits)
     1572          TableInfo tblInfo = getTableInfo(session, tableName);
     1573          if (tblInfo.findColumn("removed") != null)
     1574          {
     1575            tables.put(tableName, tblInfo.findColumn("owner") != null);
     1576          }
     1577        }
     1578      }
     1579     
     1580      if (currentSchemaVersion < 129)
     1581      {
     1582        // First step is to copy existing information to the new columns
     1583        org.hibernate.Transaction tx = null;
     1584        try
     1585        {
     1586          tx = HibernateUtil.newTransaction(session);
     1587         
     1588          int rootId = SystemItems.getId(User.ROOT);
     1589          for (Map.Entry<String, Boolean> entry : tables.entrySet())
     1590          {
     1591            String tableName = entry.getKey();
     1592           
     1593            org.hibernate.Query query;
     1594            if (entry.getValue())
     1595            {
     1596              String sql = "UPDATE [" + tableName + "] SET [removed_by]=[owner] WHERE [removed]=true";
     1597              query = HibernateUtil.createSqlQuery(session, sql);
     1598            }
     1599            else
     1600            {
     1601              String sql = "UPDATE [" + tableName + "] SET [removed_by]=:root WHERE [removed]=true";
     1602              query = HibernateUtil.createSqlQuery(session, sql);
     1603              query.setInteger("root", rootId);
     1604            }
     1605            int updated = query.executeUpdate();
     1606          }
     1607         
     1608          setSchemaVersion(session, 129);
     1609 
     1610          // Commit the changes
     1611          HibernateUtil.commit(tx);
     1612        }
     1613        finally
     1614        {
     1615          if (tx != null && !tx.wasCommitted()) HibernateUtil.rollback(tx);
     1616        }
     1617      }
     1618     
     1619      // Second step is to drop the old columns that are no longer used in BASE 3.7
     1620      for (String tableName : tables.keySet())
     1621      {
     1622        dropColumn(session, tableName, "removed", null);
     1623      }
     1624       
     1625      // Update the schema version number
     1626      setSchemaVersionInTransaction(session, schemaVersion);
     1627 
     1628      log.info("updateToSchemaVersion130: OK");
     1629    }
     1630    catch (SQLException ex)
     1631    {
     1632      log.error("updateToSchemaVersion130: FAILED", ex);
     1633      throw new BaseException(ex);
     1634    }
     1635    catch (RuntimeException ex)
     1636    {
     1637      log.error("updateToSchemaVersion130: FAILED", ex);
     1638      throw ex;
     1639    }   
     1640   
     1641    return schemaVersion;
     1642  }
     1643
     1644 
     1645  /**
    15341646    Vefify and update the remaining quantity of all biomaterials.
    15351647    @return The number of biomaterial fixed
  • trunk/src/core/net/sf/basedb/core/User.java

    r6881 r7015  
    336336  public boolean isRemoved()
    337337  {
    338     return getData().isRemoved();
     338    return getData().getRemovedBy() != null;
    339339  }
    340340  @Override
     
    343343  {
    344344    checkPermission(removed ? Permission.DELETE : Permission.WRITE);
    345     getData().setRemoved(removed);
     345    getData().setRemovedBy(removed ? getSessionControl().getLoggedInUserId() : null);
    346346  }
    347347  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/BioAssaySetData.java

    r6127 r7015  
    8080    -------------------------------------------
    8181  */
    82   private boolean removed;
    83   @Override
    84   public boolean isRemoved()
    85   {
    86     return removed;
    87   }
    88   @Override
    89   public void setRemoved(boolean removed)
    90   {
    91     this.removed = removed;
     82  private Integer removedBy;
     83  @Override
     84  public Integer getRemovedBy()
     85  {
     86    return removedBy;
     87  }
     88  @Override
     89  public void setRemovedBy(Integer removedBy)
     90  {
     91    this.removedBy = removedBy;
    9292  }
    9393  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/BioPlateEventTypeData.java

    r6127 r7015  
    7575    -------------------------------------------
    7676  */
    77   private boolean removed;
     77  private Integer removedBy;
    7878  @Override
    79   public boolean isRemoved()
     79  public Integer getRemovedBy()
    8080  {
    81     return removed;
     81    return removedBy;
    8282  }
    8383  @Override
    84   public void setRemoved(boolean removed)
     84  public void setRemovedBy(Integer removedBy)
    8585  {
    86     this.removed = removed;
     86    this.removedBy = removedBy;
    8787  }
    8888  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/BioPlateTypeData.java

    r6056 r7015  
    7373    -------------------------------------------
    7474  */
    75   private boolean removed;
     75  private Integer removedBy;
    7676  @Override
    77   public boolean isRemoved()
     77  public Integer getRemovedBy()
    7878  {
    79     return removed;
     79    return removedBy;
    8080  }
    8181  @Override
    82   public void setRemoved(boolean removed)
     82  public void setRemovedBy(Integer removedBy)
    8383  {
    84     this.removed = removed;
     84    this.removedBy = removedBy;
    8585  }
    8686  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/CommonData.java

    r6127 r7015  
    7070    -------------------------------------------
    7171  */
    72   private boolean removed;
     72  private Integer removedBy;
    7373  @Override
    74   public boolean isRemoved()
     74  public Integer getRemovedBy()
    7575  {
    76     return removed;
     76    return removedBy;
    7777  }
    7878  @Override
    79   public void setRemoved(boolean removed)
     79  public void setRemovedBy(Integer removedBy)
    8080  {
    81     this.removed = removed;
     81    this.removedBy = removedBy;
    8282  }
    8383  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/DataFileTypeData.java

    r6127 r7015  
    7676    -------------------------------------------
    7777  */
    78   private boolean removed;
    79   @Override
    80   public boolean isRemoved()
    81   {
    82     return removed;
    83   }
    84   @Override
    85   public void setRemoved(boolean removed)
    86   {
    87     this.removed = removed;
     78  private Integer removedBy;
     79  @Override
     80  public Integer getRemovedBy()
     81  {
     82    return removedBy;
     83  }
     84  @Override
     85  public void setRemovedBy(Integer removedBy)
     86  {
     87    this.removedBy = removedBy;
    8888  }
    8989  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/ExtraValueTypeData.java

    r6127 r7015  
    7777    -------------------------------------------
    7878  */
    79   private boolean removed;
    80   @Override
    81   public boolean isRemoved()
    82   {
    83     return removed;
    84   }
    85   @Override
    86   public void setRemoved(boolean removed)
    87   {
    88     this.removed = removed;
     79  private Integer removedBy;
     80  @Override
     81  public Integer getRemovedBy()
     82  {
     83    return removedBy;
     84  }
     85  @Override
     86  public void setRemovedBy(Integer removedBy)
     87  {
     88    this.removedBy = removedBy;
    8989  }
    9090  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/GroupData.java

    r6127 r7015  
    7878    -------------------------------------------
    7979  */
    80   private boolean removed;
    81   @Override
    82   public boolean isRemoved()
    83   {
    84     return removed;
    85   }
    86   @Override
    87   public void setRemoved(boolean removed)
    88   {
    89     this.removed = removed;
     80  private Integer removedBy;
     81  @Override
     82  public Integer getRemovedBy()
     83  {
     84    return removedBy;
     85  }
     86  @Override
     87  public void setRemovedBy(Integer removedBy)
     88  {
     89    this.removedBy = removedBy;
    9090  }
    9191  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/ItemSubtypeData.java

    r6468 r7015  
    8383    -------------------------------------------
    8484  */
    85   private boolean removed;
    86   @Override
    87   public boolean isRemoved()
    88   {
    89     return removed;
    90   }
    91   @Override
    92   public void setRemoved(boolean removed)
    93   {
    94     this.removed = removed;
     85  private Integer removedBy;
     86  @Override
     87  public Integer getRemovedBy()
     88  {
     89    return removedBy;
     90  }
     91  @Override
     92  public void setRemovedBy(Integer removedBy)
     93  {
     94    this.removedBy = removedBy;
    9595  }
    9696  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/MessageData.java

    r6127 r7015  
    7676    -------------------------------------------
    7777  */
    78   private boolean removed;
     78  private Integer removedBy;
    7979  @Override
    80   public boolean isRemoved()
     80  public Integer getRemovedBy()
    8181  {
    82     return removed;
     82    return removedBy;
    8383  }
    8484  @Override
    85   public void setRemoved(boolean removed)
     85  public void setRemovedBy(Integer removedBy)
    8686  {
    87     this.removed = removed;
     87    this.removedBy = removedBy;
    8888  }
    8989  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/MimeTypeData.java

    r6127 r7015  
    7777    -------------------------------------------
    7878  */
    79   private boolean removed;
     79  private Integer removedBy;
    8080  @Override
    81   public boolean isRemoved()
     81  public Integer getRemovedBy()
    8282  {
    83     return removed;
     83    return removedBy;
    8484  }
    8585  @Override
    86   public void setRemoved(boolean removed)
     86  public void setRemovedBy(Integer removedBy)
    8787  {
    88     this.removed = removed;
     88    this.removedBy = removedBy;
    8989  }
    9090  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/NewsData.java

    r6127 r7015  
    7676    -------------------------------------------
    7777  */
    78   private boolean removed;
     78  private Integer removedBy;
    7979  @Override
    80   public boolean isRemoved()
     80  public Integer getRemovedBy()
    8181  {
    82     return removed;
     82    return removedBy;
    8383  }
    8484  @Override
    85   public void setRemoved(boolean removed)
     85  public void setRemovedBy(Integer removedBy)
    8686  {
    87     this.removed = removed;
     87    this.removedBy = removedBy;
    8888  }
    8989  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/PlateEventTypeData.java

    r6127 r7015  
    7474    -------------------------------------------
    7575  */
    76   private boolean removed;
     76  private Integer removedBy;
    7777  @Override
    78   public boolean isRemoved()
     78  public Integer getRemovedBy()
    7979  {
    80     return removed;
     80    return removedBy;
    8181  }
    8282  @Override
    83   public void setRemoved(boolean removed)
     83  public void setRemovedBy(Integer removedBy)
    8484  {
    85     this.removed = removed;
     85    this.removedBy = removedBy;
    8686  }
    8787  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/PlateGeometryData.java

    r6127 r7015  
    7575    -------------------------------------------
    7676  */
    77   private boolean removed;
     77  private Integer removedBy;
    7878  @Override
    79   public boolean isRemoved()
     79  public Integer getRemovedBy()
    8080  {
    81     return removed;
     81    return removedBy;
    8282  }
    8383  @Override
    84   public void setRemoved(boolean removed)
     84  public void setRemovedBy(Integer removedBy)
    8585  {
    86     this.removed = removed;
     86    this.removedBy = removedBy;
    8787  }
    8888  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/PlatformData.java

    r6127 r7015  
    7676    -------------------------------------------
    7777  */
    78   private boolean removed;
     78  private Integer removedBy;
    7979  @Override
    80   public boolean isRemoved()
     80  public Integer getRemovedBy()
    8181  {
    82     return removed;
     82    return removedBy;
    8383  }
    8484  @Override
    85   public void setRemoved(boolean removed)
     85  public void setRemovedBy(Integer removedBy)
    8686  {
    87     this.removed = removed;
     87    this.removedBy = removedBy;
    8888  }
    8989  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/PlatformVariantData.java

    r6127 r7015  
    7474    -------------------------------------------
    7575  */
    76   private boolean removed;
     76  private Integer removedBy;
    7777  @Override
    78   public boolean isRemoved()
     78  public Integer getRemovedBy()
    7979  {
    80     return removed;
     80    return removedBy;
    8181  }
    8282  @Override
    83   public void setRemoved(boolean removed)
     83  public void setRemovedBy(Integer removedBy)
    8484  {
    85     this.removed = removed;
     85    this.removedBy = removedBy;
    8686  }
    8787  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/PluginDefinitionData.java

    r6127 r7015  
    5353    -------------------------------------------
    5454  */
    55   private boolean removed;
    56   @Override
    57   public boolean isRemoved()
    58   {
    59     return removed;
    60   }
    61   @Override
    62   public void setRemoved(boolean removed)
    63   {
    64     this.removed = removed;
     55  private Integer removedBy;
     56  @Override
     57  public Integer getRemovedBy()
     58  {
     59    return removedBy;
     60  }
     61  @Override
     62  public void setRemovedBy(Integer removedBy)
     63  {
     64    this.removedBy = removedBy;
    6565  }
    6666  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/PluginTypeData.java

    r6127 r7015  
    7575    -------------------------------------------
    7676  */
    77   private boolean removed;
     77  private Integer removedBy;
    7878  @Override
    79   public boolean isRemoved()
     79  public Integer getRemovedBy()
    8080  {
    81     return removed;
     81    return removedBy;
    8282  }
    8383  @Override
    84   public void setRemoved(boolean removed)
     84  public void setRemovedBy(Integer removedBy)
    8585  {
    86     this.removed = removed;
     86    this.removedBy = removedBy;
    8787  }
    8888  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/ProjectData.java

    r6127 r7015  
    7777    -------------------------------------------
    7878  */
    79   private boolean removed;
    80   @Override
    81   public boolean isRemoved()
    82   {
    83     return removed;
    84   }
    85   @Override
    86   public void setRemoved(boolean removed)
    87   {
    88     this.removed = removed;
     79  private Integer removedBy;
     80  @Override
     81  public Integer getRemovedBy()
     82  {
     83    return removedBy;
     84  }
     85  @Override
     86  public void setRemovedBy(Integer removedBy)
     87  {
     88    this.removedBy = removedBy;
    8989  }
    9090  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/QuantityData.java

    r6127 r7015  
    7272    -------------------------------------------
    7373  */
    74   private boolean removed;
     74  private Integer removedBy;
    7575  @Override
    76   public boolean isRemoved()
     76  public Integer getRemovedBy()
    7777  {
    78     return removed;
     78    return removedBy;
    7979  }
    8080  @Override
    81   public void setRemoved(boolean removed)
     81  public void setRemovedBy(Integer removedBy)
    8282  {
    83     this.removed = removed;
     83    this.removedBy = removedBy;
    8484  }
    8585  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/QuotaData.java

    r6468 r7015  
    4848    -------------------------------------------
    4949  */
    50   private boolean removed;
     50  private Integer removedBy;
    5151  @Override
    52   public boolean isRemoved()
     52  public Integer getRemovedBy()
    5353  {
    54     return removed;
     54    return removedBy;
    5555  }
    5656  @Override
    57   public void setRemoved(boolean removed)
     57  public void setRemovedBy(Integer removedBy)
    5858  {
    59     this.removed = removed;
     59    this.removedBy = removedBy;
    6060  }
    6161  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/RemovableData.java

    r5818 r7015  
    3636  <p>
    3737  This interface defines Hibernate database mapping for the
    38   <code>removed</code> property to a database column with the same
    39   name. If a subclass wants to map these properties to other columns,
    40   it should override the {@link #isRemoved()} method and add a
     38  <code>removedBy</code> property to the database column <code>removed_by</code>.
     39  The column is an integer column holding the ID of the user that
     40  flagged the item or null if the item has not been flagged.
     41  <p>
     42  If a subclass wants to map these properties to other columns,
     43  it should override the {@link #getRemovedBy()} method and add a
    4144  Hibernate tag in the comment.
    4245  <p>
     
    4447  <b>Reference implementation</b><br>
    4548  <pre class="code">
    46 private boolean removed;
    47 public boolean isRemoved()
     49private Integer removedBy;
     50public Integer getRemovedBy()
    4851{
    49    return removed;
     52   return removedBy;
    5053}
    51 public void setRemoved(boolean removed)
     54public void setRemovedBy(Integer userId)
    5255{
    53    this.removed = removed;
     56   this.removedBy = userId;
    5457}
    5558</pre>
     
    6467
    6568  /**
    66     Check if the removed flag is set for this item.
    67     @return TRUE if the item is flagged as removed, FALSE otherwise
    68     @hibernate.property column="`removed`" type="boolean" not-null="true"
     69    Get the ID of the user that removed this item.
     70    @return The ID of a user or null if the item is not removed
     71    @since 3.7
     72    @hibernate.property column="`removed_by`" type="int" not-null="false"
    6973  */
    70   public boolean isRemoved();
     74  public Integer getRemovedBy();
    7175
    7276  /**
    73     Set the removed flag for this item.
    74     @param removed TRUE if the item should be flagged as removed,
    75       FALSE otherwise
     77    Set the ID of the user that removed this item or null
     78    to restore the item.
     79    @since 3.7
    7680  */
    77   public void setRemoved(boolean removed);
    78 
     81  public void setRemovedBy(Integer userId);
     82 
    7983}
  • trunk/src/core/net/sf/basedb/core/data/ReporterTypeData.java

    r6127 r7015  
    7979    -------------------------------------------
    8080  */
    81   private boolean removed;
     81  private Integer removedBy;
    8282  @Override
    83   public boolean isRemoved()
     83  public Integer getRemovedBy()
    8484  {
    85     return removed;
     85    return removedBy;
    8686  }
    8787  @Override
    88   public void setRemoved(boolean removed)
     88  public void setRemovedBy(Integer removedBy)
    8989  {
    90     this.removed = removed;
     90    this.removedBy = removedBy;
    9191  }
    9292  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/RoleData.java

    r6127 r7015  
    7777    -------------------------------------------
    7878  */
    79   private boolean removed;
     79  private Integer removedBy;
    8080  @Override
    81   public boolean isRemoved()
     81  public Integer getRemovedBy()
    8282  {
    83     return removed;
     83    return removedBy;
    8484  }
    8585  @Override
    86   public void setRemoved(boolean removed)
     86  public void setRemovedBy(Integer removedBy)
    8787  {
    88     this.removed = removed;
     88    this.removedBy = removedBy;
    8989  }
    9090  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/TransformationData.java

    r6127 r7015  
    7777    -------------------------------------------
    7878  */
    79   private boolean removed;
     79  private Integer removedBy;
    8080  @Override
    81   public boolean isRemoved()
     81  public Integer getRemovedBy()
    8282  {
    83     return removed;
     83    return removedBy;
    8484  }
    8585  @Override
    86   public void setRemoved(boolean removed)
     86  public void setRemovedBy(Integer removedBy)
    8787  {
    88     this.removed = removed;
     88    this.removedBy = removedBy;
    8989  }
    9090  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/UnitData.java

    r6127 r7015  
    8585    -------------------------------------------
    8686  */
    87   private boolean removed;
    88   @Override
    89   public boolean isRemoved()
    90   {
    91     return removed;
    92   }
    93   @Override
    94   public void setRemoved(boolean removed)
    95   {
    96     this.removed = removed;
     87  private Integer removedBy;
     88  @Override
     89  public Integer getRemovedBy()
     90  {
     91    return removedBy;
     92  }
     93  @Override
     94  public void setRemovedBy(Integer removedBy)
     95  {
     96    this.removedBy = removedBy;
    9797  }
    9898  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/data/UserData.java

    r6356 r7015  
    9696    -------------------------------------------
    9797  */
    98   private boolean removed = false;
    99   @Override
    100   public boolean isRemoved()
    101   {
    102     return removed;
    103   }
    104   @Override
    105   public void setRemoved(boolean removed)
    106   {
    107     this.removed = removed;
     98  private Integer removedBy;
     99  @Override
     100  public Integer getRemovedBy()
     101  {
     102    return removedBy;
     103  }
     104  @Override
     105  public void setRemovedBy(Integer removedBy)
     106  {
     107    this.removedBy = removedBy;
    108108  }
    109109  // -------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.