Changeset 5789


Ignore:
Timestamp:
Dec 13, 2019, 1:58:52 PM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #1217: DoNotUse? flags and comments should be copied to new child items

Implemented ReggieItem.copyDoNotUseAnnotations() as a helper method to copy DoNotUse annotations from one item to another.

Temporarily marked the current child name generator methods as deprecated to make it easier to find all places where new child items are created (assuming that all places that create child items are using one of the methods).

Location:
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Annotationtype.java

    r5774 r5789  
    22492249   
    22502250    // Copy the values
    2251     to.getAnnotationSet().getAnnotation(at).setValuesIfDifferent(annotations, null);
    2252     return true;
     2251    return to.getAnnotationSet().getAnnotation(at).setValuesIfDifferent(annotations, null);
    22532252  }
    22542253
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/ReggieItem.java

    r5777 r5789  
    247247  }
    248248 
     249 
     250  /**
     251    Helper method to copy all DoNotUse-related annotations from this item to the other.
     252    @param force TRUE to overwrite existing annotations, FALSE to not
     253    @return TRUE if any of the information was changed, FALSE if not
     254    @since 4.25
     255  */
     256  public boolean copyDoNotUseAnnotations(DbControl dc, Annotatable to, boolean force)
     257  {
     258    boolean copiedFlag = Annotationtype.DO_NOT_USE.copyAnnotationValues(dc, item, to, force);
     259    boolean copiedComment = Annotationtype.DO_NOT_USE_COMMENT.copyAnnotationValues(dc, item, to, force);
     260    return copiedFlag || copiedComment;
     261  }
     262
     263 
    249264  /**
    250265    Utility method for finding parent biomaterial of the specified subtypes
     
    332347  }
    333348 
     349  // TODO - remove once we have found all places that create child items
     350  @Deprecated
    334351  protected String getNextChildItemName(DbControl dc, ItemQuery<? extends Nameable> childQuery, String suffix, boolean releaseIfTransactionFails)
    335352  {
     
    357374    wizard. This may lead to "holes" in the child names if a wizard is not
    358375    completed, but there is no easy solution for that.
    359     TODO -- should we check before saving if the name exists?
    360376   
    361377    Calling this method more than once within the same transaction
     
    363379    @since 4.19
    364380  */
     381  // TODO - remove once we have found all places that create child items
     382  @Deprecated
    365383  public static String getNextChildItemName(DbControl dc, String parentName, ItemQuery<? extends Nameable> childQuery, String suffix, boolean releaseIfTransactionFails)
    366384  {
Note: See TracChangeset for help on using the changeset viewer.