Changeset 7638


Ignore:
Timestamp:
Mar 11, 2019, 12:51:33 PM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #2136: Remove support for spot images

Removed things related to spot images from the BASE core. The schema update will drop the "SpotImages?" table.

Location:
trunk/src
Files:
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java

    r7511 r7638  
    162162    All items which permissions depend on some other item only.
    163163  */
    164   @SuppressWarnings("deprecation")
    165164  private static final Set<Item> ignored = EnumSet.of(
    166165    Item.SYSTEM, Item.HELP,
     
    170169    Item.PLATEEVENT, Item.PLATEEVENTTYPE, Item.WELL,
    171170    Item.ARRAYDESIGNBLOCK, Item.FEATURE, Item.ARRAYDESIGNPLATE,
    172     Item.SPOTIMAGES, Item.RAWDATA,
     171    Item.RAWDATA,
    173172    Item.BIOASSAYSET, Item.BIOASSAY, Item.TRANSFORMATION, Item.EXTRAVALUE,
    174173    Item.VIRTUALDB, Item.DATACUBE, Item.DATACUBELAYER, Item.DATACUBECOLUMN, Item.DATACUBEFILTER,
  • trunk/src/core/common-queries.xml

    r7408 r7638  
    925925  </query>
    926926
    927   <query id="GET_SPOTIMAGES_FOR_FILE" type="HQL">
    928     <sql>
    929       SELECT {1}
    930       FROM SpotImagesData spi
    931       WHERE spi.redImageFile = :file
    932       OR spi.greenImageFile = :file
    933       OR spi.blueImageFile = :file
    934       OR spi.spotImagesFile = :file
    935     </sql>
    936     <description>
    937       A Hibernate query that gets spot images where a given
    938       file is used as one of the color components or holds the generated spot images.
    939     </description>
    940   </query>
    941  
    942927  <query id="GET_FILESETMEMBERS_FOR_FILE" type="HQL">
    943928    <sql>
  • trunk/src/core/net/sf/basedb/core/File.java

    r7623 r7638  
    550550      used = HibernateUtil.loadData(query2) > 0;
    551551    }
    552     if (!used)
    553     {
    554       org.hibernate.query.Query<Long> query2 = HibernateUtil.getPredefinedQuery(session,
    555         "GET_SPOTIMAGES_FOR_FILE", Long.class, "count(*)");
    556       /*
    557         SELECT {1}
    558         FROM SpotImagesData spi
    559         WHERE spi.redImageFile = :file
    560         OR spi.greenImageFile = :file
    561         OR spi.blueImageFile = :file
    562         OR spi.spotImagesFile = :file
    563       */
    564       query2.setParameter("file", getId(), TypeWrapper.H_INTEGER);
    565       used = HibernateUtil.loadData(query2) > 0;
    566     }
    567552    return used || super.isUsed();
    568553  }
     
    571556    <ul>
    572557    <li>{@link FileAttachable} items with this file attached
    573     <li>{@link SpotImages} using this file
    574558    </ul>
    575559    @since 2.2
    576560  */
    577   @SuppressWarnings("deprecation")
    578561  @Override
    579562  public Set<ItemProxy> getUsingItems()
     
    616599    }   
    617600   
    618     // SpotImages
    619     org.hibernate.query.Query<Integer> query3 = HibernateUtil.getPredefinedQuery(session,
    620       "GET_SPOTIMAGES_FOR_FILE", Integer.class, "spi.id");
    621       /*
    622         SELECT {1}
    623         FROM SpotImagesData spi
    624         WHERE spi.redImageFile = :file
    625         OR spi.greenImageFile = :file
    626         OR spi.blueImageFile = :file
    627         OR spi.spotImagesFile = :file
    628       */
    629     query3.setParameter("file", getId(), TypeWrapper.H_INTEGER);
    630     addUsingItems(using, Item.SPOTIMAGES, query3);
    631 
    632601    return using;
    633602  }
  • trunk/src/core/net/sf/basedb/core/Install.java

    r7615 r7638  
    119119    method.
    120120  */
    121   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(145).intValue();
     121  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(147).intValue();
    122122 
    123123  public static synchronized int createTables(SchemaGenerator.Mode mode, ProgressReporter progress,
  • trunk/src/core/net/sf/basedb/core/Item.java

    r7610 r7638  
    503503    300),
    504504   
    505   /**
    506     The item is a {@link SpotImages}.
    507     @deprecated In 3.14, will be removed in the future without replacement
    508   */
    509   @Deprecated
    510   SPOTIMAGES(265, "Spot images", "spi", SpotImages.class, SpotImagesData.class, null,
    511     310),
    512505  /**
    513506    The item is a {@link RawData} spot.
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r7511 r7638  
    3131import net.sf.basedb.core.data.ReporterData;
    3232import net.sf.basedb.core.data.SoftwareData;
    33 import net.sf.basedb.core.data.SpotImagesData;
    3433import net.sf.basedb.core.hibernate.TypeWrapper;
    3534import net.sf.basedb.core.query.Restrictions;
     
    924923  }
    925924 
    926   /**
    927     Get the {@link SpotImages} item used to generate spot images
    928     for this raw bioassay. If no <code>SpotImages</code> exists
    929     a new one is created, and is automatically saved to the database (if
    930     commit is called).
    931 
    932     @return The <code>SpotImages</code> item
    933     @throws PermissionDeniedException If logged in user doesn't have read permission to the spot images.
    934     @throws BaseException If there is some kind of error.
    935     @see #hasSpotImages()
    936     @deprecated In 3.14, will be removed in the future without replacement
    937   */
    938   @Deprecated
    939   public SpotImages getSpotImages()
    940     throws PermissionDeniedException, BaseException
    941   {
    942     SpotImagesData spi = getData().getSpotImages();
    943     SpotImages spotImages = null;
    944     if (spi == null)
    945     {
    946       spotImages = SpotImages.getNew(getDbControl(), this);
    947       getDbControl().saveItemIf(this, spotImages, false);
    948     }
    949     else
    950     {
    951       spotImages = getDbControl().getItem(SpotImages.class, spi);
    952     }
    953     return spotImages;
    954   }
    955  
    956   /**
    957     Check if spot images exists for this raw bioassay or not.
    958     @see #getSpotImages()
    959     @deprecated In 3.14, will be removed in the future without replacement
    960   */
    961   @Deprecated
    962   public boolean hasSpotImages()
    963   {
    964     return getData().getSpotImages() != null;
    965   }
    966 
    967925  /**
    968926    Get the value for the raw data header with the specified name.
  • trunk/src/core/net/sf/basedb/core/Update.java

    r7637 r7638  
    704704      }
    705705     
    706       if (schemaVersion < 146)
    707       {
    708         if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 146...");
    709         schemaVersion = updateToSchemaVersion146(session, schemaVersion);
     706      if (schemaVersion < 147)
     707      {
     708        if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 147...");
     709        schemaVersion = updateToSchemaVersion147(session, schemaVersion);
    710710        progress_current += progress_step;
    711711      }
     
    21892189  /**
    21902190   
    2191     @return The new schema version (=146)
     2191    @return The new schema version (=147)
    21922192  */
    2193   private static int updateToSchemaVersion146(org.hibernate.Session session, int currentSchemaVersion)
     2193  private static int updateToSchemaVersion147(org.hibernate.Session session, int currentSchemaVersion)
    21942194    throws BaseException
    21952195  {
    2196     final int schemaVersion = 146;
    2197     org.hibernate.Transaction tx = null;
    2198    
    2199     try
    2200     {
    2201       tx = HibernateUtil.newTransaction(session);
    2202 
    2203       org.hibernate.query.Query<?> query = HibernateUtil.createQuery(session,
    2204         "UPDATE PluginDefinitionData " +
    2205         "SET disabled = true, name = CONCAT(name, ' (deprecated)') " +
    2206         "WHERE className='net.sf.basedb.plugins.SpotImageCreator'");
    2207       query.executeUpdate();
     2196    final int schemaVersion = 147;
     2197    try
     2198    {
     2199     
     2200      if (currentSchemaVersion < 146)
     2201      {
     2202        // First step is to update existing information
     2203        org.hibernate.Transaction tx = null;
     2204        try
     2205        {
     2206          tx = HibernateUtil.newTransaction(session);
     2207         
     2208          org.hibernate.query.Query<?> query = HibernateUtil.createQuery(session,
     2209              "UPDATE PluginDefinitionData " +
     2210              "SET disabled = true, name = CONCAT(name, ' (deprecated)') " +
     2211              "WHERE className='net.sf.basedb.plugins.SpotImageCreator'");
     2212            query.executeUpdate();
     2213         
     2214          setSchemaVersion(session, 146);
     2215         
     2216          // Commit the changes
     2217          HibernateUtil.commit(tx);
     2218        }
     2219        finally
     2220        {
     2221          if (tx != null && tx.getStatus() != TransactionStatus.COMMITTED) HibernateUtil.rollback(tx);
     2222        }
     2223      }
     2224
     2225      // Drop the 'SpotImages' table
     2226      dropTable(session, "SpotImages");
    22082227     
    22092228      // Update the schema version number
    2210 //      setSchemaVersionInTransaction(session, schemaVersion);
    2211  
    2212       // Commit the changes
    2213       HibernateUtil.commit(tx);
    2214       log.info("updateToSchemaVersion146: OK");
     2229      setSchemaVersionInTransaction(session, schemaVersion);
     2230
     2231      log.info("updateToSchemaVersion147: OK");
    22152232    }
    22162233    catch (RuntimeException ex)
    22172234    {
    2218       if (tx != null) HibernateUtil.rollback(tx);
    2219       log.error("updateToSchemaVersion146: FAILED", ex);
     2235      log.error("updateToSchemaVersion147: FAILED", ex);
    22202236      throw ex;
    22212237    }
    22222238    return schemaVersion;
    2223    
    22242239  }
    22252240
  • trunk/src/core/net/sf/basedb/core/data/RawBioAssayData.java

    r6908 r7638  
    189189  }
    190190 
    191   private SpotImagesData spotImages;
    192   /**
    193     Get the settings used for generating spot images for this raw bio assay.
    194     @hibernate.one-to-one property-ref="rawBioAssay" cascade="delete"
    195   */
    196   public SpotImagesData getSpotImages()
    197   {
    198     return spotImages;
    199   }
    200   void setSpotImages(SpotImagesData spotImages)
    201   {
    202     this.spotImages = spotImages;
    203   }
    204  
    205191  private DerivedBioAssayData bioAssay;
    206192  /**
Note: See TracChangeset for help on using the changeset viewer.