Skip to content

Commit

Permalink
Merge pull request #4882 from mtbc/trac-11894-text-properties
Browse files Browse the repository at this point in the history
make some OMERO model object text properties of unbounded length
  • Loading branch information
jburel authored Oct 11, 2016
2 parents 2c10372 + 07ece64 commit 8ed4bfd
Show file tree
Hide file tree
Showing 18 changed files with 178 additions and 60 deletions.
4 changes: 2 additions & 2 deletions components/dsl/src/ome/dsl/SaxReader.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* ome.dsl.SaxReader
*
* Copyright 2006 University of Dundee. All rights reserved.
* Copyright 2006-2016 University of Dundee. All rights reserved.
* Use is subject to license terms supplied in LICENSE.txt
*/

Expand Down Expand Up @@ -268,7 +268,7 @@ public List<SemanticType> process() {
if (named != null && named.booleanValue()) {
Properties p = new Properties();
p.setProperty("name", "name");
p.setProperty("type", "string");
p.setProperty("type", "text");
RequiredField r = new RequiredField(namedOrDescribed, p);
namedOrDescribed.getProperties().add(r);
}
Expand Down
6 changes: 3 additions & 3 deletions components/model/resources/mappings/acquisition.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<optional name="mtime" type="timestamp"/>
<optional name="ctime" type="timestamp"/>
<optional name="hasher" type="ome.model.enums.ChecksumAlgorithm"/>
<optional name="hash" type="string"/>
<optional name="hash" type="text"/>
<optional name="mimetype" type="string"/>
<zeromany name="filesetEntries" type="ome.model.fs.FilesetEntry" inverse="originalFile"/>
<!--
Expand Down Expand Up @@ -191,14 +191,14 @@
<optional name="green" type="int"/>
<optional name="blue" type="int"/>
<optional name="alpha" type="int"/>
<optional name="lookupTable" type="string"/>
<optional name="lookupTable" type="text"/>
<manyone name="logicalChannel" type="ome.model.core.LogicalChannel" inverse="channels"/>
<manyone name="pixels" type="ome.model.core.Pixels" ordered="true"/>
</properties>
</type>
<type id="ome.model.core.LogicalChannel">
<properties>
<optional name="name" type="string"/>
<optional name="name" type="text"/>
<optional name="pinHoleSize" type="ome.model.units.Length"/>
<optional name="illumination" type="ome.model.enums.Illumination"/>
<!-- Note: illumination is called IlluminationType in model-->
Expand Down
6 changes: 2 additions & 4 deletions components/model/resources/mappings/annotations.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# $Id$
#
# Copyright 2008-2014 Glencoe Software, Inc. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
Expand All @@ -13,8 +11,8 @@
<!-- Structured Annotations -->
<abstract id="ome.model.annotations.Annotation" discriminator="/" annotated="true">
<properties>
<optional name="ns" type="string"/>
<optional name="name" type="string"/>
<optional name="ns" type="text"/>
<optional name="name" type="text"/>
<optional name="description" type="text"/>
</properties>
</abstract>
Expand Down
2 changes: 1 addition & 1 deletion components/model/resources/mappings/containers.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright 2006-2015 University of Dundee. All rights reserved.
# Copyright 2006-2016 University of Dundee. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion components/model/resources/mappings/display.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<required name="defaultT" type="int"/>
<required name="model" type="ome.model.enums.RenderingModel"/>
<onemany name="waveRendering" type="ome.model.display.ChannelBinding" inverse="renderingDef" ordered="true"/>
<optional name="name" type="string"/>
<optional name="name" type="text"/>
<optional name="compression" type="double"/>
<required name="quantization" type="ome.model.display.QuantumDef"/>
<zeromany name="projections" type="ome.model.display.ProjectionDef" inverse="renderingDef" ordered="true"/>
Expand Down
6 changes: 2 additions & 4 deletions components/model/resources/mappings/jobs.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# $Id$
#
# Copyright 2007-2014 Glencoe Software, Inc. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
Expand Down Expand Up @@ -76,8 +74,8 @@
<type id="ome.model.jobs.ImportJob" superclass="ome.model.jobs.Job">
<!-- Note: ImportJob is not in model-->
<properties>
<required name="imageName" type="string"/>
<required name="imageDescription" type="string"/>
<required name="imageName" type="text"/>
<required name="imageDescription" type="text"/>
</properties>
</type>
<type id="ome.model.jobs.ScriptJob" superclass="ome.model.jobs.Job">
Expand Down
2 changes: 1 addition & 1 deletion components/model/resources/mappings/meta.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@

<!-- The human-readable text denoting this
namespace -->
<optional name="displayName" type="string"/>
<optional name="displayName" type="text"/>

</properties>
</type>
Expand Down
2 changes: 1 addition & 1 deletion components/model/resources/mappings/roi.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<type id="ome.model.roi.Roi" annotated="true" described="true">
<properties>
<!--optional name="union" type="boolean"/-->
<optional name="name" type="string"/>
<optional name="name" type="text"/>
<onemany name="shapes" type="ome.model.roi.Shape" inverse="roi" ordered="true"/>
<optional name="image" type="ome.model.core.Image" inverse="rois"/>
<optional name="source" type="ome.model.core.OriginalFile"/>
Expand Down
16 changes: 7 additions & 9 deletions components/model/resources/mappings/screen.ome.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# $Id$
#
# Copyright 2008 University of Dundee. All rights reserved.
# Copyright 2008-2016 University of Dundee. All rights reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -16,16 +14,16 @@
<properties>
<optional name="type" type="string"/>
<optional name="protocolIdentifier" type="string"/>
<optional name="protocolDescription" type="string"/>
<optional name="protocolDescription" type="text"/>
<optional name="reagentSetIdentifier" type="string"/>
<optional name="reagentSetDescription" type="string"/>
<optional name="reagentSetDescription" type="text"/>
<child name="plateLinks" type="ome.model.screen.ScreenPlateLink" target="ome.model.screen.Plate"/>
<zeromany name="reagents" type="ome.model.screen.Reagent" inverse="screen"/>
</properties>
</type>
<type id="ome.model.screen.PlateAcquisition" described="true" annotated="true">
<properties>
<optional name="name" type="string"/>
<optional name="name" type="text"/>
<optional name="startTime" type="timestamp"/>
<optional name="endTime" type="timestamp"/>
<optional name="maximumFieldCount" type="int"/>
Expand All @@ -45,7 +43,7 @@
<optional name="rows" type="int"/>
<optional name="columns" type="int"/>
<!-- end not in model -->
<optional name="status" type="string"/>
<optional name="status" type="text"/>
<optional name="externalIdentifier" type="string"/>
<parent name="screenLinks" type="ome.model.screen.ScreenPlateLink" target="ome.model.screen.Screen"/>
<zeromany name="wells" type="ome.model.screen.Well" inverse="plate"/>
Expand All @@ -67,7 +65,7 @@
<!-- end not in model -->
<child name="reagentLinks" type="ome.model.screen.WellReagentLink" target="ome.model.screen.Reagent"/>
<!-- Note: only one reagent per well in model-->
<optional name="externalDescription" type="string"/>
<optional name="externalDescription" type="text"/>
<optional name="externalIdentifier" type="string"/>
<optional name="type" type="string"/>
<zeromany name="wellSamples" type="ome.model.screen.WellSample" inverse="well" ordered="true"/>
Expand All @@ -88,7 +86,7 @@
<type id="ome.model.screen.Reagent" annotated="true" described="true">
<!-- Note: Name is optional in model-->
<properties>
<optional name="name" type="string"/>
<optional name="name" type="text"/>
<optional name="reagentIdentifier" type="string"/>
<manyone name="screen" type="ome.model.screen.Screen" inverse="reagent"/>
<parent name="wellLinks" type="ome.model.screen.WellReagentLink" target="ome.model.screen.Well"/>
Expand Down
2 changes: 1 addition & 1 deletion etc/omero.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ omero.db.version=OMERO5.3DEV
# server that is is being used with. Any changes by
# developers to the database schema will result in
# a bump to this value.
omero.db.patch=12
omero.db.patch=13

# The string that will be used as the base for LSIDs
# in all exported OME objects including OME-XML and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
--

---
--- OMERO5 readiness check for upgrade from OMERO5.2__0 to OMERO5.3DEV__12.
--- OMERO5 readiness check for upgrade from OMERO5.2__0 to OMERO5.3DEV__13.
---

BEGIN;
Expand Down Expand Up @@ -245,6 +245,6 @@ DROP FUNCTION parse_transform(TEXT);
-- FINISHED
--

SELECT CHR(10)||CHR(10)||CHR(10)||'YOUR DATABASE IS READY FOR UPGRADE TO VERSION OMERO5.3DEV__12'||CHR(10)||CHR(10)||CHR(10) AS Status;
SELECT CHR(10)||CHR(10)||CHR(10)||'YOUR DATABASE IS READY FOR UPGRADE TO VERSION OMERO5.3DEV__13'||CHR(10)||CHR(10)||CHR(10) AS Status;

ROLLBACK;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
--

---
--- OMERO5 development release upgrade from OMERO5.2__0 to OMERO5.3DEV__12.
--- OMERO5 development release upgrade from OMERO5.2__0 to OMERO5.3DEV__13.
---

BEGIN;
Expand Down Expand Up @@ -95,7 +95,7 @@ DROP FUNCTION db_pretty_version(INTEGER);
--

INSERT INTO dbpatch (currentVersion, currentPatch, previousVersion, previousPatch)
VALUES ('OMERO5.3DEV', 12, 'OMERO5.2', 0);
VALUES ('OMERO5.3DEV', 13, 'OMERO5.2', 0);

-- ... up to patch 0:

Expand Down Expand Up @@ -1976,17 +1976,45 @@ CREATE OR REPLACE FUNCTION filesetjoblink_parent_index_move() RETURNS trigger

DELETE FROM format WHERE id NOT IN (SELECT DISTINCT format FROM image WHERE format IS NOT NULL) AND external_id IS NULL;

-- ... up to patch 13:

ALTER TABLE annotation ALTER COLUMN name TYPE TEXT;
ALTER TABLE annotation ALTER COLUMN ns TYPE TEXT;
ALTER TABLE channel ALTER COLUMN lookuptable TYPE TEXT;
ALTER TABLE dataset ALTER COLUMN name TYPE TEXT;
ALTER TABLE folder ALTER COLUMN name TYPE TEXT;
ALTER TABLE image ALTER COLUMN name TYPE TEXT;
ALTER TABLE importjob ALTER COLUMN imagename TYPE TEXT;
ALTER TABLE importjob ALTER COLUMN imagedescription TYPE TEXT;
ALTER TABLE logicalchannel ALTER COLUMN name TYPE TEXT;
ALTER TABLE namespace ALTER COLUMN name TYPE TEXT;
ALTER TABLE namespace ALTER COLUMN displayname TYPE TEXT;
ALTER TABLE originalfile ALTER COLUMN name TYPE TEXT;
ALTER TABLE originalfile ALTER COLUMN hash TYPE TEXT;
ALTER TABLE plate ALTER COLUMN name TYPE TEXT;
ALTER TABLE plate ALTER COLUMN status TYPE TEXT;
ALTER TABLE plateacquisition ALTER COLUMN name TYPE TEXT;
ALTER TABLE project ALTER COLUMN name TYPE TEXT;
ALTER TABLE reagent ALTER COLUMN name TYPE TEXT;
ALTER TABLE renderingdef ALTER COLUMN name TYPE TEXT;
ALTER TABLE roi ALTER COLUMN name TYPE TEXT;
ALTER TABLE screen ALTER COLUMN name TYPE TEXT;
ALTER TABLE screen ALTER COLUMN protocoldescription TYPE TEXT;
ALTER TABLE screen ALTER COLUMN reagentsetdescription TYPE TEXT;
ALTER TABLE stagelabel ALTER COLUMN name TYPE TEXT;
ALTER TABLE well ALTER COLUMN externaldescription TYPE TEXT;


--
-- FINISHED
--

UPDATE dbpatch SET message = 'Database updated.', finished = clock_timestamp()
WHERE currentVersion = 'OMERO5.3DEV' AND
currentPatch = 12 AND
currentPatch = 13 AND
previousVersion = 'OMERO5.2' AND
previousPatch = 0;

SELECT CHR(10)||CHR(10)||CHR(10)||'YOU HAVE SUCCESSFULLY UPGRADED YOUR DATABASE TO VERSION OMERO5.3DEV__12'||CHR(10)||CHR(10)||CHR(10) AS Status;
SELECT CHR(10)||CHR(10)||CHR(10)||'YOU HAVE SUCCESSFULLY UPGRADED YOUR DATABASE TO VERSION OMERO5.3DEV__13'||CHR(10)||CHR(10)||CHR(10) AS Status;

COMMIT;
96 changes: 96 additions & 0 deletions sql/psql/OMERO5.3DEV__13/OMERO5.3DEV__12.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
-- Copyright (C) 2012-4 Glencoe Software, Inc. All rights reserved.
-- Use is subject to license terms supplied in LICENSE.txt
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--

---
--- OMERO5 development release upgrade from OMERO5.3DEV__12 to OMERO5.3DEV__13.
---

BEGIN;


--
-- check OMERO database version
--

CREATE OR REPLACE FUNCTION omero_assert_db_version(expected_version VARCHAR, expected_patch INTEGER) RETURNS void AS $$

DECLARE
current_version VARCHAR;
current_patch INTEGER;

BEGIN
SELECT currentversion, currentpatch INTO STRICT current_version, current_patch
FROM dbpatch ORDER BY id DESC LIMIT 1;

IF current_version <> expected_version OR current_patch <> expected_patch THEN
RAISE EXCEPTION 'wrong OMERO database version for this upgrade script';
END IF;

END;$$ LANGUAGE plpgsql;

SELECT omero_assert_db_version('OMERO5.3DEV', 12);
DROP FUNCTION omero_assert_db_version(varchar, int);


--
-- Actual upgrade
--

INSERT INTO dbpatch (currentVersion, currentPatch, previousVersion, previousPatch)
VALUES ('OMERO5.3DEV', 13, 'OMERO5.3DEV', 12);

ALTER TABLE annotation ALTER COLUMN name TYPE TEXT;
ALTER TABLE annotation ALTER COLUMN ns TYPE TEXT;
ALTER TABLE channel ALTER COLUMN lookuptable TYPE TEXT;
ALTER TABLE dataset ALTER COLUMN name TYPE TEXT;
ALTER TABLE folder ALTER COLUMN name TYPE TEXT;
ALTER TABLE image ALTER COLUMN name TYPE TEXT;
ALTER TABLE importjob ALTER COLUMN imagename TYPE TEXT;
ALTER TABLE importjob ALTER COLUMN imagedescription TYPE TEXT;
ALTER TABLE logicalchannel ALTER COLUMN name TYPE TEXT;
ALTER TABLE namespace ALTER COLUMN name TYPE TEXT;
ALTER TABLE namespace ALTER COLUMN displayname TYPE TEXT;
ALTER TABLE originalfile ALTER COLUMN name TYPE TEXT;
ALTER TABLE originalfile ALTER COLUMN hash TYPE TEXT;
ALTER TABLE plate ALTER COLUMN name TYPE TEXT;
ALTER TABLE plate ALTER COLUMN status TYPE TEXT;
ALTER TABLE plateacquisition ALTER COLUMN name TYPE TEXT;
ALTER TABLE project ALTER COLUMN name TYPE TEXT;
ALTER TABLE reagent ALTER COLUMN name TYPE TEXT;
ALTER TABLE renderingdef ALTER COLUMN name TYPE TEXT;
ALTER TABLE roi ALTER COLUMN name TYPE TEXT;
ALTER TABLE screen ALTER COLUMN name TYPE TEXT;
ALTER TABLE screen ALTER COLUMN protocoldescription TYPE TEXT;
ALTER TABLE screen ALTER COLUMN reagentsetdescription TYPE TEXT;
ALTER TABLE stagelabel ALTER COLUMN name TYPE TEXT;
ALTER TABLE well ALTER COLUMN externaldescription TYPE TEXT;


--
-- FINISHED
--

UPDATE dbpatch SET message = 'Database updated.', finished = clock_timestamp()
WHERE currentVersion = 'OMERO5.3DEV' AND
currentPatch = 13 AND
previousVersion = 'OMERO5.3DEV' AND
previousPatch = 12;

SELECT CHR(10)||CHR(10)||CHR(10)||'YOU HAVE SUCCESSFULLY UPGRADED YOUR DATABASE TO VERSION OMERO5.3DEV__13'||CHR(10)||CHR(10)||CHR(10) AS Status;

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ alter table dbpatch alter message set default 'Updating';
-- running so that if anything goes wrong, we'll have some record.
--
insert into dbpatch (currentVersion, currentPatch, previousVersion, previousPatch, message)
values ('OMERO5.3DEV', 12, 'OMERO5.3DEV', 0, 'Initializing');
values ('OMERO5.3DEV', 13, 'OMERO5.3DEV', 0, 'Initializing');

--
-- Temporarily make event columns nullable; restored below.
Expand Down Expand Up @@ -3162,7 +3162,7 @@ CREATE TRIGGER preserve_folder_tree
-- Here we have finished initializing this database.
update dbpatch set message = 'Database ready.', finished = clock_timestamp()
where currentVersion = 'OMERO5.3DEV' and
currentPatch = 12 and
currentPatch = 13 and
previousVersion = 'OMERO5.3DEV' and
previousPatch = 0;

Expand Down
File renamed without changes.
Loading

0 comments on commit 8ed4bfd

Please sign in to comment.