Changeset 5452


Ignore:
Timestamp:
Oct 27, 2010, 2:32:44 PM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #1442: BioPlate? events

Remove everything that we doen't need to keep in 2.16 (#1532).

Location:
trunk
Files:
9 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/ehcache.xml

    r5338 r5452  
    6363  />
    6464  <cache
    65     name="net.sf.basedb.core.data.BioPlateEventDefinitionData"
    66     maxElementsInMemory="100"
    67     eternal="false"
    68     timeToIdleSeconds="3600"
    69     timeToLiveSeconds="3600"
    70     overflowToDisk="false"
    71   />
    72   <cache
    7365    name="net.sf.basedb.core.data.BioPlateTypeData"
    7466    maxElementsInMemory="100"
  • trunk/config/dist/hibernate.cfg.xml

    r5338 r5452  
    6363    />
    6464    <class-cache
    65       class="net.sf.basedb.core.data.BioPlateEventDefinitionData"
    66       usage="nonstrict-read-write"
    67     />
    68     <class-cache
    6965      class="net.sf.basedb.core.data.BioPlateTypeData"
    7066      usage="nonstrict-read-write"
  • trunk/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java

    r5384 r5452  
    197197        {
    198198          Item.BIOSOURCE, Item.SAMPLE, Item.EXTRACT, Item.LABELEDEXTRACT, Item.LABEL,
    199           Item.BIOMATERIALLIST, Item.BIOPLATE, Item.BIOPLATETYPE, Item.BIOPLATEEVENTDEFINITION,
     199          Item.BIOMATERIALLIST, Item.BIOPLATE, Item.BIOPLATETYPE,
    200200          Item.HYBRIDIZATION, Item.SCAN, Item.RAWBIOASSAY, Item.EXPERIMENT, Item.FORMULA
    201201        })
  • trunk/src/core/common-queries.xml

    r5442 r5452  
    889889  </query>
    890890 
    891   <query id="GET_BIOPLATEEVENTDEFINITION_WITH_NAME" type="HQL">
    892     <sql>
    893       SELECT evd
    894       FROM BioPlateEventDefinitionData evd
    895       WHERE evd.name = :name
    896     </sql>
    897     <description>
    898       A Hibernate query that returns the bioplate event definition with the specified
    899       name.
    900     </description>
    901   </query>
    902  
    903  
    904891  <query id="GET_LABEL_WITH_NAME" type="HQL">
    905892    <sql>
     
    10301017      A Hibernate query that gets raw bioassays
    10311018      using a protocol.
    1032     </description>
    1033   </query>
    1034 
    1035   <query id="GET_BIOPLATEEVENTS_FOR_PROTOCOL" type="HQL">
    1036     <sql>
    1037       SELECT {1}
    1038       FROM BioPlateEventData bpe
    1039       WHERE bpe.protocol = :protocol
    1040     </sql>
    1041     <description>
    1042       A Hibernate query that gets bioplate events
    1043       using a protocol.
    1044     </description>
    1045   </query>
    1046 
    1047   <query id="GET_BIOPLATEEVENTDEFINITIONS_FOR_PROTOCOL" type="HQL">
    1048     <sql>
    1049       SELECT {1}
    1050       FROM BioPlateEventDefinitionData bed
    1051       WHERE bed.defaultProtocol = :protocol
    1052     </sql>
    1053     <description>
    1054       A Hibernate query that gets bioplate event definitions
    1055       using a default protocol.
    10561019    </description>
    10571020  </query>
     
    11551118  </query>
    11561119
    1157   <query id="GET_BIOPLATEEVENTS_FOR_HARDWARE" type="HQL">
    1158     <sql>
    1159       SELECT {1}
    1160       FROM BioPlateEventData bpe
    1161       WHERE bpe.hardware = :hardware
    1162     </sql>
    1163     <description>
    1164       A Hibernate query that gets bioplate events which
    1165       uses a given hardware.
    1166     </description>
    1167   </query>
    1168 
    1169   <query id="GET_BIOPLATEEVENTDEFINITIONS_FOR_HARDWARE" type="HQL">
    1170     <sql>
    1171       SELECT {1}
    1172       FROM BioPlateEventDefinitionData bed
    1173       WHERE bed.defaultHardware = :hardware
    1174     </sql>
    1175     <description>
    1176       A Hibernate query that gets bioplate event definitions which
    1177       uses a given default hardware.
    1178     </description>
    1179   </query>
    1180 
    1181 
    11821120  <query id="GET_REPORTERS_FOR_REPORTERTYPE" type="HQL">
    11831121    <sql>
     
    13101248      A Hibernate query that gets labeled extracts
    13111249      with a given label.
    1312     </description>
    1313   </query>
    1314 
    1315   <query id="GET_BIOPLATEEVENTDEFINITION_FOR_LABEL" type="HQL">
    1316     <sql>
    1317       SELECT {1}
    1318       FROM BioPlateEventDefinitionData bed
    1319       WHERE bed.defaultLabel = :label
    1320     </sql>
    1321     <description>
    1322       A Hibernate query that gets bioplate event definitions
    1323       with a given default label.
    13241250    </description>
    13251251  </query>
     
    14601386      A Hibernate query that gets the
    14611387      plates that has been created from a given plate mapping.
    1462     </description>
    1463   </query>
    1464  
    1465   <query id="GET_BIOPLATEEVENTDEFINITIONS_FOR_PLATEMAPPING" type="HQL">
    1466     <sql>
    1467       SELECT {1}
    1468       FROM BioPlateEventDefinitionData bed
    1469       WHERE bed.defaultPlateMapping = :plateMapping
    1470     </sql>
    1471     <description>
    1472       A Hibernate query that gets the
    1473       bioplate event definitions that uses the given plate mapping as the
    1474       default mapping.
    14751388    </description>
    14761389  </query>
     
    38143727  </query>
    38153728 
    3816   <query id="GET_BIOPLATEEVENTDEFINITIONS_FOR_BIOPLATETYPE" type="HQL">
    3817     <sql>
    3818       SELECT {1}
    3819       FROM BioPlateEventDefinitionData bed
    3820       WHERE bed.sourcePlateType = :bioPlateType
    3821       OR bed.destinationPlateType = :bioPlateType
    3822     </sql>
    3823     <description>
    3824       A HQL query that gets the bioplate event definitions
    3825       using a given bioplate type.
    3826     </description>
    3827   </query>
    3828  
    38293729  <query id="GET_BIOPLATETYPE_WITH_NAME" type="HQL">
    38303730    <sql>
  • trunk/src/core/net/sf/basedb/core/BioMaterialEvent.java

    r5383 r5452  
    253253      }
    254254    }
    255     if (getData().getPlateEvent() != null) denied |= Permission.deny(Permission.WRITE);
    256255    super.initPermissions(granted, denied);
    257256  }
     
    474473  }
    475474
    476   /**
    477     Get the associated bioplate event. If this event is associated with
    478     a bioplate event, most properties are locked and can't be modifed.
    479    
    480     @return The bioplate event or null if this event is not
    481       associated with a bioplate event
    482     @since 2.16
    483   */
    484   public BioPlateEvent getPlateEvent()
    485   {
    486     return getDbControl().getItem(BioPlateEvent.class, getData().getPlateEvent());
    487   }
    488  
    489   void setPlateEvent(BioPlateEvent event)
    490   {
    491     getData().setPlateEvent(event.getData());
    492   }
    493  
    494475  /**
    495476    Get the quantity that was used from the biomaterial by this event.
  • trunk/src/core/net/sf/basedb/core/BioPlate.java

    r5355 r5452  
    174174     */
    175175    query.setEntity("bioPlate", this.getData());
    176     if (HibernateUtil.loadData(Long.class, query) > 0) return true;
    177    
    178     query = HibernateUtil.getPredefinedQuery(session,
    179       "GET_CHILD_PLATES_FOR_PLATE", "count(*)");
    180     /*
    181       SELECT {1}
    182       FROM BioPlateData bp
    183       JOIN bp.creationEvent ce
    184       WHERE ce.sourcePlate = :bioPlate
    185     */
    186     query.setEntity("bioPlate", this.getData());
    187176    return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
    188177  }
     
    207196    query.setEntity("bioPlate", this.getData());
    208197    addUsingItems(using, query);
    209    
    210     query = HibernateUtil.getPredefinedQuery(session,
    211         "GET_CHILD_PLATES_FOR_PLATE", "bp");
    212       /*
    213         SELECT {1}
    214         FROM BioPlateData bp
    215         JOIN bp.creationEvent ce
    216         WHERE ce.sourcePlate = :bioPlate
    217       */
    218     query.setEntity("bioPlate", this.getData());
    219     addUsingItems(using, query);
    220198    return using;
    221199  }
     
    243221  }
    244222
    245   /**
    246     Get the bioplate event that created this plate.
    247     @return A bioplate event or null if the plate wasn't created by an event
    248     @since 2.16
    249   */
    250   public BioPlateEvent getCreationEvent()
    251   {
    252     return getDbControl().getItem(BioPlateEvent.class, getData().getCreationEvent());
    253   }
    254  
    255   void setCreationEvent(BioPlateEvent event)
    256   {
    257     getData().setCreationEvent(event.getData());
    258   }
    259  
    260223  /**
    261224    Get the {@link BioPlateType} of this bioplate.
     
    411374  }
    412375 
    413   /**
    414     Create a new event that uses this bioplate as the source plate.
    415     Use the returned event to create new plates (if the event type is
    416     CREATION), new hybridizations (if the event type is HYBRIDIZATION)
    417     or simply to register some other information (if the event type is
    418     OTHER).
    419    
    420     @param eventType The type of event
    421     @return A bioplate event
    422     @since 2.16
    423   */
    424   public BioPlateEvent newEvent(BioMaterialEvent.Type eventType)
    425   {
    426     return BioPlateEvent.getNew(getDbControl(), this, eventType);
    427   }
    428  
    429   /**
    430     Get a query that returns all events that this bioplate has been
    431     a part of including the creation event (if any).
    432     @return A query
    433     @since 2.16
    434   */
    435   public ItemQuery<BioPlateEvent> getEvents()
    436   {
    437     return BioPlateEvent.getQuery(this);
    438   }
    439  
    440   /**
    441     Get a query that returns all event definitions that can be
    442     used with this bioplate as the source plate.
    443     @return A query
    444     @since 2.16
    445   */
    446   public ItemQuery<BioPlateEventDefinition> getEventDefinitions()
    447   {
    448     ItemQuery<BioPlateEventDefinition> query = BioPlateEventDefinition.getQuery();   
    449     query.restrictPermanent(
    450       Restrictions.eq(
    451         Hql.property("sourcePlateType"),
    452         Hql.entity(getData().getBioPlateType())
    453       )
    454     );
    455     return query;
    456    
    457   }
    458376
    459377}
  • trunk/src/core/net/sf/basedb/core/BioPlateType.java

    r5349 r5452  
    170170    query.setEntity("bioPlateType", this.getData());
    171171    boolean used = HibernateUtil.loadData(Long.class, query) > 0;
    172     if (!used)
    173     {
    174       query = HibernateUtil.getPredefinedQuery(session,
    175           "GET_BIOPLATEEVENTDEFINITIONS_FOR_BIOPLATETYPE", "count(*)");
    176       /*
    177         SELECT {1}
    178         FROM BioPlateEventDefinitionData bed
    179         WHERE bed.sourcePlateType = :bioPlateType
    180         OR bed.destinationPlateType = :bioPlateType
    181        */
    182       query.setEntity("bioPlateType", this.getData());
    183       used = HibernateUtil.loadData(Long.class, query) > 0;
    184     }
    185172    return used || super.isUsed();
    186173  }
     
    205192    query.setEntity("bioPlateType", this.getData());
    206193    addUsingItems(using, Item.BIOPLATE, query);
    207    
    208     // BioPlateEventDefinitions
    209     query = HibernateUtil.getPredefinedQuery(session,
    210       "GET_BIOPLATEEVENTDEFINITIONS_FOR_BIOPLATETYPE", "bed.id");
    211       /*
    212         SELECT {1}
    213         FROM BioPlateEventDefinitionData bed
    214         WHERE bed.sourcePlateType = :bioPlateType
    215         OR bed.destinationPlateType = :bioPlateType
    216       */
    217     query.setEntity("bioPlateType", this.getData());
    218     addUsingItems(using, Item.BIOPLATEEVENTDEFINITION, query);
    219 
    220194    return using;
    221195  }
     
    299273  }
    300274
    301   /**
    302     Creates a query that returns all event definitions that
    303     define events with this plate type as the source plate type.
    304     @return An ItemQuery object
    305   */
    306   public ItemQuery<BioPlateEventDefinition> getEventDefinitions()
    307   {
    308     ItemQuery<BioPlateEventDefinition> query = BioPlateEventDefinition.getQuery();
    309     query.restrictPermanent(
    310         Restrictions.eq(
    311           Hql.property("sourcePlateType"),
    312           Hql.entity(this)
    313         )
    314       );
    315     return query;
    316   }
    317 
    318275 
    319276}
  • trunk/src/core/net/sf/basedb/core/Hardware.java

    r5339 r5452  
    150150    <li>a {@link BioMaterialEvent} is linked to this hardware
    151151    <li>a {@link PlateEvent} is linked to this hardware
    152     <li>a {@link BioPlateEvent} is linked to this hardware
    153     <li>a {@link BioPlateEventDefinition} is linked to this hardware
    154152    </ul>
    155153   
     
    211209      used = HibernateUtil.loadData(Long.class, q) > 0;
    212210    }
    213     if (!used)
    214     {
    215       org.hibernate.Query q = HibernateUtil.getPredefinedQuery(session,
    216         "GET_BIOPLATEEVENTS_FOR_HARDWARE", "count(*)");
    217         /*
    218           SELECT {1}
    219           FROM BioPlateEventData bpe
    220           WHERE bpe.hardware = :hardware
    221         */
    222       q.setEntity("hardware", this.getData());
    223       used = HibernateUtil.loadData(Long.class, q) > 0;
    224     }
    225     if (!used)
    226     {
    227       org.hibernate.Query q = HibernateUtil.getPredefinedQuery(session,
    228         "GET_BIOPLATEEVENTDEFINITIONS_FOR_HARDWARE", "count(*)");
    229         /*
    230           SELECT {1}
    231           FROM BioPlateEventDefinitionData bed
    232           WHERE bed.defaultHardware = :hardware
    233         */
    234       q.setEntity("hardware", this.getData());
    235       used = HibernateUtil.loadData(Long.class, q) > 0;
    236     }
    237211    return used || super.isUsed();
    238212  }
     
    244218    <li>{@link BioMaterial}:s and {@link Hybridization}:s with this hardware
    245219    <li>{@link Plate}:s with this hardware
    246     <li>{@link BioPlate}:s with this hardware
    247     <li>{@link BioPlateEventDefinition}:s with this hardware
    248220    <ul>
    249221    @since 2.2
     
    309281    query.setEntity("hardware", this.getData());
    310282    addUsingItems(using, Item.PLATE, query);
    311    
    312     // Bioplates
    313     query = HibernateUtil.getPredefinedQuery(session,
    314       "GET_BIOPLATEEVENTS_FOR_HARDWARE", "bpe.sourcePlate.id");
    315       /*
    316         SELECT {1}
    317         FROM BioPlateEventData bpe
    318         WHERE bpe.hardware = :hardware
    319       */
    320     query.setEntity("hardware", this.getData());
    321     addUsingItems(using, Item.BIOPLATE, query);
    322 
    323     // Bioplate event definitions
    324     query = HibernateUtil.getPredefinedQuery(session,
    325       "GET_BIOPLATEEVENTDEFINITIONS_FOR_HARDWARE", "bed.id");
    326       /*
    327         SELECT {1}
    328         FROM BioPlateEventDefinitionData bed
    329         WHERE bed.defaultHardware = :hardware
    330       */
    331     query.setEntity("hardware", this.getData());
    332     addUsingItems(using, Item.BIOPLATEEVENTDEFINITION, query);
    333    
    334283    return using;
    335284  }
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5445 r5452  
    2525package net.sf.basedb.core;
    2626
    27 import net.sf.basedb.core.data.BioPlateEventDefinitionData;
    2827import net.sf.basedb.core.data.BioPlateTypeData;
    2928import net.sf.basedb.core.data.ColoringData;
     
    158157    throws BaseException
    159158  {
    160     final int totalProgressSteps = 27;
     159    final int totalProgressSteps = 26;
    161160    final float progress_factor = 100 / totalProgressSteps;
    162161    int progressStep = 0;
     
    347346      createRoleKey(Item.BIOPLATE, "Bio plates", "Gives access to bio plates", users_create);
    348347      createRoleKey(Item.BIOPLATETYPE, "Bio plate types", "Gives access to bio plate types", guests_use_power_users_all);
    349       createRoleKey(Item.BIOPLATEEVENTDEFINITION, "Bio plate event definitions", "Gives access to bio plate event definitions", users_create);
    350348      createRoleKey(Item.BIOMATERIALLIST, "Biomaterial lists", "Gives access to biomaterial lists", users_create);
    351349 
     
    590588      BioPlateTypeData labeledExtractReactionPlate =
    591589        createBioPlateType("Labeled extract reaction plate", "A generic reaction plate for labeled extracts.", Item.LABELEDEXTRACT, true);
    592      
    593       progressStep++;
    594       if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating bioplate event definitions...");
    595       createBioPlateEventDefinition(BioPlateEventDefinition.Type.SAMPLE_TO_EXTRACT,
    596           "Extraction event", "A generic extraction event",
    597           sampleReactionPlate, extractReactionPlate, null, 1,
    598           rootUser, keyEveryoneUse);
    599       createBioPlateEventDefinition(BioPlateEventDefinition.Type.EXTRACT_TO_LABELEDEXTRACT,
    600           "Labeling event", "A generic labeling event",
    601           extractReactionPlate, labeledExtractReactionPlate, null, 1,
    602           rootUser, keyEveryoneUse);
    603590     
    604591      // Labels
     
    18411828    }
    18421829    return pt;
    1843   }
    1844 
    1845   /**
    1846     Create a {@link BioPlateEventDefinition}.
    1847   */
    1848   private static BioPlateEventDefinitionData createBioPlateEventDefinition(BioPlateEventDefinition.Type eventType,
    1849     String name, String description, BioPlateTypeData sourcePlateType, BioPlateTypeData destPlateType,
    1850     PlateGeometryData destPlateGeometry, int numNewPlates, UserData owner, ItemKeyData shareTo)
    1851     throws BaseException
    1852   {
    1853     org.hibernate.Transaction tx = null;
    1854     BioPlateEventDefinitionData data = null;
    1855     try
    1856     {
    1857       tx = HibernateUtil.newTransaction(session);
    1858      
    1859       if (data == null)
    1860       {
    1861         org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_BIOPLATEEVENTDEFINITION_WITH_NAME");
    1862         query.setString("name", name);
    1863         data = HibernateUtil.loadData(BioPlateEventDefinitionData.class, query);
    1864       }
    1865  
    1866       if (data != null)
    1867       {
    1868         log.info("createBioPlateEventDefinition: EXISTS [name="+name+"]");
    1869         HibernateUtil.commit(tx);
    1870       }
    1871       else
    1872       {
    1873         data = new BioPlateEventDefinitionData();
    1874         data.setName(name);
    1875         data.setDescription(description);
    1876         data.setEntryDate(new Date());
    1877         data.setOwner(owner);
    1878         data.setItemKey(shareTo);
    1879         data.setEventType(eventType.getValue());
    1880         data.setSourcePlateType(sourcePlateType);
    1881         data.setDestinationPlateType(destPlateType);
    1882         data.setDestinationPlateGeometry(destPlateGeometry);
    1883         data.setNumNewPlates(numNewPlates);
    1884         data.setAllowHardwareOverride(true);
    1885         data.setAllowLabelOverride(true);
    1886         data.setAllowMappingOverride(true);
    1887         data.setAllowProtocolOverride(true);
    1888        
    1889         HibernateUtil.saveData(session, data);
    1890         HibernateUtil.commit(tx);
    1891         log.info("createBioPlateEventDefinition: OK [NAME="+name+"]");
    1892       }
    1893     }
    1894     catch (BaseException ex)
    1895     {
    1896       if (tx != null) HibernateUtil.rollback(tx);
    1897       log.error("createBioPlateEventDefinition: FAILED [NAME="+name+"]", ex);
    1898       throw ex;
    1899     }
    1900     return data;
    19011830  }
    19021831
  • trunk/src/core/net/sf/basedb/core/Item.java

    r5384 r5452  
    346346  BIOPLATETYPE(210, "Bio plate type", "bpt", BioPlateType.class, BioPlateTypeData.class,
    347347      DefinedPermissions.basic, 490),
    348 
    349   /**
    350     The item is a {@link BioPlateType}.
    351     @since 2.16
    352   */
    353   BIOPLATEEVENT(211, "Bio plate event", "bpe", BioPlateEvent.class, BioPlateEventData.class,
    354       null, 450),
    355 
    356   /**
    357     The item is a {@link BioPlateEventDefinition}
    358     @since 2.16
    359   */
    360   BIOPLATEEVENTDEFINITION(212, "Bio plate event definition", "bed",
    361       BioPlateEventDefinition.class, BioPlateEventDefinitionData.class, DefinedPermissions.shareable,
    362       460),
    363348
    364349  /**
  • trunk/src/core/net/sf/basedb/core/Label.java

    r5339 r5452  
    128128    <ul>
    129129    <li>Some {@link LabeledExtract}:s are labeled with this label
    130     <li>{@link BioPlateEventDefinition}:s uses this label as the default label
    131130    </ul>
    132131  */
     
    144143    query.setEntity("label", this.getData());
    145144    boolean used = HibernateUtil.loadData(Long.class, query) > 0;
    146     if (!used)
    147     {
    148       query = HibernateUtil.getPredefinedQuery(session,
    149         "GET_BIOPLATEEVENTDEFINITION_FOR_LABEL", "count(*)");
    150         /*
    151           SELECT {1}
    152           FROM BioPlateEventDefinitionData bed
    153           WHERE bed.defaultLabel = :label
    154         */
    155       query.setEntity("label", this.getData());
    156       used = HibernateUtil.loadData(Long.class, query) > 0;
    157     }
    158145    return used || super.isUsed();
    159146  }
     
    162149    <ul>
    163150    <li>{@link LabeledExtract}:s labeled with this label
    164     <li>{@link BioPlateEventDefinition}:s with this label as the default label
    165151    <ul>
    166152    @since 2.2
     
    182168    query.setEntity("label", this.getData());
    183169    addUsingItems(using, Item.LABELEDEXTRACT, query);
    184    
    185     // Bioplate event definitions
    186     query = HibernateUtil.getPredefinedQuery(session,
    187       "GET_BIOPLATEEVENTDEFINITION_FOR_LABEL", "bed.id");
    188       /*
    189         SELECT {1}
    190         FROM BioPlateEventDefinitionData bed
    191         WHERE bed.defaultLabel = :label
    192        */
    193     query.setEntity("label", this.getData());
    194     addUsingItems(using, Item.BIOPLATEEVENTDEFINITION, query);
    195170    return using;
    196171  }
  • trunk/src/core/net/sf/basedb/core/MeasuredBioMaterial.java

    r5449 r5452  
    2828
    2929import net.sf.basedb.core.data.BioPlateData;
    30 import net.sf.basedb.core.data.BioPlateEventData;
    3130import net.sf.basedb.core.data.BioPlateTypeData;
    3231import net.sf.basedb.core.data.BioWellData;
     
    366365    BioWellData newWell = well != null ? well.getData() : null;
    367366    if (EqualsHelper.equals(currentWell, newWell)) return; // early exit if no change
    368     BioPlateEventData plateEvent = null;
    369367   
    370368    // Check if current biowell is locked
     
    399397          Item.fromValue(biomaterialType));
    400398      }
    401       plateEvent = newPlate.getCreationEvent();
    402399    }
    403400    if (currentWell != null) currentWell.setBioMaterial(null);
    404401    if (newWell != null) newWell.setBioMaterial(getData());
    405402    getData().setBioWell(newWell);
    406     getCreationEvent().getData().setPlateEvent(plateEvent);
    407403  }
    408404 
  • trunk/src/core/net/sf/basedb/core/PlateMapping.java

    r5339 r5452  
    164164    <ul>
    165165    <li>A {@link Plate} has been created from this mapping
    166     <li>A {@link BioPlateEventDefinition} is using this as default mapping
    167166    </ul>
    168167  */
     
    180179    query.setEntity("plateMapping", this.getData());
    181180    boolean used = HibernateUtil.loadData(Long.class, query) > 0;
    182     if (!used)
    183     {
    184       query = HibernateUtil.getPredefinedQuery(session,
    185           "GET_BIOPLATEEVENTDEFINITIONS_FOR_PLATEMAPPING", "count(*)");
    186         /*
    187           SELECT {1}
    188           FROM BioPlateEventDefinitionData bed
    189           WHERE bed.defaultPlateMapping = :plateMapping
    190         */
    191         query.setEntity("plateMapping", this.getData());
    192         used = HibernateUtil.loadData(Long.class, query) > 0;
    193     }
    194181    return used || super.isUsed();
    195182  }
     
    198185    <ul>
    199186    <li>{@link Plate}:s created with this mapping
    200     <li>{@link BioPlateEventDefinition}:s using this as the default mapping
    201187    <ul>
    202188    @since 2.2
     
    217203    query.setEntity("plateMapping", this.getData());
    218204    addUsingItems(using, Item.PLATE, query);
    219    
    220     // BioPlateEventDefinition
    221     query = HibernateUtil.getPredefinedQuery(session,
    222       "GET_BIOPLATEEVENTDEFINITIONS_FOR_PLATEMAPPING", "bed.id");
    223       /*
    224         SELECT {1}
    225         FROM BioPlateEventDefinitionData bed
    226         WHERE bed.defaultPlateMapping = :plateMapping
    227       */
    228     query.setEntity("plateMapping", this.getData());
    229     addUsingItems(using, Item.BIOPLATEEVENTDEFINITION, query);
    230205    return using;
    231206  }
  • trunk/src/core/net/sf/basedb/core/Protocol.java

    r5339 r5452  
    180180    <li>a {@link Scan}
    181181    <li>a {@link RawBioAssay}
    182     <li>a {@link BioPlateEvent}
    183     <li>a {@link BioPlateEventDefinition}
    184182    </ul>
    185183  */
     
    249247      query.setEntity("protocol", this.getData());
    250248      used = HibernateUtil.loadData(Long.class, query) > 0;
    251     }
    252     if (!used)
    253     {
    254       org.hibernate.Query q = HibernateUtil.getPredefinedQuery(session,
    255         "GET_BIOPLATEEVENTS_FOR_PROTOCOL", "count(*)");
    256         /*
    257           SELECT {1}
    258           FROM BioPlateEventData bpe
    259           WHERE bpe.protocol = :protocol
    260         */
    261       q.setEntity("protocol", this.getData());
    262       used = HibernateUtil.loadData(Long.class, q) > 0;
    263     }
    264     if (!used)
    265     {
    266       org.hibernate.Query q = HibernateUtil.getPredefinedQuery(session,
    267         "GET_BIOPLATEEVENTDEFINITIONS_FOR_PROTOCOL", "count(*)");
    268         /*
    269           SELECT {1}
    270           FROM BioPlateEventDefinitionData bed
    271           WHERE bed.defaultProtocol = :protocol
    272         */
    273       q.setEntity("protocol", this.getData());
    274       used = HibernateUtil.loadData(Long.class, q) > 0;
    275249    }
    276250    return used || super.isUsed();
     
    284258    <li>a {@link Scan}:s using this protocol
    285259    <li>a {@link RawBioAssay}:s using this protocol
    286     <li>{@link BioPlate}:s using this protocol
    287     <li>{@link BioPlateEventDefinition}:s using this as default protocol
    288260    <ul>
    289261    @since 2.2
     
    360332    query.setEntity("protocol", this.getData());
    361333    addUsingItems(using, Item.RAWBIOASSAY, query);
    362  
    363     // Bioplates
    364     query = HibernateUtil.getPredefinedQuery(session,
    365       "GET_BIOPLATEEVENTS_FOR_PROTOCOL", "bpe.sourcePlate.id");
    366       /*
    367         SELECT {1}
    368         FROM BioPlateEventData bpe
    369         WHERE bpe.protocol = :protocol
    370       */
    371     query.setEntity("protocol", this.getData());
    372     addUsingItems(using, Item.BIOPLATE, query);
    373 
    374     // Bioplate event definitions
    375     query = HibernateUtil.getPredefinedQuery(session,
    376       "GET_BIOPLATEEVENTDEFINITIONS_FOR_PROTOCOL", "bed.id");
    377       /*
    378         SELECT {1}
    379         FROM BioPlateEventDefinitionData bed
    380         WHERE bed.defaultProtocol = :protocol
    381       */
    382     query.setEntity("protocol", this.getData());
    383     addUsingItems(using, Item.BIOPLATEEVENTDEFINITION, query);
    384 
    385334    return using;
    386335  }
  • trunk/src/core/net/sf/basedb/core/Update.java

    r5442 r5452  
    3939import net.sf.basedb.core.data.AnnotationSetData;
    4040import net.sf.basedb.core.data.ArrayDesignData;
    41 import net.sf.basedb.core.data.BioPlateData;
    42 import net.sf.basedb.core.data.BioPlateEventData;
    4341import net.sf.basedb.core.data.BioPlateTypeData;
    4442import net.sf.basedb.core.data.ChangeHistoryData;
     
    883881    <td>80</td>
    884882    <td>
    885       Added {@link BioPlateTypeData}, {@link BioPlateEventData},
    886       {@link BioPlateEventDefinition} and several
    887       new properties in {@link BioPlateData} and {@link BioMaterialEvent}
     883      Added {@link BioPlateTypeData}.
    888884      All existing bio plates are assigned "Storage plate" as their
    889885      plate type.
  • trunk/src/core/net/sf/basedb/core/data/BioMaterialEventData.java

    r5323 r5452  
    194194  }
    195195 
    196   private BioPlateEventData plateEvent;
    197   /**
    198     Get master plate event or null if there is none.
    199     @since 2.16
    200     @hibernate.many-to-one column="`plateevent_id`" not-null="false" outer-join="false"
    201   */
    202   public BioPlateEventData getPlateEvent()
    203   {
    204     return plateEvent;
    205   }
    206   public void setPlateEvent(BioPlateEventData plateEvent)
    207   {
    208     this.plateEvent = plateEvent;
    209   }
    210 
    211  
    212196  private Map<MeasuredBioMaterialData, UsedQuantity> sources;
    213197  /**
  • trunk/src/core/net/sf/basedb/core/data/BioPlateData.java

    r5384 r5452  
    2424import java.util.HashMap;
    2525import java.util.Map;
    26 import java.util.Set;
    2726
    2827/**
     
    127126  }
    128127 
    129   private BioPlateEventData creationEvent;
    130   /**
    131     Get the plate creation event or null if the plate was not created by
    132     a defined event.
    133     @since 2.16
    134     @hibernate.many-to-one column="`creationevent_id`" not-null="false"
    135       outer-join="false" update="false"
    136   */
    137   public BioPlateEventData getCreationEvent()
    138   {
    139     return creationEvent;
    140   }
    141   /**
    142     @since 2.16
    143   */
    144   public void setCreationEvent(BioPlateEventData creationEvent)
    145   {
    146     this.creationEvent = creationEvent;
    147   }
    148 
    149   private Set<BioPlateEventData> childEvents;
    150   /**
    151     This is the inverse end.
    152     @see BioPlateEventData#getSourcePlate()
    153     @since 2.16
    154     @hibernate.set inverse="true" lazy="true" cascade="delete"
    155     @hibernate.collection-key column="`sourceplate_id`"
    156     @hibernate.collection-one-to-many class="net.sf.basedb.core.data.BioPlateEventData"
    157   */
    158   Set<BioPlateEventData> getChildEvents()
    159   {
    160     return childEvents;
    161   }
    162   void setChildEvents(Set<BioPlateEventData> childEvents)
    163   {
    164     this.childEvents = childEvents;
    165   }
    166  
    167128  private Map<PlateCoordinate, BioWellData> bioWells;
    168129  /**
  • trunk/src/test/TestAll.java

    r5384 r5452  
    8787    results.put("TestBioPlateType", TestBioPlateType.test_all());
    8888    results.put("TestBioPlate", TestBioPlate.test_all());
    89     results.put("TestBioPlateEventDefinition", TestBioPlateEventDefinition.test_all());
    9089
    9190    // Annotation types and annotations
  • trunk/src/test/TestBioPlate.java

    r5445 r5452  
    2222
    2323import net.sf.basedb.core.BaseException;
    24 import net.sf.basedb.core.BioMaterialEvent;
    2524import net.sf.basedb.core.BioPlate;
    26 import net.sf.basedb.core.BioPlateEvent;
    2725import net.sf.basedb.core.BioPlateType;
    2826import net.sf.basedb.core.BioWell;
     
    3129import net.sf.basedb.core.Hardware;
    3230import net.sf.basedb.core.HardwareType;
    33 import net.sf.basedb.core.Hybridization;
    3431import net.sf.basedb.core.Item;
    3532import net.sf.basedb.core.ItemProxy;
     
    4037import net.sf.basedb.core.Permission;
    4138import net.sf.basedb.core.PlateGeometry;
    42 import net.sf.basedb.core.Protocol;
    4339import net.sf.basedb.core.ProtocolType;
    4440import net.sf.basedb.core.Sample;
     
    8884    int plateGeometryId = TestPlateGeometry.test_create(8, 12, false);
    8985    int bioPlateTypeId = TestBioPlateType.test_create("Test for bioplate", null, false);
    90     int id = test_create("Test BioPlate", plateGeometryId, bioPlateTypeId, freezerId, 0, true);
    91     int childId = test_create("Test BioPlate", plateGeometryId, bioPlateTypeId, freezerId, id, false);
     86    int id = test_create("Test BioPlate", plateGeometryId, bioPlateTypeId, freezerId, true);
    9287    test_load(id);
    9388    test_list(-1);
     
    9691    test_set_well(id, 0, 0, Item.SAMPLE, sampleId);
    9792    test_set_well(id, 0, 1, Item.EXTRACT, extractId);
    98     test_set_well(childId, 0, 1, Item.LABELEDEXTRACT, labeledExtractId);
    9993    test_list_wells(id, 2);
    100     test_list_wells(childId, 1);
    101    
    102     // Events
    103     test_create_event(id, "A master plate event", 0, protocolId);
    104     TestSample.test_list_events(sampleId, 3);
    105     int hybId = test_create_hybridization(childId, labeledExtractId, hybProtocolId);
    10694   
    10795    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
    10896    // Standard test: Delete
    109     TestHybridization.test_delete(hybId);
    11097    TestLabeledExtract.test_delete(labeledExtractId);
    11198    TestLabel.test_delete(labelId);
    11299    TestExtract.test_delete(extractId);
    113100    TestSample.test_delete(sampleId);
    114     test_delete(childId);
    115101    test_delete(id);
    116102    TestPlateGeometry.test_delete(plateGeometryId);
     
    206192  }
    207193
    208   static int test_create(String name, int plateGeometryId, int plateTypeId, int freezerId, int parentId, boolean setAll)
     194  static int test_create(String name, int plateGeometryId, int plateTypeId, int freezerId, boolean setAll)
    209195  {
    210196    if (plateGeometryId == 0 || plateTypeId == 0 || !TestUtil.hasPermission(Permission.CREATE, Item.BIOPLATE))
     
    219205      PlateGeometry pg = PlateGeometry.getById(dc, plateGeometryId); 
    220206      BioPlateType pt = BioPlateType.getById(dc, plateTypeId);
    221       BioPlateEvent event = null;
    222       if (parentId != 0)
    223       {
    224         BioPlate parent = BioPlate.getById(dc, parentId);
    225         event = parent.newEvent(BioMaterialEvent.Type.CREATION);
    226         dc.saveItem(event);
    227       }
    228       BioPlate bp = event == null ? BioPlate.getNew(dc, pg, pt) : event.newPlate(pt, pg);
     207      BioPlate bp = BioPlate.getNew(dc, pg, pt);
    229208      Item bioMaterialType = pt.getBioMaterialType();
    230209      bp.setName(name);
     
    284263    if (!TestUtil.getSilent())
    285264    {
    286       System.out.println("   \tID \tExternal id\tName      \tPlate type\tDescription\tBarcode\tGeometry\tFreezer\tParent");
    287       System.out.println("-- \t-- \t-----------\t----------\t----------\t-----------\t-------\t--------\t-------\t------");
     265      System.out.println("   \tID \tExternal id\tName      \tPlate type\tDescription\tBarcode\tGeometry\tFreezer");
     266      System.out.println("-- \t-- \t-----------\t----------\t----------\t-----------\t-------\t--------\t-------");
    288267    }
    289268  }
     
    296275  static void write_item(int i, BioPlate bioPlate)
    297276  {
    298     BioPlate parent = null;
    299     if (bioPlate.getCreationEvent() != null) parent = bioPlate.getCreationEvent().getSourcePlate();
    300277    if (!TestUtil.getSilent()) System.out.println(i+":\t"+bioPlate.getId()+"\t"+bioPlate.getExternalId()+
    301278        "\t"+bioPlate.getName()+"\t"+bioPlate.getBioPlateType()+"\t"+bioPlate.getDescription()+
    302         "\t"+bioPlate.getBarcode()+"\t"+bioPlate.getPlateGeometry()+"\t"+bioPlate.getFreezer()+
    303         "\t"+parent);
     279        "\t"+bioPlate.getBarcode()+"\t"+bioPlate.getPlateGeometry()+"\t"+bioPlate.getFreezer());
    304280  }
    305281 
     
    381357  }
    382358 
    383   static int test_create_event(int bioPlateId, String comment, int hardwareId, int protocolId)
    384   {
    385     if (bioPlateId == 0) return 0;
    386     int eventId = 0;
    387     DbControl dc = null;
    388     try
    389     {
    390       dc = TestUtil.getDbControl();
    391       BioPlate plate = BioPlate.getById(dc, bioPlateId);
    392       BioPlateEvent event = plate.newEvent(BioMaterialEvent.Type.OTHER);
    393       event.setComment(comment);
    394       if (hardwareId != 0)
    395       {
    396         event.setHardware(Hardware.getById(dc, hardwareId));
    397       }
    398       if (protocolId != 0)
    399       {
    400         event.setProtocol(Protocol.getById(dc, protocolId));
    401       }
    402       dc.saveItem(event);
    403       dc.commit();
    404       eventId = event.getId();
    405       write("--Create event OK");
    406     }
    407     catch (Throwable ex)
    408     {
    409       write("--Create event FAILED");
    410       ex.printStackTrace();
    411       ok = false;
    412     }
    413     finally
    414     {
    415       if (dc != null) dc.close();
    416     }
    417     return eventId;
    418   }
    419 
    420  
    421   static int test_create_hybridization(int bioPlateId, int labeledExtractId, int protocolId)
    422   {
    423     if (bioPlateId == 0 || labeledExtractId == 0) return 0;
    424     int hybId = 0;
    425     DbControl dc = null;
    426     try
    427     {
    428       dc = TestUtil.getDbControl();
    429       BioPlate plate = BioPlate.getById(dc, bioPlateId);
    430       BioPlateEvent event = plate.newEvent(BioMaterialEvent.Type.HYBRIDIZATION);
    431       LabeledExtract le = LabeledExtract.getById(dc, labeledExtractId);
    432       event.setComment("Creating hyb");
    433       Hybridization hyb = event.newHybridization();
    434       hyb.getCreationEvent().addSource(le, null);
    435       if (protocolId != 0)
    436       {
    437         event.setProtocol(Protocol.getById(dc, protocolId));
    438       }
    439       dc.saveItem(event);
    440       dc.saveItem(hyb);
    441       dc.commit();
    442       hybId = hyb.getId();
    443       dc = TestUtil.getDbControl();
    444       dc.reattachItem(hyb, false);
    445       TestHybridization.write_item(0, hyb);
    446       write("--Create hybridization OK");
    447     }
    448     catch (Throwable ex)
    449     {
    450       write("--Create hybridization FAILED");
    451       ex.printStackTrace();
    452       ok = false;
    453     }
    454     finally
    455     {
    456       if (dc != null) dc.close();
    457     }
    458     return hybId;
    459   }
    460 
     359 
    461360  static List<Integer> test_fill(int bioPlateId, Item itemType, String rootName, int labelId)
    462361  {
  • trunk/www/biomaterials/bioplates/view_bioplate.jsp

    r5426 r5452  
    3535  import="net.sf.basedb.core.AnnotationSet"
    3636  import="net.sf.basedb.core.BioPlate"
    37   import="net.sf.basedb.core.BioPlateEvent"
    3837  import="net.sf.basedb.core.BioWell"
    3938  import="net.sf.basedb.core.MeasuredBioMaterial"
     
    9392  String title = null;
    9493  BioPlate bioplate = BioPlate.getById(dc, itemId);
    95   BioPlateEvent creationEvent = bioplate.getCreationEvent();
    9694  PlateGeometry geometry = bioplate.getPlateGeometry();
    9795 
     
    345343      }
    346344      %>
    347       <table>
    348       <tr valign="top">
    349       <td>
    350345      <table class="form" cellspacing="0">
    351346      <tr>
     
    376371        <td class="prompt">Description</td>
    377372        <td><%=HTML.niceFormat(bioplate.getDescription())%></td>
    378       </tr>
    379       </table>
    380       </td>
    381       <td>
    382         <%
    383         if (creationEvent != null)
    384         {
    385           %>
    386           <table class="form" cellspacing="0">
    387           <tr>
    388             <td class="prompt">Created</td>
    389             <td><%=dateFormatter.format(creationEvent.getEventDate())%></td>
    390           </tr>
    391           <tr>
    392             <td class="prompt">Registered</td>
    393             <td><%=dateFormatter.format(creationEvent.getEntryDate())%></td>
    394           </tr>
    395           <tr>
    396             <td class="prompt">Protocol</td>
    397             <td><base:propertyvalue item="<%=creationEvent%>" property="protocol" /></td>
    398           </tr>
    399           <tr>
    400             <td class="prompt">Hardware</td>
    401             <td><base:propertyvalue item="<%=creationEvent%>" property="hardware" /></td>
    402           </tr>
    403           <tr>
    404             <td class="prompt">User</td>
    405             <td><base:propertyvalue item="<%=creationEvent%>" property="user" /></td>
    406           </tr>
    407           <tr>
    408             <td class="prompt">Comment</td>
    409             <td><%=HTML.niceFormat(creationEvent.getComment())%></td>
    410           </tr>
    411           </table>
    412           <%
    413         }
    414         %>
    415       </td>
    416373      </tr>
    417374      </table>
  • trunk/www/include/menu.jsp

    r5442 r5452  
    596596    final boolean createBioPlates   =  sc.hasPermission(Permission.CREATE, Item.BIOPLATE);
    597597    final boolean hasBioPlateTypes  = !sc.hasPermission(Permission.DENIED, Item.BIOPLATETYPE);
    598     final boolean hasBioPlateEventDefinitions = !sc.hasPermission(Permission.DENIED, Item.BIOPLATEEVENTDEFINITION);
    599598    final boolean hasBioLims      =  hasLabels || hasBioSources || hasSamples || hasExtracts ||
    600599                      hasLabeledExtracts || hasBioMaterialLists || hasBioPlates ||
    601                       hasBioPlateTypes || hasBioPlateEventDefinitions;
     600                      hasBioPlateTypes;
    602601   
    603602    if (hasBioLims)
     
    650649          tooltip="<%=menu.getString("bioplatetypes.tooltip", hasBioPlateTypes)%>"
    651650          enabled="<%=hasBioPlateTypes%>"
    652         />
    653         <m:menuitem
    654           title="<%=common.getString("item.bioplateeventdefinition+")%>"
    655           onclick="<%="Menu.openUrl('"+root+"biomaterials/eventdef/index.jsp?ID="+ID+"')"%>"
    656           tooltip="<%=menu.getString("bioplateeventdefinitions.tooltip", hasBioPlateEventDefinitions)%>"
    657           enabled="<%=hasBioPlateEventDefinitions%>"
    658651        />
    659652        <m:menuitem
Note: See TracChangeset for help on using the changeset viewer.