15 | | 1. Java servlet class/file `SpecimenTubeServlet.java` in `src/net/sf/basedb/meludi/servlet/` should be updated:[[BR]]a. Protected method `void doGet(HttpServletRequest req, HttpServletResponse resp)` updated for command "`ValidateWell`" to call new private method `BioPlate createStorageBox(DbControl dc, String plateName)` to get a new bio plate item, if no existing storage box with the specified name exists.[[BR]]b. Private method `JSONArray findFreeWells(DbControl dc, Integer nofTubes, String storageBoxSuffix, Boolean fillGaps)` updated to call new private method `BioPlate createStorageBox(DbControl dc, String platePrefix, String plateSuffix, int plateNumber)`get a new bio plate item, if no existing storage box with the specified name exists. New private convenience method `JSONArray updateJsonWells(JSONArray jsonWells, BioPlate box, Integer nofWellsNeeded, Boolean fillGaps)` is called to update the JSONArray of proposed wells, both for existing and new storage boxes.[[BR]]c. New private convenience method `JSONArray updateJsonWells(JSONArray jsonWells, BioPlate box, Integer nofWellsNeeded, Boolean fillGaps)` added. It updates a JSONArray with wells to use for the specified storage box. The core code is taken from the previous version of private method `JSONArray findFreeWells(DbControl dc, Integer nofTubes, String storageBoxSuffix, Boolean fillGaps)`.[[BR]]d. Protected method `void doPost(HttpServletRequest req, HttpServletResponse resp)` updated for command "`CreateSpecimenTubes`" to create a `HashMap<String, BioPlate>` item that is given as argument in calls of updated private methods `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap)` and `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap, String boxType)`.[[BR]]e. Private method `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap)` updated with new argument `HashMap<String, BioPlate> bioPlateNamePlateHashMap`, that is used as argument when calling updated private method `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap, String boxType)`.[[BR]]f. Private method `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap, String boxType)` updated with new argument `HashMap<String, BioPlate> bioPlateNamePlateHashMap`. If no storage box item with the name specified in argument `jsonSpec` exists, a check is made if a created item with the desired name exists in the hash map, in which case the former is used, otherwise new private method `BioPlate createStorageBox(DbControl dc, String plateName)` is called to provide one. If a new storage box item is created, it is marked to be saved in the database by calling `dc.saveItem()`, with the item as argument, after which it is added as value in the hash map, using the storage box name as key.[[BR]]g. New private method `BioPlate createStorageBox(DbControl dc, String platePrefix, String plateSuffix, int plateNumber)` added. It creates a storage box name from the input arguments and then calls new private method `BioPlate createStorageBox(DbControl dc, String plateName)` to create a storage box item, that is returned.[[BR]]h. New private method `BioPlate createStorageBox(DbControl dc, String plateName)` added. It preforms database queries to obtain plate geometry and bio plate type items for storage boxes, which is used to create a new `BioPlate` storage box item with the desired name. The created storage box item is then returned. Database queries are performed for the plate geometry and bio plate type items, instead of creating new items, since the `BioPlate` storage box item contains links to the former items. |
| 15 | 1. Java servlet class/file `SpecimenTubeServlet.java` in `src/net/sf/basedb/meludi/servlet/` should be updated:[[BR]]a. Protected method `void doGet(HttpServletRequest req, HttpServletResponse resp)` updated for command "`ValidateWell`" to call new private method `BioPlate createStorageBox(DbControl dc, String plateName)` to get a new bio plate item, if no existing storage box with the specified name exists.[[BR]]b. Private method `JSONArray findFreeWells(DbControl dc, Integer nofTubes, String storageBoxSuffix, Boolean fillGaps)` updated to call new private method `BioPlate createStorageBox(DbControl dc, String platePrefix, String plateSuffix, int plateNumber)`get a new bio plate item, if no existing storage box with the specified name exists. New private convenience method `JSONArray updateJsonWells(JSONArray jsonWells, BioPlate box, Integer nofWellsNeeded, Boolean fillGaps)` is called to update the JSONArray of proposed wells, both for existing and new storage boxes.[[BR]]c. New private convenience method `JSONArray updateJsonWells(JSONArray jsonWells, BioPlate box, Integer nofWellsNeeded, Boolean fillGaps)` added. It updates a JSONArray with wells to use for the specified storage box. The core code is taken from the previous version of private method `JSONArray findFreeWells(DbControl dc, Integer nofTubes, String storageBoxSuffix, Boolean fillGaps)`.[[BR]]d. Protected method `void doPost(HttpServletRequest req, HttpServletResponse resp)` updated for command "`CreateSpecimenTubes`" to create a `HashMap<String, BioPlate>` item that is given as argument in calls of updated private methods `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap)` and `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap, String boxType)`.[[BR]]e. Private method `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap)` updated with new argument `HashMap<String, BioPlate> bioPlateNamePlateHashMap`, that is used as argument when calling updated private method `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap, String boxType)`.[[BR]]f. Private method `BioWell fetchBioWell(DbControl dc, JSONObject jsonSpec, HashMap<String, BioPlate> bioPlateNamePlateHashMap, String boxType)` updated with new argument `HashMap<String, BioPlate> bioPlateNamePlateHashMap`. If no storage box item with the name specified in argument `jsonSpec` exists, a check is made if a created item with the desired name exists in the hash map, in which case the former is used, otherwise new private method `BioPlate createStorageBox(DbControl dc, String plateName)` is called to provide one. If a new storage box item is created, it is marked to be saved in the database by calling `dc.saveItem()`, with the item as argument, after which it is added as value in the hash map, using the storage box name as key.[[BR]]g. New private method `BioPlate createStorageBox(DbControl dc, String platePrefix, String plateSuffix, int plateNumber)` added. It creates a storage box name from the input arguments and then calls new private method `BioPlate createStorageBox(DbControl dc, String plateName)` to create a storage box item, that is returned.[[BR]]h. New private method `BioPlate createStorageBox(DbControl dc, String plateName)` added. It preforms database queries to obtain plate geometry and bio plate type items for storage boxes, which are used to create a new `BioPlate` storage box item with the desired name. The created storage box item is then returned. Database queries are performed for the plate geometry and bio plate type items, instead of creating new items, since the `BioPlate` storage box item contains links to the former items. |