source: trunk/src/core/common-queries.xml @ 5456

Last change on this file since 5456 was 5456, checked in by Nicklas Nordborg, 12 years ago

References #1532: Add bioplate type to bioplates

Added BioPlateType?.getLockMode() and Well.getOriginalBioMaterial() link. Extended test programs to makes sure locking is working as expected. Changes to the gui are not yet complete. The JSPs compiles but locking options are not considered.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 94.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE predefined-queries SYSTEM "predefined-queries.dtd" >
3<!--
4  $Id: common-queries.xml 5456 2010-10-28 12:12:26Z nicklas $
5
6  Copyright (C) 2005 Samuel Andersson, Johan Enell, Nicklas Nordborg
7  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
8  Copyright (C) 2007 Johan Enell, Nicklas Nordborg, Martin Svensson
9
10  This file is part of BASE - BioArray Software Environment.
11  Available at http://base.thep.lu.se/
12
13  BASE is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License
15  as published by the Free Software Foundation; either version 3
16  of the License, or (at your option) any later version.
17
18  BASE is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  GNU General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with BASE. If not, see <http://www.gnu.org/licenses/>.
25-->
26<!--
27  This XML file contains HQL and SQL queries that are common
28  to all databases. If one of them happens to fail on your
29  particular database, do not modify this file. Instead, you
30  should add an entry into the file that is specific for your
31  particular database that overrides the query in this file.
32  For example, for MySQL modify the mysql-queries.xml.
33-->
34<predefined-queries>
35
36  <query id="LOAD_SYSTEM_ITEMS" type="HQL">
37    <sql>
38      SELECT item.id, item.systemId
39      FROM net.sf.basedb.core.data.SystemData item
40      WHERE NOT item.systemId IS NULL
41    </sql>
42    <description>
43      Load the ID and systemID, in that order, of all SystemData
44      items.
45    </description>
46  </query>
47
48  <query id="LOAD_ROLE_KEY_IDS" type="HQL">
49    <sql>
50      SELECT rk.id, rk.itemType
51      FROM RoleKeyData rk
52    </sql>
53    <description>
54      Load the ID and itemType, in that order, of all RoleKeyData
55      items.
56    </description>
57  </query>
58
59  <query id="GET_USER_FOR_LOGIN" type="HQL">
60    <sql>
61      SELECT usr
62      FROM UserData usr
63      WHERE usr.login = :login
64    </sql>
65    <description>
66      Load a user when you know the login.
67    </description>
68  </query>
69 
70  <query id="GET_USER_FOR_EXTERNAL_ID" type="HQL">
71    <sql>
72      SELECT usr
73      FROM UserData usr
74      WHERE usr.externalId = :externalId
75    </sql>
76    <description>
77      Load a user when you know the external id.
78    </description>
79  </query>
80
81  <query id="GET_CLIENT_FOR_EXTERNAL_ID" type="HQL">
82    <sql>
83      SELECT cli
84      FROM ClientData cli
85      WHERE cli.externalId = :externalId
86    </sql>
87    <description>
88      Load a client when you know the external ID.
89    </description>
90  </query>
91 
92  <query id="GET_ROLE_IDS_FOR_USER" type="HQL">
93    <sql>
94      SELECT ur.roleId
95      FROM UserRoles ur
96      WHERE ur.userId = :userId
97    </sql>
98    <description>
99      Load the ID of all roles where the given user is a member.
100    </description>
101  </query>
102
103  <query id="GET_GROUP_IDS_FOR_USER" type="HQL">
104    <sql>
105      SELECT ug.groupId
106      FROM UserGroups ug
107      WHERE ug.userId = :userId
108    </sql>
109    <description>
110      Load the ID of all groups where the given user is a direct member.
111    </description>
112  </query>
113 
114  <query id="GET_QUOTA_GROUP_ID_FOR_USER" type="HQL">
115    <sql>
116      SELECT usr.quotaGroup.id
117      FROM UserData usr
118      WHERE usr.id = :userId
119    </sql>
120    <description>
121      Load the ID of a user's quota group.
122    </description>
123  </query>
124
125  <query id="GET_PARENTGROUPS_IDS_FOR_GROUPS" type="HQL">
126    <sql>
127      SELECT DISTINCT gg.parentId
128      FROM GroupGroups gg
129      WHERE gg.childId IN (:groups)
130      AND gg.parentId NOT IN (:groups)
131    </sql>
132    <description>
133      Load the ID of all groups that are parents to at least one of
134      the given groups, excluding the given groups.
135    </description>
136  </query>
137 
138  <query id="GET_CHILDGROUPS_IDS_FOR_GROUPS" type="HQL">
139    <sql>
140      SELECT DISTINCT gg.childId
141      FROM GroupGroups gg
142      WHERE gg.parentId IN (:groups)
143      AND gg.childId NOT IN (:groups)
144    </sql>
145    <description>
146      Load the ID of all groups that are children to at least one of
147      the given groups, excluding the given groups.
148    </description>
149  </query>
150
151  <query id="GET_PROJECT_IDS_FOR_OWNER" type="HQL">
152    <sql>
153      SELECT p.id
154      FROM ProjectData p
155      WHERE p.owner = :userId
156    </sql>
157    <description>
158      Load the ID of all projects where the given user is the owner.
159    </description>
160  </query>
161
162  <query id="GET_PROJECTINFO_FOR_USER" type="HQL">
163    <sql>
164      SELECT up
165      FROM UserProjects up
166      WHERE up.userId = :userId
167    </sql>
168    <description>
169      Load the UserProjects of all projects where the given user is a member.
170    </description>
171  </query>
172
173  <query id="GET_PROJECTINFO_FOR_GROUPS" type="HQL">
174    <sql>
175      SELECT DISTINCT gp
176      FROM GroupProjects gp
177      WHERE gp.groupId IN (:groups)
178    </sql>
179    <description>
180      Load the GroupProjects of all projects where at least one of the given groups
181      is a member.
182    </description>
183  </query>
184
185  <query id="GET_USER_IDS_FOR_GROUPS" type="HQL">
186    <sql>
187      SELECT ug.userId
188      FROM UserGroups ug
189      WHERE ug.groupId IN (:groups)
190    </sql>
191    <description>
192      Load the ID of all users which is a member of at least one of the given groups.
193    </description>
194  </query>
195
196  <query id="GET_USER_IDS_FOR_QUOTAGROUPS" type="HQL">
197    <sql>
198      SELECT usr.id
199      FROM UserData usr
200      WHERE usr.quotaGroup.id IN (:groups)
201    </sql>
202    <description>
203      Load the ID of all users which has a quota group from one of the given groups.
204    </description>
205  </query>
206
207  <query id="GET_USER_IDS_FOR_PROJECT" type="HQL">
208    <sql>
209      SELECT up.userId
210      FROM UserProjects up
211      WHERE up.projectId = :projectId
212    </sql>
213    <description>
214      Load the ID of all users which are direct member of the given project
215    </description>
216  </query>
217
218  <query id="GET_GROUP_IDS_FOR_PROJECT" type="HQL">
219    <sql>
220      SELECT gp.groupId
221      FROM GroupProjects gp
222      WHERE gp.projectId = :projectId
223    </sql>
224    <description>
225      Load the ID of all groups which are direct member of the given project
226    </description>
227  </query>
228
229  <query id="GET_USERKEYS_FOR_USER" type="HQL">
230    <sql>
231      SELECT uk
232      FROM UserKeys uk
233      WHERE uk.userId = :userId
234    </sql>
235    <description>
236      Load the UserKeys for the given user.
237    </description>
238  </query>
239
240  <query id="GET_GROUPKEYS_FOR_GROUPS" type="HQL">
241    <sql>
242      SELECT gk
243      FROM GroupKeys gk
244      WHERE gk.groupId IN (:groups)
245    </sql>
246    <description>
247      Load the GroupKeys for the given groups.
248    </description>
249  </query>
250
251  <query id="GET_ROLEKEYS_FOR_USER" type="HQL">
252    <sql>
253      SELECT rk
254      FROM RoleKeys rk, UserRoles ur
255      WHERE rk.roleId = ur.roleId AND ur.userId = :userId
256      ORDER BY rk.keyId
257    </sql>
258    <description>
259      Load the RoleKeys for the roles where the given user is a member.
260    </description>
261  </query>
262
263  <query id="GET_PROJECTKEYS_FOR_PROJECT" type="HQL">
264    <sql>
265      SELECT pk
266      FROM ProjectKeys pk
267      WHERE pk.projectId = :projectId
268      ORDER BY pk.keyId
269    </sql>
270    <description>
271      Load the ProjectKeys for the given project. Sort by
272      keyId for fast lookup in array (Keyring class).
273    </description>
274  </query>
275 
276  <query id="GET_PROJECTKEYIDS_FOR_PROJECT" type="HQL">
277    <sql>
278      SELECT pk.keyId
279      FROM ProjectKeys pk
280      WHERE pk.projectId = :projectId
281    </sql>
282    <description>
283      Load the ID of ProjectKeys for the given project.
284    </description>
285  </query>
286
287  <query id="GET_PERMISSION_FOR_USER_IN_PROJECT" type="HQL">
288    <sql>
289      SELECT up.permission
290      FROM UserProjects up
291      WHERE up.userId = :userId
292      AND up.projectId = :projectId
293    </sql>
294    <description>
295      Load the permission for the given user in the given project.
296    </description>
297  </query>
298
299  <query id="GET_PERMISSIONS_FOR_GROUPS_IN_PROJECT" type="HQL">
300    <sql>
301      SELECT gp.permission
302      FROM GroupProjects gp
303      WHERE gp.groupId IN (:groups)
304      AND gp.projectId = :projectId
305    </sql>
306    <description>
307      Load the permissions for the given groups in the given project.
308    </description>
309  </query>
310
311  <query id="GET_PROJECTKEY_IDS_FOR_COUNT" type="HQL">
312    <sql>
313      SELECT pk.keyId FROM ProjectKeys pk
314      GROUP BY pk.keyId
315      HAVING count(pk.projectId) = :numPermissions
316    </sql>
317    <description>
318      Load the ID of all project keys which have permissions for the
319      specified number of projects.
320    </description>
321  </query>
322
323  <query id="FIND_USED_PROJECTKEY_IDS" type="HQL">
324    <sql>
325      SELECT DISTINCT sd.projectKey.id
326      FROM net.sf.basedb.core.data.ShareableData sd
327      WHERE NOT sd.projectKey IS NULL
328    </sql>
329    <description>
330      Load the ID of all project keys which are used by at least one
331      shareable item.
332    </description>
333  </query>
334 
335  <query id="SELECT_UNUSED_PROJECTKEYS" type="HQL">
336    <sql>
337      SELECT pk FROM ProjectKeyData pk
338      WHERE pk.id NOT IN (:used)
339    </sql>
340    <description>
341      Load all unused project keys given a list of the ID:s of all used
342      keys.
343    </description>
344  </query>
345
346  <query id="GET_ITEMKEY_IDS_FOR_USERCOUNT" type="HQL">
347    <sql>
348      SELECT ik.id FROM ItemKeyData ik
349      LEFT JOIN ik.users u
350      GROUP BY ik.id
351      HAVING COUNT(u.index) = :numPermissions
352    </sql>
353    <description>
354      Load the ID of all item keys which have permissions for the
355      specified number of users.
356    </description>
357  </query>
358
359  <query id="GET_ITEMKEY_IDS_FOR_GROUPCOUNT" type="HQL">
360    <sql>
361      SELECT ik.id FROM ItemKeyData ik
362      LEFT JOIN ik.groups g
363      WHERE ik.id IN (:candidates)
364      GROUP BY ik.id
365      HAVING count(g.index) = :numPermissions
366    </sql>
367    <description>
368      Load the ID of all item keys which have permissions for the
369      specified number of groups and are among the list of candidates.
370    </description>
371  </query>
372 
373  <query id="FIND_USED_ITEMKEY_IDS" type="HQL">
374    <sql>
375      SELECT DISTINCT sd.itemKey.id
376      FROM net.sf.basedb.core.data.ShareableData sd
377      WHERE NOT sd.itemKey IS NULL
378    </sql>
379    <description>
380      Load the ID of all item keys which are used by at least one
381      shareable item.
382    </description>
383  </query>
384 
385  <query id="SELECT_UNUSED_ITEMKEYS" type="HQL">
386    <sql>
387      SELECT ik FROM ItemKeyData ik
388      WHERE ik.id NOT IN (:used)
389    </sql>
390    <description>
391      Load all unused item keys given a list of the ID:s of all used
392      keys.
393    </description>
394  </query>
395
396  <query id="GET_USERS_FOR_QUOTAGROUP" type="HQL">
397    <sql>
398      SELECT {1}
399      FROM UserData usr
400      WHERE usr.quotaGroup = :theGroup
401    </sql>
402    <description>
403      Get users having the specified group as
404      their quota group.
405    </description>
406  </query>
407 
408  <query id="GET_USERS_FOR_QUOTA" type="HQL">
409    <sql>
410      SELECT {1}
411      FROM UserData u
412      WHERE u.quota = :quota
413    </sql>
414    <description>
415      A Hibernate query that gets users
416      that has been assigned a given quota.
417    </description>
418  </query>
419 
420  <query id="GET_GROUPS_FOR_QUOTA" type="HQL">
421    <sql>
422      SELECT {1}
423      FROM GroupData g
424      WHERE g.quota = :quota
425    </sql>
426    <description>
427      A Hibernate query that gets groups
428      that has been assigned a given quota.
429    </description>
430  </query>
431
432  <query id="GET_SHAREABLE_ITEMS_FOR_ITEMKEY" type="HQL">
433    <sql>
434      SELECT s
435      FROM net.sf.basedb.core.data.ShareableData s
436      WHERE s.itemKey = :itemKey
437    </sql>
438    <description>
439      Get all items beeing shared to the specified item key.
440    </description>
441  </query>
442
443  <query id="GET_SHAREABLE_ITEMS_FOR_PROJECTKEY" type="HQL">
444    <sql>
445      SELECT s
446      FROM net.sf.basedb.core.data.ShareableData s
447      WHERE s.projectKey = :projectKey
448    </sql>
449    <description>
450      Get all items beeing shared to the specified project key.
451    </description>
452  </query>
453 
454  <query id="GET_SHARED_ITEMS" type="HQL">
455    <sql>
456      SELECT s
457      FROM net.sf.basedb.core.data.ShareableData s
458    </sql>
459    <description>
460      Get all shared items.
461    </description>
462  </query>
463
464  <query id="GET_OWNABLE_ITEMS_FOR_USER" type="HQL">
465    <sql>
466      SELECT o
467      FROM net.sf.basedb.core.data.OwnableData o
468      WHERE o.owner = :user
469    </sql>
470    <description>
471      Get all items that are owned by the specified user.
472    </description>
473  </query>
474 
475  <query id="GET_DISKCONSUMABLE_ITEMS_FOR_USER" type="HQL">
476    <sql>
477      SELECT o
478      FROM net.sf.basedb.core.data.DiskConsumableData o
479      WHERE o.owner = :user
480    </sql>
481    <description>
482      Get all diskconsumable items that are owned by the specified user.
483    </description>
484  </query>
485
486 
487  <query id="LOAD_USER_CLIENT_SETTINGS" type="HQL">
488    <sql>
489      SELECT s
490      FROM UserClientSettingData s
491      WHERE s.user = :user AND s.client = :client
492    </sql>
493    <description>
494      Load all settings for the specified user and client application.
495    </description>
496  </query>
497 
498  <query id="LOAD_USER_DEFAULT_SETTINGS" type="HQL">
499    <sql>
500      SELECT s
501      FROM UserDefaultSettingData s
502      WHERE s.user = :user
503    </sql>
504    <description>
505      Load all default settings for the specified user.
506    </description>
507  </query>
508
509  <query id="LOAD_CLIENT_DEFAULT_SETTINGS" type="HQL">
510    <sql>
511      SELECT s
512      FROM ClientDefaultSettingData s
513      WHERE s.client = :client
514    </sql>
515    <description>
516      Load all default settings for the specified client application.
517    </description>
518  </query>
519 
520  <query id="GET_MIME_TYPE_FROM_EXTENSION" type="HQL">
521    <sql>
522      SELECT s
523      FROM net.sf.basedb.core.data.MimeTypeData s
524      WHERE LOWER(s.extension) = LOWER(:extension)
525    </sql>
526    <description>
527      A Hibernate query that returns a MimeType given an extension.
528    </description>
529  </query>
530 
531  <query id="GET_TOTAL_DISKUSAGE_FOR_USER" type="HQL">
532    <sql>
533      SELECT sum(du.bytes)
534      FROM DiskUsageData du
535      WHERE du.user = :user
536      AND du.location = :location
537    </sql>
538    <description>
539      A Hibernate query that returns the total used quota
540      for the specified user at the specified location.
541    </description>
542  </query>
543 
544  <query id="GET_SPECIFIC_DISKUSAGE_FOR_USER" type="HQL">
545    <sql>
546      SELECT sum(du.bytes)
547      FROM DiskUsageData du
548      WHERE du.user = :user
549      AND du.location = :location
550      AND du.quotaType = :quotaType
551    </sql>
552    <description>
553      A Hibernate query that returns the used quota for the
554      specific quota type for the specified user at the
555      specified location.
556    </description>
557  </query>
558
559  <query id="GET_TOTAL_DISKUSAGE_FOR_GROUP" type="HQL">
560    <sql>
561      SELECT sum(du.bytes)
562      FROM DiskUsageData du
563      WHERE du.group = :group
564      AND du.location = :location
565    </sql>
566    <description>
567      A Hibernate query that returns the total used quota
568      for the specified group at the specified location.
569    </description>
570  </query>
571
572  <query id="GET_SPECIFIC_DISKUSAGE_FOR_GROUP" type="HQL">
573    <sql>
574      SELECT sum(du.bytes)
575      FROM DiskUsageData du
576      WHERE du.group = :group
577      AND du.location = :location
578      AND du.quotaType = :quotaType
579    </sql>
580    <description>
581      A Hibernate query that returns the used quota for the
582      specific quota type for the specified group at the
583      specified location.
584    </description>
585  </query>
586
587  <query id="GET_TOTAL_DISKUSAGE_SUMMARY" type="HQL">
588    <sql>
589      SELECT SUM(du.bytes), du.location, du.quotaType.systemId
590      FROM DiskUsageData du
591      GROUP BY du.location, du.quotaType.systemId
592    </sql>
593    <description>
594      A Hibernate query that returns the total disk usage grouped
595      by location and quota type system id.
596    </description>
597  </query>
598
599  <query id="GET_DISKUSAGE_SUMMARY_FOR_USER" type="HQL">
600    <sql>
601      SELECT SUM(du.bytes), du.location, du.quotaType.systemId
602      FROM DiskUsageData du
603      WHERE du.user = :user
604      GROUP BY du.location, du.quotaType.systemId
605    </sql>
606    <description>
607      A Hibernate query that returns the disk usage for a user grouped
608      by location and quota type system id.
609    </description>
610  </query>
611
612  <query id="GET_DISKUSAGE_SUMMARY_FOR_GROUP" type="HQL">
613    <sql>
614      SELECT SUM(du.bytes), du.location, du.quotaType.systemId
615      FROM DiskUsageData du
616      WHERE du.group = :group
617      GROUP BY du.location, du.quotaType.systemId
618    </sql>
619    <description>
620      A Hibernate query that returns the disk usage for a group grouped
621      by location and quota type system id.
622    </description>
623  </query>
624 
625  <query id="GET_FILES_IN_DIRECTORY" type="HQL">
626    <sql>
627      SELECT {1}
628      FROM FileData f
629      WHERE f.directory = :directory
630    </sql>
631    <description>
632      A Hibernate query that gets the files
633      in a given directory.
634    </description>
635  </query>
636 
637  <query id="GET_FILES_FOR_FILETYPE" type="HQL">
638    <sql>
639      SELECT {1}
640      FROM FileData f
641      WHERE f.fileType = :filetype
642    </sql>
643    <description>
644      A Hibernate query that gets the files
645      with a given filetype.
646    </description>
647  </query>
648
649  <query id="GET_FILES_FOR_FILESERVER" type="HQL">
650    <sql>
651      SELECT {1}
652      FROM FileData f
653      WHERE f.fileServer = :fileServer
654    </sql>
655    <description>
656      A Hibernate query that gets the files
657      with a given file server.
658    </description>
659  </query>
660
661
662  <query id="GET_SUBDIRECTORIES_IN_DIRECTORY" type="HQL">
663    <sql>
664      SELECT {1}
665      FROM DirectoryData d
666      WHERE d.parent = :directory
667    </sql>
668    <description>
669      A Hibernate query that gets the subdirectories
670      in a given directory.
671    </description>
672  </query>
673 
674  <query id="GET_HOME_DIRECTORIES" type="HQL">
675    <sql>
676      SELECT {1}
677      FROM UserData usr
678      WHERE usr.homeDirectory = :directory
679    </sql>
680    <description>
681      A Hibernate query that gets the users having
682      the specified directory as home directory.
683    </description>
684  </query>
685 
686  <query id="GET_EXPERIMENT_DIRECTORIES" type="HQL">
687    <sql>
688      SELECT {1}
689      FROM ExperimentData xpr
690      WHERE xpr.directory = :directory
691    </sql>
692    <description>
693      A Hibernate query that gets the experiments having
694      the specified directory as the plugin directory.
695    </description>
696  </query>
697
698  <query id="GET_SUBDIRECTORIES" type="HQL">
699    <sql>
700      SELECT dir
701      FROM DirectoryData dir
702      WHERE dir.parent = :parent
703    </sql>
704    <description>
705      A Hibernate query that returns all subdirectories in a directory.
706    </description>
707  </query>
708 
709  <query id="GET_SUBDIRECTORY_WITH_NAME" type="HQL">
710    <sql>
711      SELECT dir
712      FROM DirectoryData dir
713      WHERE dir.name = :name
714      AND dir.parent = :parent
715    </sql>
716    <description>
717      A Hibernate query that returns the a subdirectory with the
718      specified name in a given directory.
719    </description>
720  </query>
721
722  <query id="GET_FILE_TYPE_WITH_NAME" type="HQL">
723    <sql>
724      SELECT ft
725      FROM FileTypeData ft
726      WHERE ft.name = :name
727    </sql>
728    <description>
729      A Hibernate query that returns the file type with the specified
730      name.
731    </description>
732  </query>
733 
734  <query id="GET_QUOTA_TYPE_WITH_NAME" type="HQL">
735    <sql>
736      SELECT qt
737      FROM QuotaTypeData qt
738      WHERE qt.name = :name
739    </sql>
740    <description>
741      A Hibernate query that returns the quota type with the specified
742      name.
743    </description>
744  </query>
745 
746  <query id="GET_QUOTA_WITH_NAME" type="HQL">
747    <sql>
748      SELECT q
749      FROM QuotaData q
750      WHERE q.name = :name
751    </sql>
752    <description>
753      A Hibernate query that returns the quota with the specified
754      name.
755    </description>
756  </query>
757 
758  <query id="GET_GROUP_WITH_NAME" type="HQL">
759    <sql>
760      SELECT grp
761      FROM GroupData grp
762      WHERE grp.name = :name
763    </sql>
764    <description>
765      A Hibernate query that returns the group with the specified
766      name.
767    </description>
768  </query>
769 
770  <query id="GET_ROLE_WITH_NAME" type="HQL">
771    <sql>
772      SELECT rle
773      FROM RoleData rle
774      WHERE rle.name = :name
775    </sql>
776    <description>
777      A Hibernate query that returns the role with the specified
778      name.
779    </description>
780  </query>
781 
782  <query id="GET_PROTOCOL_TYPE_WITH_NAME" type="HQL">
783    <sql>
784      SELECT pt
785      FROM ProtocolTypeData pt
786      WHERE pt.name = :name
787    </sql>
788    <description>
789      A Hibernate query that returns the protocol type with the specified
790      name.
791    </description>
792  </query>
793 
794  <query id="GET_SOFTWARE_TYPE_WITH_NAME" type="HQL">
795    <sql>
796      SELECT st
797      FROM SoftwareTypeData st
798      WHERE st.name = :name
799    </sql>
800    <description>
801      A Hibernate query that returns the software type with the specified
802      name.
803    </description>
804  </query>
805 
806  <query id="GET_SOFTWARE_WITH_NAME" type="HQL">
807    <sql>
808      SELECT sw
809      FROM SoftwareData sw
810      WHERE sw.name = :name
811    </sql>
812    <description>
813      A Hibernate query that returns the software with the specified
814      name.
815    </description>
816  </query>
817 
818  <query id="GET_HARDWARE_TYPE_WITH_NAME" type="HQL">
819    <sql>
820      SELECT ht
821      FROM HardwareTypeData ht
822      WHERE ht.name = :name
823    </sql>
824    <description>
825      A Hibernate query that returns the hardware type with the specified
826      name.
827    </description>
828  </query>
829 
830  <query id="GET_HARDWARE_WITH_NAME" type="HQL">
831    <sql>
832      SELECT hw
833      FROM HardwareData hw
834      WHERE hw.name = :name
835    </sql>
836    <description>
837      A Hibernate query that returns the hardware with the specified
838      name.
839    </description>
840  </query>
841 
842  <query id="GET_PLATE_GEOMETRY_WITH_NAME" type="HQL">
843    <sql>
844      SELECT pg
845      FROM PlateGeometryData pg
846      WHERE pg.name = :name
847    </sql>
848    <description>
849      A Hibernate query that returns the plate geometry with the specified
850      name.
851    </description>
852  </query>
853
854  <query id="GET_PLATE_GEOMETRY_WITH_SIZE" type="HQL">
855    <sql>
856      SELECT pg
857      FROM PlateGeometryData pg
858      WHERE pg.rows = :rows AND pg.columns = :columns
859    </sql>
860    <description>
861      A Hibernate query that returns the plate geometry with the specified
862      size (rows and columns).
863    </description>
864  </query>
865
866  <query id="GET_PLATE_MAPPING_WITH_NAME" type="HQL">
867    <sql>
868      SELECT pm
869      FROM PlateMappingData pm
870      WHERE pm.name = :name
871    </sql>
872    <description>
873      A Hibernate query that returns the plate mapping with the specified
874      name.
875    </description>
876  </query>
877 
878  <query id="GET_PLATE_MAPPING_WITH_PROPERTIES" type="HQL">
879    <sql>
880      SELECT pm
881      FROM PlateMappingData pm
882      WHERE pm.sourceCount = :sourceCount AND pm.sourceGeometry = :sourceGeometry
883      AND pm.destinationCount = :destinationCount AND pm.destinationGeometry = :destinationGeometry
884    </sql>
885    <description>
886      A Hibernate query that returns the plate mapping with the specified
887      source and destination properties.
888    </description>
889  </query>
890 
891  <query id="GET_LABEL_WITH_NAME" type="HQL">
892    <sql>
893      SELECT lbl
894      FROM LabelData lbl
895      WHERE lbl.name = :name
896    </sql>
897    <description>
898      A Hibernate query that returns the label with the specified
899      name.
900    </description>
901  </query>
902 
903  <query id="GET_ANNOTATION_TYPE_WITH_NAME" type="HQL">
904    <sql>
905      SELECT at
906      FROM AnnotationTypeData at
907      WHERE at.name = :name
908    </sql>
909    <description>
910      A Hibernate query that returns the annotation type with the specified
911      name.
912    </description>
913  </query>
914 
915  <query id="GET_NEWS_WITH_NAME" type="HQL">
916    <sql>
917      SELECT nws
918      FROM NewsData nws
919      WHERE nws.name = :name
920    </sql>
921    <description>
922      A Hibernate query that returns the news with the specified
923      name.
924    </description>
925  </query>
926
927  <query id="GET_FILE_IN_DIRECTORY" type="HQL">
928    <sql>
929      SELECT f
930      FROM FileData f
931      WHERE f.directory = :directory
932      AND f.name = :name
933    </sql>
934    <description>
935      A Hibernate query that returns the file with the specified
936      name in a given directory.
937    </description>
938  </query>
939
940  <query id="GET_PROTOCOLS_FOR_PROTOCOLTYPE" type="HQL">
941    <sql>
942      SELECT {1}
943      FROM ProtocolData p
944      WHERE p.protocolType = :protocolType
945    </sql>
946    <description>
947      Get the protocols the uses a protocol type.
948    </description>
949  </query>
950
951  <query id="GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE" type="HQL">
952    <sql>
953      SELECT {1}
954      FROM PlateEventTypeData pet
955      WHERE pet.protocolType = :protocolType
956    </sql>
957    <description>
958      Get the plate events types that uses a protocol type.
959    </description>
960  </query>
961 
962  <query id="GET_BIOMATERIALEVENTS_FOR_PROTOCOL" type="HQL">
963    <sql>
964      SELECT {1}
965      FROM BioMaterialEventData bme
966      WHERE bme.protocol = :protocol
967    </sql>
968    <description>
969      A Hibernate query that gets biomaterial
970      events using a protocol.
971    </description>
972  </query>
973
974  <query id="GET_PLATEEVENTS_FOR_PROTOCOL" type="HQL">
975    <sql>
976      SELECT {1}
977      FROM PlateEventData pe
978      WHERE pe.protocol = :protocol
979    </sql>
980    <description>
981      A Hibernate query thatgets plate events
982      using a protocol.
983    </description>
984  </query>
985
986  <query id="GET_ARRAYBATCHES_FOR_PROTOCOL" type="HQL">
987    <sql>
988      SELECT {1}
989      FROM ArrayBatchData ab
990      WHERE ab.protocol = :protocol
991    </sql>
992    <description>
993      A Hibernate query that gets array batches
994      using a protocol.
995    </description>
996  </query>
997
998  <query id="GET_SCANS_FOR_PROTOCOL" type="HQL">
999    <sql>
1000      SELECT {1}
1001      FROM ScanData sc
1002      WHERE sc.protocol = :protocol
1003    </sql>
1004    <description>
1005      A Hibernate query that gets scans
1006      using a protocol.
1007    </description>
1008  </query>
1009
1010  <query id="GET_RAWBIOASSAYS_FOR_PROTOCOL" type="HQL">
1011    <sql>
1012      SELECT {1}
1013      FROM RawBioAssayData rba
1014      WHERE rba.protocol = :protocol
1015    </sql>
1016    <description>
1017      A Hibernate query that gets raw bioassays
1018      using a protocol.
1019    </description>
1020  </query>
1021
1022  <query id="FIND_USED_FILES" type="HQL">
1023    <sql>
1024      SELECT fad
1025      FROM net.sf.basedb.core.data.FileAttachableData fad
1026      WHERE fad.file = :file
1027    </sql>
1028    <description>
1029      Load the files that is used by any FileAttachableData.
1030    </description>
1031  </query>
1032
1033  <query id="GET_SPOTIMAGES_FOR_FILE" type="HQL">
1034    <sql>
1035      SELECT {1}
1036      FROM SpotImagesData spi
1037      WHERE spi.redImageFile = :file
1038      OR spi.greenImageFile = :file
1039      OR spi.blueImageFile = :file
1040      OR spi.spotImagesFile = :file
1041    </sql>
1042    <description>
1043      A Hibernate query that gets spot images where a given
1044      file is used as one of the color components or holds the generated spot images.
1045    </description>
1046  </query>
1047 
1048  <query id="GET_FILESETMEMBERS_FOR_FILE" type="HQL">
1049    <sql>
1050      SELECT {1}
1051      FROM FileSetMemberData fsm
1052      WHERE fsm.file = :file
1053    </sql>
1054    <description>
1055      A Hibernate query that gets file set membership
1056      for a given file
1057    </description>
1058  </query>
1059 
1060  <query id="GET_HARDWARE_FOR_TYPE" type="HQL">
1061    <sql>
1062      SELECT {1}
1063      FROM HardwareData hw
1064      WHERE hw.hardwareType = :hardwaretype
1065    </sql>
1066    <description>
1067      A Hibernate query that gets hardware items
1068      of the given hardware type.
1069    </description>
1070  </query>
1071
1072  <query id="GET_SCANS_FOR_SCANNER" type="HQL">
1073    <sql>
1074      SELECT {1}
1075      FROM ScanData scn
1076      WHERE scn.scanner = :scanner
1077    </sql>
1078    <description>
1079      A Hibernate query that gets scans which
1080      uses a given scanner (hardware).
1081    </description>
1082  </query>
1083 
1084  <query id="GET_ARRAYBATCHES_FOR_PRINTROBOT" type="HQL">
1085    <sql>
1086      SELECT {1}
1087      FROM ArrayBatchData ab
1088      WHERE ab.printRobot = :printrobot
1089    </sql>
1090    <description>
1091      A Hibernate query that gets array batches which
1092      uses a given print robot (hardware).
1093    </description>
1094  </query>
1095 
1096  <query id="GET_BIOMATERIALEVENTS_FOR_HARDWARE" type="HQL">
1097    <sql>
1098      SELECT {1}
1099      FROM BioMaterialEventData bme
1100      WHERE bme.hardware = :hardware
1101    </sql>
1102    <description>
1103      A Hibernate query that gets biomaterial events which
1104      uses a given hardware.
1105    </description>
1106  </query>
1107 
1108  <query id="GET_PLATEEVENTS_FOR_HARDWARE" type="HQL">
1109    <sql>
1110      SELECT {1}
1111      FROM PlateEventData ple
1112      WHERE ple.hardware = :hardware
1113    </sql>
1114    <description>
1115      A Hibernate query that gets plates events which
1116      uses a given hardware.
1117    </description>
1118  </query>
1119
1120  <query id="GET_REPORTERS_FOR_REPORTERTYPE" type="HQL">
1121    <sql>
1122      SELECT {1}
1123      FROM ReporterData rpt
1124      WHERE rpt.reporterType = :reporterType
1125    </sql>
1126    <description>
1127      A Hibernate query that gets reporter items
1128      of the given reporter type.
1129    </description>
1130  </query>
1131
1132  <query id="GET_REPORTER_FOR_EXTERNAL_ID" type="HQL">
1133    <sql>
1134      SELECT rpt
1135      FROM ReporterData rpt
1136      WHERE rpt.externalId = :externalId
1137    </sql>
1138    <description>
1139      A Hibernate query that finds the reporter with a given external id.
1140    </description>
1141  </query>
1142 
1143  <query id="GET_SOFTWARE_FOR_SOFTWARETYPE" type="HQL">
1144    <sql>
1145      SELECT {1}
1146      FROM SoftwareData sw
1147      WHERE sw.softwareType = :softwaretype
1148    </sql>
1149    <description>
1150      A Hibernate query that gets software items
1151      of the given software type.
1152    </description>
1153  </query>
1154
1155  <query id="GET_RAWBIOASSAYS_FOR_SOFTWARE" type="HQL">
1156    <sql>
1157      SELECT {1}
1158      FROM RawBioAssayData rba
1159      WHERE rba.software = :software
1160    </sql>
1161    <description>
1162      A Hibernate query that gets the raw bioassays
1163      produced from a given software.
1164    </description>
1165  </query>
1166
1167  <query id="GET_ANNOTATIONS_FOR_ANNOTATIONTYPE" type="HQL">
1168    <sql>
1169      SELECT {1}
1170      FROM AnnotationData a
1171      WHERE a.annotationType = :annotationType
1172    </sql>
1173    <description>
1174      A Hibernate query that gets annotations
1175      of the given annotation type.
1176    </description>
1177  </query>
1178 
1179  <query id="GET_EXPERIMENTS_FOR_ANNOTATIONTYPE" type="HQL">
1180    <sql>
1181      SELECT {1}
1182      FROM ExperimentData exp
1183      JOIN exp.experimentalFactors ef
1184      WHERE ef = :annotationType
1185    </sql>
1186    <description>
1187      A Hibernate query that gets experiments
1188      where the given annotation type is used as an experimental factor.
1189    </description>
1190  </query>
1191 
1192  <query id="GET_PROTOCOLS_FOR_ANNOTATIONTYPE" type="HQL">
1193    <sql>
1194      SELECT {1}
1195      FROM ProtocolData prt
1196      JOIN prt.parameters pp
1197      WHERE pp = :annotationType
1198    </sql>
1199    <description>
1200      A Hibernate query that gets protocols
1201      where the given annotation type is used as a protocol parameter.
1202    </description>
1203  </query>
1204
1205  <query id="GET_SAMPLES_FOR_BIOSOURCE" type="HQL">
1206    <sql>
1207      SELECT {1}
1208      FROM SampleData s
1209      WHERE s.parent = :biosource
1210    </sql>
1211    <description>
1212      A Hibernate query that gets samples
1213      created from a given biosource.
1214    </description>
1215  </query>
1216
1217  <query id="GET_EXTRACTS_FOR_SAMPLE" type="HQL">
1218    <sql>
1219      SELECT {1}
1220      FROM ExtractData e
1221      WHERE e.parent = :sample
1222    </sql>
1223    <description>
1224      A Hibernate query that gets extracts
1225      created from a given sample.
1226    </description>
1227  </query>
1228 
1229  <query id="GET_LABELED_EXTRACTS_FOR_EXTRACT" type="HQL">
1230    <sql>
1231      SELECT {1}
1232      FROM LabeledExtractData le
1233      WHERE le.parent = :extract
1234    </sql>
1235    <description>
1236      A Hibernate query that gets labeled extracts
1237      created from a given extract.
1238    </description>
1239  </query>
1240
1241  <query id="GET_LABELED_EXTRACTS_FOR_LABEL" type="HQL">
1242    <sql>
1243      SELECT {1}
1244      FROM LabeledExtractData le
1245      WHERE le.label = :label
1246    </sql>
1247    <description>
1248      A Hibernate query that gets labeled extracts
1249      with a given label.
1250    </description>
1251  </query>
1252
1253  <query id="GET_SOURCEEVENTS_FOR_BIOMATERIAL" type="HQL">
1254    <sql>
1255      SELECT {1}
1256      FROM BioMaterialEventData bme
1257      JOIN bme.sources src
1258      WHERE index(src) = :bioMaterial
1259    </sql>
1260    <description>
1261      A Hibernate query that gets the events where a given
1262      biomaterial has been part of as a source biomaterial, ie. the number
1263      of pooled biomaterials that have been created from it.
1264    </description>
1265  </query>
1266
1267  <query id="GET_CREATION_EVENT_FOR_BIOMATERIAL" type="HQL">
1268    <sql>
1269      SELECT evt
1270      FROM BioMaterialEventData evt
1271      WHERE evt.bioMaterial = :bioMaterial
1272      AND evt.eventType = 1
1273    </sql>
1274    <description>
1275      A Hibernate query that returns the creation event for
1276      a biomaterial.
1277    </description>
1278  </query>
1279 
1280  <query id="COUNT_UNREAD_MESSAGES_FOR_USER" type="HQL">
1281    <sql>
1282      SELECT count(*)
1283      FROM MessageData msg
1284      WHERE msg.to = :user AND msg.read = false AND msg.removed = false
1285    </sql>
1286    <description>
1287      A Hibernate query that counts the number of
1288      unread messages for a given user
1289    </description>
1290  </query>
1291 
1292  <query id="GET_PLATETYPES_FOR_PLATEGEOMETRY" type="HQL">
1293    <sql>
1294      SELECT {1}
1295      FROM PlateTypeData pt
1296      WHERE pt.plateGeometry = :plateGeometry
1297    </sql>
1298    <description>
1299      A Hibernate query that gets the
1300      plate types using a given plate geometry
1301    </description>
1302  </query>
1303 
1304  <query id="GET_PLATEMAPPINGS_FOR_PLATEGEOMETRY" type="HQL">
1305    <sql>
1306      SELECT {1}
1307      FROM PlateMappingData pm
1308      WHERE pm.sourceGeometry = :plateGeometry
1309      OR pm.destinationGeometry = :plateGeometry
1310    </sql>
1311    <description>
1312      A Hibernate query that gets the
1313      plate mappings using a given plate geometry as source or destination
1314    </description>
1315  </query>
1316
1317  <query id="GET_BIOPLATES_FOR_PLATEGEOMETRY" type="HQL">
1318    <sql>
1319      SELECT {1}
1320      FROM BioPlateData bp
1321      WHERE bp.plateGeometry = :plateGeometry
1322    </sql>
1323    <description>
1324      A Hibernate query that gets the
1325      bioplates using of given plate geometry
1326    </description>
1327  </query>
1328
1329  <query id="GET_PLATES_FOR_PLATETYPE" type="HQL">
1330    <sql>
1331      SELECT {1}
1332      FROM PlateData p
1333      WHERE p.plateType = :plateType
1334    </sql>
1335    <description>
1336      A Hibernate query that gets
1337      plates of a specific plate type.
1338    </description>
1339  </query>
1340
1341  <query id="GET_PLATEEVENTS_FOR_PLATEEVENTTYPE" type="HQL">
1342    <sql>
1343      SELECT {1}
1344      FROM PlateEventData pe
1345      WHERE pe.plateEventType = :plateEventType
1346    </sql>
1347    <description>
1348      A Hibernate query that gets
1349      plate events of the given plate event type.
1350    </description>
1351  </query>
1352
1353  <query id="GET_CHILDPLATES_FOR_PLATE" type="HQL">
1354    <sql>
1355      SELECT {1}
1356      FROM PlateData p
1357      JOIN p.parents pp
1358      WHERE pp = :plate
1359    </sql>
1360    <description>
1361      A Hibernate query that gets the
1362      child plates for a given plate.
1363    </description>
1364  </query>
1365
1366  <query id="GET_ARRAYDESIGNS_FOR_PLATE" type="HQL">
1367    <sql>
1368      SELECT {1}
1369      FROM ArrayDesignData ad
1370      JOIN ad.plates p
1371      WHERE p = :plate
1372    </sql>
1373    <description>
1374      A Hibernate query that gets the
1375      array designs that has used a given plate.
1376    </description>
1377  </query>
1378
1379  <query id="GET_PLATES_FOR_PLATEMAPPING" type="HQL">
1380    <sql>
1381      SELECT {1}
1382      FROM PlateData p
1383      WHERE p.plateMapping = :plateMapping
1384    </sql>
1385    <description>
1386      A Hibernate query that gets the
1387      plates that has been created from a given plate mapping.
1388    </description>
1389  </query>
1390 
1391  <query id="GET_FEATURES_FOR_WELL" type="HQL">
1392    <sql>
1393      SELECT {1}
1394      FROM FeatureData f
1395      WHERE f.well = :well
1396    </sql>
1397    <description>
1398      A Hibernate query that gets the
1399      features using a given well.
1400    </description>
1401  </query>
1402
1403  <query id="COUNT_FEATURES_FOR_ARRAYDESIGN" type="HQL">
1404    <sql>
1405      SELECT count(*)
1406      FROM FeatureData f
1407      WHERE f.arrayDesignBlock.arrayDesign = :arrayDesign
1408    </sql>
1409    <description>
1410      A Hibernate query that counts the number of
1411      features on a given array design
1412    </description>
1413  </query>
1414
1415
1416  <query id="GET_CHILDWELLS_FOR_WELL" type="HQL">
1417    <sql>
1418      SELECT {1}
1419      FROM Well w
1420      WHERE w.parent = :well
1421    </sql>
1422    <description>
1423      A Hibernate query that gets the
1424      child wells of a given well.
1425    </description>
1426  </query>
1427
1428  <query id="GET_PLUGINCONFIGURATIONS_FOR_PLUGINDEFINITION" type="HQL">
1429    <sql>
1430      SELECT {1}
1431      FROM PluginConfigurationData pc
1432      WHERE pc.pluginDefinition = :pluginDefinition
1433    </sql>
1434    <description>
1435      A Hibernate query that gets plugin configurations
1436      using a plugin definition.
1437    </description>
1438  </query>
1439 
1440  <query id="GET_JOBS_FOR_PLUGINCONFIGURATION" type="HQL">
1441    <sql>
1442      SELECT {1}
1443      FROM JobData j
1444      WHERE j.pluginConfiguration = :pluginConfiguration
1445    </sql>
1446    <description>
1447      A Hibernate query that gets the jobs
1448      using a specific plugin configuration.
1449    </description>
1450  </query>
1451 
1452  <query id="GET_JOBS_FOR_PLUGINDEFINITION" type="HQL">
1453    <sql>
1454      SELECT {1}
1455      FROM JobData j
1456      WHERE j.pluginDefinition = :pluginDefinition
1457    </sql>
1458    <description>
1459      A Hibernate query that gets the jobs
1460      using a specific plugin definition.
1461    </description>
1462  </query>
1463
1464  <query id="FIND_JOBS_IN_QUEUE" type="HQL">
1465    <sql>
1466      SELECT job
1467      FROM JobData job
1468      WHERE job.status = :status
1469      AND job.type = :type
1470      AND job.removed = false
1471      ORDER BY job.priority ASC, job.scheduled ASC
1472    </sql>
1473    <description>
1474      A Hibernate query that loads plugin jobs in the job queue waiting to be
1475      executed sorted by priority and waiting time. The query should return all
1476      jobs, ignoring all settings specifying that the internal job queue should
1477      not be used.
1478    </description>
1479  </query>
1480 
1481  <query id="FIND_INTERNAL_JOBS_IN_QUEUE" type="HQL">
1482    <sql>
1483      SELECT job
1484      FROM JobData job
1485      WHERE job.status = :status
1486      AND job.type = :type
1487      AND job.removed = false
1488      AND job.pluginDefinition.useInternalJobQueue = true
1489      AND job.jobAgentId IS NULL
1490      ORDER BY job.priority ASC, job.scheduled ASC
1491    </sql>
1492    <description>
1493      A Hibernate query that loads plugin jobs in the job queue waiting to be
1494      executed sorted by priority and waiting time. It should only return
1495      jobs where the plug-in setting useInternalJobQueue=true and no
1496      specific job agent has been selected for the job.
1497    </description>
1498  </query>
1499 
1500  <query id="GET_ARRAYSLIDES_FOR_BATCH" type="HQL">
1501    <sql>
1502      SELECT {1}
1503      FROM ArraySlideData a
1504      WHERE a.arrayBatch = :arrayBatch
1505    </sql>
1506    <description>
1507      A Hibernate query that gets the array slides
1508      in an array batch.
1509    </description>
1510  </query>
1511
1512  <query id="GET_ARRAYSLIDES_WITH_BARCODE" type="HQL">
1513    <sql>
1514      SELECT {1}
1515      FROM ArraySlideData ars
1516      WHERE ars.barcode = :barcode
1517    </sql>
1518    <description>
1519      A Hibernate query that gets the array slides
1520      with a given barcode.
1521    </description>
1522  </query>
1523
1524
1525  <query id="GET_ARRAYBATCHES_FOR_ARRAYDESIGN" type="HQL">
1526    <sql>
1527      SELECT {1}
1528      FROM ArrayBatchData a
1529      WHERE a.arrayDesign = :arrayDesign
1530    </sql>
1531    <description>
1532      A Hibernate query that gets array batches
1533      that uses a specific array design.
1534    </description>
1535  </query>
1536
1537  <query id="GET_RAWBIOASSAYS_FOR_ARRAYDESIGN" type="HQL">
1538    <sql>
1539      SELECT {1}
1540      FROM RawBioAssayData rba
1541      WHERE rba.arrayDesign = :arrayDesign
1542    </sql>
1543    <description>
1544      A Hibernate query that gets raw bioassays
1545      that uses a specific array design.
1546    </description>
1547  </query>
1548
1549  <query id="GET_SCANS_FOR_HYBRIDIZATION" type="HQL">
1550    <sql>
1551      SELECT {1}
1552      FROM ScanData scn
1553      WHERE scn.hybridization = :hybridization
1554    </sql>
1555    <description>
1556      A Hibernate query that gets scans
1557      that uses a specific hybridization.
1558    </description>
1559  </query>
1560
1561  <query id="GET_RAWBIOASSAYS_FOR_SCAN" type="HQL">
1562    <sql>
1563      SELECT {1}
1564      FROM RawBioAssayData rba
1565      WHERE rba.scan = :scan
1566    </sql>
1567    <description>
1568      A Hibernate query that gets raw bioassays
1569      created from a specific scan.
1570    </description>
1571  </query>
1572
1573  <query id="GET_IMAGES_FOR_SCAN" type="HQL">
1574    <sql>
1575      SELECT {1}
1576      FROM ImageData img
1577      WHERE img.scan = :scan
1578    </sql>
1579    <description>
1580      A Hibernate query that gets images
1581      created from a specific scan.
1582    </description>
1583  </query>
1584
1585  <query id="GET_FEATURE_BY_ALL_COORDINATES" type="HQL">
1586    <sql>
1587      SELECT f
1588      FROM FeatureData f
1589      WHERE f.arrayDesignBlock.arrayDesign = :arrayDesign
1590      AND f.row = :row
1591      AND f.column = :column
1592      AND
1593      (
1594        (f.arrayDesignBlock.blockNumber = :block AND :block &lt;&gt; 0)
1595        OR
1596        (:block = 0 AND f.arrayDesignBlock.metaGridX = :metaGridX
1597        AND f.arrayDesignBlock.metaGridY = :metaGridY)
1598      )
1599    </sql>
1600    <description>
1601      A Hibernate query that finds a feature on a given array design
1602      with specified block and coordinates.
1603    </description>
1604  </query>
1605 
1606  <query id="PRELOAD_FEATURES" type="HQL">
1607    <sql>
1608      SELECT f
1609      FROM FeatureData f
1610      JOIN FETCH f.arrayDesignBlock b
1611      LEFT JOIN FETCH f.reporter
1612      WHERE b.arrayDesign = :arrayDesign
1613    </sql>
1614    <description>
1615      A Hibernate query that loads features, blocks and reporters
1616      for a single array design.
1617    </description>
1618  </query>
1619 
1620  <query id="DELETE_FEATURES_FOR_ARRAYDESIGN" type="HQL">
1621    <sql>
1622      DELETE FROM Features f, ArrayDesignBlocks adb
1623      WHERE adb.id = f.arraydesignblock_id AND adb.arraydesign_id = ?
1624    </sql>
1625    <description>
1626      A Hibernate query that deletes all features for an array design.
1627    </description>
1628  </query>
1629
1630  <query id="GET_PLUGINTYPE_FOR_INTERFACENAME" type="HQL">
1631    <sql>
1632      SELECT plt
1633      FROM PluginTypeData plt
1634      WHERE plt.interfaceName = :interfaceName
1635    </sql>
1636    <description>
1637      Load a plugin type when you know the interface name.
1638    </description>
1639  </query>
1640
1641  <query id="GET_PLUGINDEFINITION_FOR_CLASSNAME" type="HQL">
1642    <sql>
1643      SELECT pd
1644      FROM PluginDefinitionData pd
1645      WHERE pd.className = :className
1646    </sql>
1647    <description>
1648      Load a plugin definition when you know the class name.
1649    </description>
1650  </query>
1651
1652  <query id="GET_PLUGINCONFIGURATION_FOR_PLUGIN_WITH_NAME" type="HQL">
1653    <sql>
1654      SELECT pc
1655      FROM PluginConfigurationData pc
1656      WHERE pc.pluginDefinition.className = :className
1657      AND pc.name = :name
1658    </sql>
1659    <description>
1660      Load a plugin configuration for a given plug-in and with a given name
1661    </description>
1662  </query>
1663
1664
1665  <query id="GET_EXPERIMENTS_FOR_RAWBIOASSAY" type="HQL">
1666    <sql>
1667      SELECT {1}
1668      FROM ExperimentData xp
1669      JOIN xp.rawBioAssays rba
1670      WHERE rba = :rawBioAssay
1671    </sql>
1672    <description>
1673      A Hibernate query that gets the experiments
1674      using a specific raw bioassay.
1675    </description>
1676  </query>
1677 
1678  <query id="GET_TRANSFORMATIONS_FOR_RAWBIOASSAY" type="HQL">
1679    <sql>
1680      SELECT {1}
1681      FROM TransformationData trf
1682      JOIN trf.rawSources rba
1683      WHERE rba = :rawBioAssay
1684    </sql>
1685    <description>
1686      A Hibernate query that gets the transformations
1687      using a specifiec raw bioassay.
1688    </description>
1689  </query>
1690 
1691  <query id="GET_TRANSFORMATIONS_FOR_JOB" type="HQL">
1692    <sql>
1693      SELECT {1}
1694      FROM TransformationData trf
1695      WHERE trf.job = :job
1696    </sql>
1697    <description>
1698      A Hibernate query that gets transformations
1699      linked to a job.
1700    </description>
1701  </query>
1702 
1703  <query id="GET_RAWBIOASSAYS_FOR_JOB" type="HQL">
1704    <sql>
1705      SELECT {1}
1706      FROM RawBioAssayData rba
1707      WHERE rba.job = :job
1708    </sql>
1709    <description>
1710      A Hibernate query that gets raw bioassays
1711      linked to a job.
1712    </description>
1713  </query>
1714 
1715  <query id="GET_ARRAYDESIGNS_FOR_JOB" type="HQL">
1716    <sql>
1717      SELECT {1}
1718      FROM ArrayDesignData ad
1719      WHERE ad.job = :job
1720    </sql>
1721    <description>
1722      A Hibernate query that gets array designs
1723      linked to a job.
1724    </description>
1725  </query>
1726
1727  <query id="FIND_CHILD_BIOASSAYSETS" type="HQL">
1728    <sql>
1729      SELECT bas
1730      FROM BioAssaySetData bas
1731      WHERE bas.transformation.source = :parent
1732    </sql>
1733    <description>
1734      A Hibernate query that returns all bioassaysets that are
1735      children to a specified parent bioassayset.
1736    </description>
1737  </query>
1738 
1739  <query id="FIND_DATACUBES_FOR_BIOASSAYSETS" type="HQL">
1740    <sql>
1741      SELECT DISTINCT cbe
1742      FROM BioAssaySetData bas
1743      JOIN bas.dataCubeLayer.dataCube cbe
1744      WHERE bas IN (:basList)
1745    </sql>
1746    <description>
1747      A Hibernate query that returns all data cubes that are
1748      used by the specified list of bioassaysets
1749    </description>
1750  </query>
1751 
1752  <query id="FIND_DATACUBES_USED_BY_OTHERS" type="HQL">
1753    <sql>
1754      SELECT DISTINCT cbe
1755      FROM BioAssaySetData bas
1756      JOIN bas.dataCubeLayer.dataCube cbe
1757      WHERE bas NOT IN (:basList)
1758      AND cbe IN (:possibleCubes)
1759    </sql>
1760    <description>
1761      A Hibernate query that, given a list of data cubes and bioassaysets,
1762      returns all of those data cubes that are also used by other bioassaysets.
1763    </description>
1764  </query>
1765
1766  <query id="FIND_DATACUBELAYERS_FOR_BIOASSAYSETS" type="HQL">
1767    <sql>
1768      SELECT lay
1769      FROM BioAssaySetData bas
1770      JOIN bas.dataCubeLayer lay
1771      WHERE bas IN (:basList)
1772    </sql>
1773    <description>
1774      A Hibernate query that returns all data cube layers that are
1775      used by the specified list of bioassaysets
1776    </description>
1777  </query>
1778 
1779  <query id="FIND_DATACUBELAYERS_FOR_BIOASSAYSETS_IGNORE_DELETED_DATACUBES" type="HQL">
1780    <sql>
1781      SELECT lay
1782      FROM BioAssaySetData bas
1783      JOIN bas.dataCubeLayer lay
1784      WHERE bas IN (:basList)
1785      AND lay.dataCube NOT IN (:deletedCubes)
1786    </sql>
1787    <description>
1788      A Hibernate query that returns all data cube layers that are
1789      used by the specified list of bioassaysets but not are part of the
1790      list of already deleted data cubes.
1791    </description>
1792  </query>
1793
1794  <query id="FIND_DATACUBELAYERS_USED_BY_OTHERS" type="HQL">
1795    <sql>
1796      SELECT lay
1797      FROM BioAssaySetData bas
1798      JOIN bas.dataCubeLayer lay
1799      WHERE bas NOT IN (:basList)
1800      AND lay IN (:possibleLayers)
1801    </sql>
1802    <description>
1803      A Hibernate query that, given a list of data cube layers and bioassaysets,
1804      returns all of those data cube layers that are also used by other bioassaysets.
1805    </description>
1806  </query>
1807
1808  <query id="FIND_DATACUBEFILTERS_FOR_BIOASSAYSETS" type="HQL">
1809    <sql>
1810      SELECT flt
1811      FROM BioAssaySetData bas
1812      JOIN bas.dataCubeFilter flt
1813      WHERE bas IN (:basList)
1814    </sql>
1815    <description>
1816      A Hibernate query that returns all data cube filters that are
1817      used by the specified list of bioassaysets
1818    </description>
1819  </query>
1820 
1821  <query id="FIND_DATACUBEFILTERS_FOR_BIOASSAYSETS_IGNORE_DELETED_DATACUBES" type="HQL">
1822    <sql>
1823      SELECT flt
1824      FROM BioAssaySetData bas
1825      JOIN bas.dataCubeFilter flt
1826      WHERE bas IN (:basList)
1827      AND flt.dataCube NOT IN (:deletedCubes)
1828    </sql>
1829    <description>
1830      A Hibernate query that returns all data cube filters that are
1831      used by the specified list of bioassaysets but not are part of the
1832      list of already deleted data cubes.
1833    </description>
1834  </query>
1835
1836  <query id="FIND_DATACUBEFILTERS_USED_BY_OTHERS" type="HQL">
1837    <sql>
1838      SELECT flt
1839      FROM BioAssaySetData bas
1840      JOIN bas.dataCubeFilter flt
1841      WHERE bas NOT IN (:basList)
1842      AND flt IN (:possibleFilters)
1843    </sql>
1844    <description>
1845      A Hibernate query that, given a list of data cube filters and bioassaysets,
1846      returns all of those data cube filters that are also used by other bioassaysets.
1847    </description>
1848  </query>
1849
1850  <query id="FIND_DATACUBEEXTRAVALUES_FOR_BIOASSAYSETS" type="HQL">
1851    <sql>
1852      SELECT dcev
1853      FROM BioAssaySetData bas
1854      JOIN bas.extraValues ev
1855      JOIN ev.dataCubeExtraValue dcev
1856      WHERE bas IN (:basList)
1857    </sql>
1858    <description>
1859      A Hibernate query that returns all data cube extra values that are
1860      used by the specified list of bioassaysets
1861    </description>
1862  </query>
1863 
1864  <query id="FIND_DATACUBEEXTRAVALUES_FOR_BIOASSAYSETS_IGNORE_DELETED_DATACUBES" type="HQL">
1865    <sql>
1866      SELECT dcev
1867      FROM BioAssaySetData bas
1868      JOIN bas.extraValues ev
1869      JOIN ev.dataCubeExtraValue dcev
1870      WHERE bas IN (:basList)
1871      AND dcev.dataCube NOT IN (:deletedCubes)
1872    </sql>
1873    <description>
1874      A Hibernate query that returns all data cube extra values that are
1875      used by the specified list of bioassaysets but not are part of the
1876      list of already deleted data cubes.
1877    </description>
1878  </query>
1879
1880  <query id="FIND_DATACUBEEXTRAVALUES_USED_BY_OTHERS" type="HQL">
1881    <sql>
1882      SELECT dcev
1883      FROM BioAssaySetData bas
1884      JOIN bas.extraValues ev
1885      JOIN ev.dataCubeExtraValue dcev
1886      WHERE bas NOT IN (:basList)
1887      AND dcev IN (:possibleExtraValues)
1888    </sql>
1889    <description>
1890      A Hibernate query that, given a list of data cube extra values and bioassaysets,
1891      returns all of those data cube extra values that are also used by other bioassaysets.
1892    </description>
1893  </query>
1894
1895  <query id="GET_EXTRAVALUETYPE_FOR_EXTERNAL_ID" type="HQL">
1896    <sql>
1897      SELECT evt
1898      FROM ExtraValueTypeData evt
1899      WHERE evt.externalId = :externalId
1900    </sql>
1901    <description>
1902      Load an extra value type when you know the external id.
1903    </description>
1904  </query>
1905
1906  <query id="GET_EXTRAVALUES_FOR_EXTRAVALUETYPE" type="HQL">
1907    <sql>
1908      SELECT {1}
1909      FROM ExtraValueData ev
1910      WHERE ev.extraValueType = :extraValueType
1911    </sql>
1912    <description>
1913      A Hibernate query that gets extra values
1914      of a specific type.
1915    </description>
1916  </query>
1917 
1918  <query id="LOAD_CONTEXT_NAMES" type="HQL">
1919    <sql>
1920      SELECT ctx.id, ctx.name
1921      FROM ContextData ctx
1922      WHERE ctx.client = :client AND
1923      (ctx.user = :user OR ctx.public = true)
1924      AND ctx.itemType = :itemType
1925      AND ctx.subContext = :subContext
1926      ORDER BY ctx.name
1927    </sql>
1928    <description>
1929      A Hibernate query that selects the id and name of all contexts for
1930      a user and item type. The names should be sorted in ascending order.
1931    </description>
1932  </query>
1933 
1934  <query id="LOAD_CONTEXT_BY_NAME" type="HQL">
1935    <sql>
1936      SELECT ctx
1937      FROM ContextData ctx
1938      WHERE ctx.user = :user
1939      AND ctx.client = :client
1940      AND ctx.itemType = :itemType
1941      AND ctx.subContext  = :subContext
1942      AND ctx.name = :name
1943    </sql>
1944    <description>
1945      A Hibernate query that load a context given the user, client,
1946      item type, subcontext and name of the context.
1947    </description>
1948  </query>
1949 
1950  <query id="LOAD_USER_CONTEXTS" type="HQL">
1951    <sql>
1952      SELECT ctx
1953      FROM ContextData ctx
1954      WHERE ctx.user.id = :user
1955      AND ctx.client.id = :client
1956      AND ctx.name = :name
1957    </sql>
1958    <description>
1959      A Hibernate query that loads all saved context information
1960      with a given name for a specific user/client.
1961    </description>
1962  </query>
1963
1964  <query id="COUNT_PLUGINS_BY_TYPE_FOR_CONTEXT" type="HQL">
1965    <sql>
1966      SELECT plg.mainType, count(DISTINCT plg.id)
1967      FROM PluginDefinitionData plg
1968      JOIN plg.guiContexts gcx
1969      LEFT JOIN plg.configurations cfg
1970      WITH true = :hasConfigPermission OR cfg.owner.id = :owner
1971        OR cfg.itemKey.id IN (:itemKeys) OR cfg.projectKey.id IN (:projectKeys)
1972      WHERE
1973        (true = :hasPluginPermission OR plg.owner.id = :owner
1974        OR plg.itemKey.id IN (:itemKeys) OR plg.projectKey.id IN (:projectKeys))
1975      AND gcx.itemType = :itemType AND gcx.contextType = :contextType
1976      AND (
1977        (plg.requiresConfiguration = false)
1978        OR
1979        (plg.requiresConfiguration = true AND NOT cfg.id IS NULL)
1980      )
1981      GROUP BY plg.mainType
1982    </sql>
1983    <description>
1984      A Hibernate query that counts the number of plugins available for a
1985      given GUI context grouped by the main type of the plugins taking
1986      the requirement of configurations and user permissions into account.
1987    </description>
1988  </query>
1989 
1990  <query id="GET_FORMULA_WITH_NAME_AND_CHANNELS" type="HQL">
1991    <sql>
1992      SELECT fml
1993      FROM FormulaData fml
1994      WHERE fml.name = :name
1995      AND fml.channels = :channels
1996    </sql>
1997    <description>
1998      A Hibernate query that loads a formula with a given name and number
1999      of channels.
2000    </description>
2001  </query>
2002
2003  <query id="GET_FORMULA_WITH_NAME_AND_TYPE" type="HQL">
2004    <sql>
2005      SELECT fml
2006      FROM FormulaData fml
2007      WHERE fml.name = :name
2008      AND fml.rawDataType = :rawDataType
2009    </sql>
2010    <description>
2011      A Hibernate query that loads a formula with a given name and raw data type.
2012    </description>
2013  </query>
2014 
2015  <query id="GET_HELP_FOR_EXTERNAL_ID" type="HQL">
2016    <sql>
2017      SELECT hlp
2018      FROM HelpData hlp
2019      WHERE hlp.externalId = :externalId AND hlp.client = :client
2020    </sql>
2021    <description>
2022      A Hibernate query that loads a help text.
2023    </description>
2024  </query>
2025 
2026  <query id="GET_SCHEMA_VERSION" type="HQL">
2027    <sql>
2028      SELECT sv
2029      FROM SchemaVersionData sv
2030    </sql>
2031    <description>
2032      A Hibernate query that loads the schema version (there should only be one record).
2033    </description>
2034  </query>
2035 
2036  <query id="SET_SCHEMA_VERSION" type="HQL">
2037    <sql>
2038      UPDATE SchemaVersionData sv
2039      SET sv.schemaVersion = :schemaVersion,
2040      sv.build = :build
2041    </sql>
2042    <description>
2043      A Hibernate query that updates the schema version and build number.
2044    </description>
2045  </query>
2046 
2047  <query id="SET_PROJECT_ID_FOR_JOBS" type="HQL">
2048    <sql>
2049      UPDATE JobData job
2050      SET job.activeProjectId = 0
2051      WHERE job.activeProjectId IS NULL
2052    </sql>
2053    <description>
2054      A Hibernate query that sets the active project ID for all
2055      jobs to 0 if they have a null value.
2056    </description>
2057  </query>
2058
2059  <query id="GET_PRIMARY_ANNOTATION" type="HQL">
2060    <sql>
2061      SELECT ad
2062      FROM AnnotationData ad
2063      WHERE ad.annotationType = :annotationType
2064      AND ad.annotationSet = :annotationSet
2065    </sql>
2066    <description>
2067      A Hibernate query that loads the primary annotation of a specific
2068      annotation type for a given annotation set.
2069    </description>
2070  </query>
2071 
2072  <query id="GET_DIRECTLY_INHERITED_ANNOTATION" type="HQL">
2073    <sql>
2074      SELECT ad
2075      FROM AnnotationData ad
2076      JOIN ad.inheritingSets ans
2077      WHERE ad.annotationType = :annotationType
2078      AND ans = :annotationSet
2079    </sql>
2080    <description>
2081      A Hibernate query that loads an directly inherited annotation of a specific
2082      annotation type for a given annotation set. A directly inhertited annotation
2083      is an annotation that is linked to the specified annotation set.
2084    </description>
2085  </query>
2086
2087  <query id="GET_INDIRECTLY_INHERITED_ANNOTATION" type="HQL">
2088    <sql>
2089      SELECT ad
2090      FROM AnnotationData ad
2091      JOIN ad.annotationSet.inheritingSets ians
2092      WHERE ad.annotationType = :annotationType
2093      AND ians = :annotationSet
2094    </sql>
2095    <description>
2096      A Hibernate query that loads an indirectly inherited annotation of a specific
2097      annotation type for a given annotation set. An indirectly inherited annotation
2098      is an annotation which belongs to an annotation set which is inherited by
2099      the given annotation set.
2100    </description>
2101  </query>
2102 
2103  <query id="UPDATE_BYTES_FOR_EXPERIMENT" type="HQL">
2104    <sql>
2105      UPDATE ExperimentData xpm
2106      SET xpm.bytes = xpm.bytes + :addedBytes
2107      WHERE xpm.id = :experiment
2108    </sql>
2109    <description>
2110      A Hibernate query that updates the number of bytes used by an experiment.
2111    </description>
2112  </query>
2113
2114  <query id="UPDATE_BYTES_FOR_DATACUBE" type="HQL">
2115    <sql>
2116      UPDATE DataCubeData dcd
2117      SET dcd.bytes = dcd.bytes + :addedBytes
2118      WHERE dcd.id = :dataCube
2119    </sql>
2120    <description>
2121      A Hibernate query that updates the number of bytes used by a data cube.
2122    </description>
2123  </query>
2124 
2125  <query id="GET_REMOVED_ITEMS" type="HQL">
2126    <sql>
2127      SELECT trash
2128      FROM net.sf.basedb.core.data.RemovableData trash
2129      WHERE trash.removed = true
2130    </sql>
2131    <description>
2132      A Hibernate query that loads all items flagged for deletion.
2133    </description>
2134  </query>
2135 
2136  <query id="UPDATE_REMAINING_QUANTITY" type="HQL">
2137    <sql>
2138      UPDATE MeasuredBioMaterialData mbm
2139      SET mbm.remainingQuantity = mbm.remainingQuantity - :used
2140      WHERE mbm = :bioMaterial
2141    </sql>
2142    <description>
2143      A Hibernate query that adds/removes the remaining quantity on a
2144      measuered biomaterial.
2145    </description>
2146  </query>
2147
2148  <query id="SET_REMAINING_QUANTITY" type="HQL">
2149    <sql>
2150      UPDATE MeasuredBioMaterialData mbm
2151      SET mbm.remainingQuantity = :remain
2152      WHERE mbm = :bioMaterial
2153    </sql>
2154    <description>
2155      A Hibernate query that sets the remaining quantity on a
2156      measuered biomaterial.
2157    </description>
2158  </query>
2159
2160
2161  <query id="GET_ANYTOANY_FOR_NAME" type="HQL">
2162    <sql>
2163      SELECT ata
2164      FROM AnyToAnyData ata
2165      WHERE ata.fromId = :fromId AND ata.fromType = :fromType AND ata.name = :name
2166    </sql>
2167    <description>
2168      A Hibernate query that loads the any-to-any link with the specified name
2169      for an item.
2170    </description>
2171  </query>
2172
2173  <query id="DELETE_ANYTOANY_FROM" type="HQL">
2174    <sql>
2175      DELETE FROM AnyToAnyData ata
2176      WHERE ata.fromId = :fromId AND ata.fromType = :fromType AND ata.name = :name
2177    </sql>
2178    <description>
2179      A Hibernate query that deletes a names any-to-any link leading out from
2180      an item.
2181    </description>
2182  </query>
2183
2184
2185  <query id="DELETE_ALL_ANYTOANY_FROM" type="HQL">
2186    <sql>
2187      DELETE FROM AnyToAnyData ata
2188      WHERE ata.fromId = :fromId AND ata.fromType = :fromType
2189    </sql>
2190    <description>
2191      A Hibernate query that deletes all any-to-any links leading out from
2192      an item.
2193    </description>
2194  </query>
2195
2196  <query id="DELETE_ALL_ANYTOANY_TO" type="HQL">
2197    <sql>
2198      DELETE FROM AnyToAnyData ata
2199      WHERE ata.toId = :toId AND ata.toType = :toType
2200    </sql>
2201    <description>
2202      A Hibernate query that deletes all any-to-any links leading in to
2203      an item.
2204    </description>
2205  </query>
2206 
2207  <query id="DELETE_UNUSED_ANYTOANY_TO" type="HQL">
2208    <sql>
2209      DELETE FROM AnyToAnyData ata
2210      WHERE ata.toId = :toId AND ata.toType = :toType AND ata.usingTo = false
2211    </sql>
2212    <description>
2213      A Hibernate query that deletes all any-to-any links leading in to
2214      an item that doesn't count as using the item.
2215    </description>
2216  </query>
2217
2218  <query id="COUNT_ANYTOANY_FROM" type="HQL">
2219    <sql>
2220      SELECT count(*)
2221      FROM AnyToAnyData ata
2222      WHERE ata.fromId = :fromId AND ata.fromType = :fromType
2223    </sql>
2224    <description>
2225      A Hibernate query that counts the number of any-to-any links
2226      from a given item.
2227    </description>
2228  </query>
2229
2230  <query id="COUNT_ANYTOANY_TO" type="HQL">
2231    <sql>
2232      SELECT count(*)
2233      FROM AnyToAnyData ana
2234      WHERE ana.toId = :toId AND ana.toType = :toType
2235    </sql>
2236    <description>
2237      A Hibernate query that counts the number of any-to-any links
2238      to a given item.
2239    </description>
2240  </query>
2241
2242  <query id="COUNT_USED_ANYTOANY_TO" type="HQL">
2243    <sql>
2244      SELECT count(*)
2245      FROM AnyToAnyData ata
2246      WHERE ata.toId = :toId AND ata.toType = :toType AND ata.usingTo = true
2247    </sql>
2248    <description>
2249      A Hibernate query that counts the number of any-to-any links
2250      to a given item that counts as using the item.
2251    </description>
2252  </query>
2253
2254  <query id="FIND_USING_ANYTOANY" type="HQL">
2255    <sql>
2256      SELECT ana.fromId, ana.fromType
2257      FROM AnyToAnyData ana
2258      WHERE ana.toId = :toId AND ana.toType = :toType AND ana.usingTo = true
2259    </sql>
2260    <description>
2261      A Hibernate query that finds the any-to-any links
2262      to a given item that counts as using the item.
2263    </description>
2264  </query>
2265
2266 
2267  <query id="UPDATE_DATACUBENO_FOR_VIRTUALDB" type="HQL">
2268    <sql>
2269      UPDATE VirtualDbData vdb
2270      SET vdb.cubes = vdb.cubes + 1
2271      WHERE vdb.id = :virtualDb
2272    </sql>
2273    <description>
2274      A Hibernate query that updates the number of data cubes
2275      for the specified virtual database.
2276    </description>
2277  </query>
2278
2279  <query id="GET_DATACUBENO_FOR_VIRTUALDB" type="HQL">
2280    <sql>
2281      SELECT vdb.cubes
2282      FROM VirtualDbData vdb
2283      WHERE vdb.id = :virtualDb
2284    </sql>
2285    <description>
2286      A Hibernate query that gets the current number of data cubes
2287      for the specified virtual database.
2288    </description>
2289  </query>
2290 
2291  <query id="UPDATE_FILTERNO_FOR_DATACUBE" type="HQL">
2292    <sql>
2293      UPDATE DataCubeData dcb
2294      SET dcb.numFilters = dcb.numFilters + 1
2295      WHERE dcb.id = :dataCube
2296    </sql>
2297    <description>
2298      A Hibernate query that updates the number of filters
2299      for the specified data cube.
2300    </description>
2301  </query>
2302
2303  <query id="GET_FILTERNO_FOR_DATACUBE" type="HQL">
2304    <sql>
2305      SELECT dcb.numFilters
2306      FROM DataCubeData dcb
2307      WHERE dcb.id = :dataCube
2308    </sql>
2309    <description>
2310      A Hibernate query that gets the current number of filters
2311      for the specified data cube.
2312    </description>
2313  </query>
2314
2315  <query id="UPDATE_EXTRAVALUENO_FOR_DATACUBE" type="HQL">
2316    <sql>
2317      UPDATE DataCubeData dcb
2318      SET dcb.numExtraValues = dcb.numExtraValues + 1
2319      WHERE dcb.id = :dataCube
2320    </sql>
2321    <description>
2322      A Hibernate query that updates the number of extra values
2323      for the specified data cube.
2324    </description>
2325  </query>
2326
2327  <query id="GET_EXTRAVALUENO_FOR_DATACUBE" type="HQL">
2328    <sql>
2329      SELECT dcb.numExtraValues
2330      FROM DataCubeData dcb
2331      WHERE dcb.id = :dataCube
2332    </sql>
2333    <description>
2334      A Hibernate query that gets the current number of extra values
2335      for the specified data cube.
2336    </description>
2337  </query>
2338
2339  <query id="UPDATE_LAYERNO_FOR_DATACUBE" type="HQL">
2340    <sql>
2341      UPDATE DataCubeData dcb
2342      SET dcb.numLayers = dcb.numLayers + 1
2343      WHERE dcb.id = :dataCube
2344    </sql>
2345    <description>
2346      A Hibernate query that updates the number of layers
2347      for the specified data cube.
2348    </description>
2349  </query>
2350
2351  <query id="GET_LAYERNO_FOR_DATACUBE" type="HQL">
2352    <sql>
2353      SELECT dcb.numLayers
2354      FROM DataCubeData dcb
2355      WHERE dcb.id = :dataCube
2356    </sql>
2357    <description>
2358      A Hibernate query that gets the current number of layers
2359      for the specified data cube.
2360    </description>
2361  </query>
2362
2363  <query id="UPDATE_COLUMNNO_FOR_DATACUBE" type="HQL">
2364    <sql>
2365      UPDATE DataCubeData dcb
2366      SET dcb.numColumns = dcb.numColumns + 1
2367      WHERE dcb.id = :dataCube
2368    </sql>
2369    <description>
2370      A Hibernate query that updates the number of columns
2371      for the specified data cube.
2372    </description>
2373  </query>
2374
2375  <query id="GET_COLUMNNO_FOR_DATACUBE" type="HQL">
2376    <sql>
2377      SELECT dcb.numColumns
2378      FROM DataCubeData dcb
2379      WHERE dcb.id = :dataCube
2380    </sql>
2381    <description>
2382      A Hibernate query that gets the current number of columns
2383      for the specified data cube.
2384    </description>
2385  </query>
2386
2387  <query id="SET_HAS_DATA_FOR_RAWBIOASSAYS" type="HQL">
2388    <sql>
2389      UPDATE RawBioAssayData rba
2390      SET rba.hasData = CASE
2391        WHEN rba.spots > 0 THEN true
2392        ELSE false
2393        END
2394      WHERE rba.hasData IS NULL
2395    </sql>
2396    <description>
2397      A Hibernate query that sets the hasData property for a
2398      raw bioassay depending on if it has spots or not.
2399    </description>
2400  </query>
2401 
2402  <query id="SET_REMOVED_FOR_HARDWARETYPES" type="HQL">
2403    <sql>
2404      UPDATE HardwareTypeData hwd
2405      SET hwd.removed = false
2406      WHERE hwd.removed IS NULL
2407    </sql>
2408    <description>
2409      A Hibernate query that sets the removed property to false for a
2410      HardwareTypeData if it has NULL value.
2411    </description>
2412  </query>
2413
2414  <query id="SET_CONFIG_FOR_PLUGINS" type="HQL">
2415    <sql>
2416      UPDATE PluginDefinitionData pd
2417      SET pd.supportsConfigurations = true, pd.requiresConfiguration = false
2418      WHERE pd.supportsConfigurations IS NULL OR pd.requiresConfiguration IS NULL
2419    </sql>
2420    <description>
2421      A Hibernate query that sets the supportsConfigurations and requiresConfiguration
2422      properties of PluginDefinitionData items if any of them is null.
2423    </description>
2424  </query>
2425
2426  <query id="GET_INCORRECT_PLATEMAPPINGS" type="HQL">
2427    <sql>
2428      SELECT pm
2429      FROM PlateMappingData pm
2430      WHERE pm.sourceCount = 4 AND pm.destinationCount = 1
2431      AND
2432      (
2433        (pm.sourceGeometry.rows = 8 AND pm.sourceGeometry.columns = 12)
2434        OR
2435        (pm.sourceGeometry.rows = 16 AND pm.sourceGeometry.columns = 24)
2436      )
2437    </sql>
2438    <description>
2439      A Hibernate query that finds incorrect plate mappings.
2440    </description>
2441  </query>
2442 
2443  <query id="GET_PLATES_WITH_MAPPING" type="HQL">
2444    <sql>
2445      SELECT p
2446      FROM PlateData p
2447      WHERE p.plateMapping = :plateMapping
2448    </sql>
2449    <description>
2450      A Hibernate query that loads all plates with a specific plate mapping.
2451    </description>
2452  </query>
2453 
2454  <query id="GET_JOBAGENT_FOR_EXTERNALID" type="HQL">
2455    <sql>
2456      SELECT jag
2457      FROM JobAgentData jag
2458      WHERE jag.externalId = :externalId
2459    </sql>
2460    <description>
2461      A Hibernate query that loads the job agent with the specified external ID.
2462    </description>
2463  </query>
2464
2465  <query id="SET_TRUSTED_FOR_PLUGINDEFINITIONS" type="HQL">
2466    <sql>
2467      UPDATE PluginDefinitionData pd
2468      SET pd.trusted = true
2469      WHERE pd.trusted IS NULL
2470    </sql>
2471    <description>
2472      A Hibernate query that sets the trusted flag for all plugins with a null value
2473      to TRUE.
2474    </description>
2475  </query>
2476 
2477  <query id="SET_USE_PERMISSION_FOR_PLUGINDEFINITIONS" type="HQL">
2478    <sql>
2479      UPDATE PluginDefinitionData pd
2480      SET pd.usePermissions = false
2481      WHERE pd.usePermissions IS NULL
2482    </sql>
2483    <description>
2484      A Hibernate query that sets the use permission flag to false
2485      for all plugins with a null value.
2486    </description>
2487  </query>
2488 
2489  <query id="GET_KEYS_FOR_PLUGIN" type="HQL">
2490    <sql>
2491      SELECT pdk
2492      FROM PluginKeys pdk
2493      WHERE pdk.pluginDefinitionId = :pluginId
2494      ORDER BY pdk.keyId
2495    </sql>
2496    <description>
2497      A Hibernate query that loads all PluginDefinitionKeys for a specified plugin ID.
2498    </description>
2499  </query>
2500 
2501  <query id="SET_SENDMESSAGE_FOR_JOBS" type="HQL">
2502    <sql>
2503      UPDATE JobData job
2504      SET job.sendMessage = true
2505      WHERE job.sendMessage IS NULL
2506    </sql>
2507    <description>
2508      A Hibernate query that sets the send message flag for all jobs with a null value.
2509    </description>
2510  </query>
2511
2512  <query id="SET_PARAMETER_VERSION_FOR_PLUGINCONFIGURATIONS" type="HQL">
2513    <sql>
2514      UPDATE PluginConfigurationData pc
2515      SET pc.parameterVersion = 1
2516      WHERE pc.parameterVersion IS NULL
2517    </sql>
2518    <description>
2519      A Hibernate query that sets the parameter version to 1 for all
2520      configurations with a null value.
2521    </description>
2522  </query>
2523
2524  <query id="SET_PARAMETER_VERSION_FOR_JOBS" type="HQL">
2525    <sql>
2526      UPDATE JobData job
2527      SET job.parameterVersion = 1
2528      WHERE job.parameterVersion IS NULL
2529    </sql>
2530    <description>
2531      A Hibernate query that sets the parameter version to 1 for all
2532      jobs with a null value.
2533    </description>
2534  </query>
2535
2536  <query id="COPY_PLUGINCONFIGURATION_PARAMETERS" type="SQL">
2537    <sql>
2538      INSERT INTO "VersionedPluginConfigurationValues"
2539      ("pluginconfiguration_id", "name", "parameter_version", "value_id")
2540      SELECT "pluginconfiguration_id", "name", 1, "value_id"
2541      FROM "PluginConfigurationValues"
2542    </sql>
2543    <description>
2544      An SQL query that creates versioned parameters from unversioned.
2545    </description>
2546  </query>
2547 
2548  <query id="DELETE_UNVERSIONED_PLUGINCONFIGURATION_PARAMETERS" type="SQL">
2549    <sql>
2550      DELETE FROM "PluginConfigurationValues"
2551    </sql>
2552    <description>
2553      An SQL query that deletes unversioned plugin configuration parameters.
2554    </description>
2555  </query>
2556
2557  <query id="SET_COLORING_FOR_FORMULAS" type="HQL">
2558    <sql>
2559        UPDATE FormulaData frm
2560        SET
2561          frm.coloring.usingColors = false,
2562          frm.coloring.logarithmic = false
2563        WHERE frm.coloring.usingColors IS NULL
2564    </sql>
2565    <description>
2566      A HQL query that sets the usingColors and logarithmic to false
2567      for all formulas with null values.
2568    </description>
2569  </query>
2570 
2571  <query id="SET_COLORING_FOR_EXTRAVALUETYPES" type="HQL">
2572    <sql>
2573      UPDATE ExtraValueTypeData evt
2574      SET
2575        evt.coloring.usingColors = false,
2576        evt.coloring.logarithmic = false
2577        WHERE evt.coloring.usingColors IS NULL
2578    </sql>
2579    <description>
2580      A HQL query that sets the usingColors and logarithmic to false
2581      for all extra value types with null values.
2582    </description>
2583  </query>
2584 
2585  <query id="SET_IMMEDIATE_EXECUTION_FOR_PLUGINS" type="HQL">
2586    <sql>
2587      UPDATE PluginDefinitionData plg
2588      SET plg.allowImmediateExecution = false
2589      WHERE plg.allowImmediateExecution IS NULL
2590    </sql>
2591    <description>
2592      A HQL query that sets the allowImmediateExecution to false
2593      for all plugins which has a null value.
2594    </description>
2595  </query>
2596 
2597  <query id="SET_PROTOCOL_PARAMETER_FOR_ANNOTATION_TYPES" type="HQL">
2598    <sql>
2599      UPDATE AnnotationTypeData at
2600      SET at.protocolParameter = false
2601      WHERE at.protocolParameter IS NULL
2602    </sql>
2603    <description>
2604      A HQL query that sets the protocolParameter flag to false
2605      for all annotation types with a null value.
2606    </description>
2607  </query>
2608
2609  <query id="CHANGE_FILE_DISCRIMINATOR" type="SQL">
2610    <sql>
2611      UPDATE "ParameterValues"
2612      SET "discriminator" = 10
2613      WHERE "discriminator" = 9
2614    </sql>
2615    <description>
2616      An SQL query that changes the discriminator for file
2617      parameters
2618    </description>
2619  </query>
2620
2621  <query id="COPY_FILE_PARAMETERS" type="SQL">
2622    <sql>
2623      INSERT INTO "ItemValues" ("id", "data_class", "data_class_id")
2624      SELECT "id", 'net.sf.basedb.core.data.FileData', "value"
2625      FROM "FileValues"
2626    </sql>
2627    <description>
2628      An SQL query that copies file parameter values into
2629      the item parameter values table.
2630    </description>
2631  </query>
2632
2633  <query id="DELETE_FILE_PARAMETERS" type="SQL">
2634    <sql>
2635      DELETE FROM "FileValues"
2636    </sql>
2637    <description>
2638      An SQL query that deletes old file parameter values (after they have been copied).
2639    </description>
2640  </query>
2641
2642  <query id="SET_ITEMTYPE_ON_DISKUSAGE" type="HQL">
2643    <sql>
2644      UPDATE DiskUsageData du
2645      SET du.itemType = :itemType
2646      WHERE du.id IN (:itemList)
2647      AND du.itemType IS NULL
2648    </sql>
2649    <description>
2650      A HQL query that sets the item type for disk usage items.
2651    </description>
2652  </query>
2653
2654  <query id="LOAD_DISKUSAGEID_FOR_FILES" type="HQL">
2655    <sql>
2656      SELECT f.diskUsage.id
2657      FROM FileData f
2658    </sql>
2659    <description>
2660      A HQL query that loads the disk usage ID for all files.
2661    </description>
2662  </query>
2663 
2664  <query id="LOAD_DISKUSAGEID_FOR_EXPERIMENTS" type="HQL">
2665    <sql>
2666      SELECT xp.diskUsage.id
2667      FROM ExperimentData xp
2668    </sql>
2669    <description>
2670      A HQL query that loads the disk usage ID for all experiments.
2671    </description>
2672  </query>
2673 
2674  <query id="LOAD_DISKUSAGEID_FOR_RAWBIOASSAYS" type="HQL">
2675    <sql>
2676      SELECT rba.diskUsage.id
2677      FROM RawBioAssayData rba
2678    </sql>
2679    <description>
2680      A HQL query that loads the disk usage ID for all raw bioassays.
2681    </description>
2682  </query>
2683
2684  <query id="SET_MAX_MAPPING_ON_DATACUBES" type="HQL">
2685    <sql>
2686      UPDATE DataCubeData dcd
2687      SET dcd.maxRawMappingsForSpot = -1
2688      WHERE dcd.maxRawMappingsForSpot IS NULL
2689    </sql>
2690    <description>
2691      A HQL query that sets the maxRawMappingsForSpot on all data cubes with a
2692      null value to -1. This is required so we can load them by Hibernate.
2693    </description>
2694  </query>
2695
2696  <query id="SET_MAX_MAPPING_ON_DATACUBE" type="HQL">
2697    <sql>
2698      UPDATE DataCubeData dcd
2699      SET dcd.maxRawMappingsForSpot = :mapCount
2700      WHERE dcd.id = :dataCube
2701    </sql>
2702    <description>
2703      A HQL query that sets the maxRawMappingsForSpot on a data cube.
2704    </description>
2705  </query>
2706
2707  <query id="GET_USED_QUANTITY_EVENTS" type="HQL">
2708    <sql>
2709      SELECT evt.bioMaterial, evt.usedQuantity
2710      FROM BioMaterialEventData evt
2711    </sql>
2712    <description>
2713      A HQL query that loads the biomaterial and the used quantity
2714      for all BioMaterialEvent:s.
2715    </description>
2716  </query>
2717 
2718  <query id="GET_USED_QUANTITY_SOURCES" type="HQL">
2719    <sql>
2720      SELECT index(src), src.usedQuantity
2721      FROM BioMaterialEventData evt
2722      JOIN evt.sources src
2723    </sql>
2724    <description>
2725      A HQL query that loads the used quantity
2726      for all sources to BioMaterialEvent:s.
2727    </description>
2728  </query>
2729
2730  <query id="SET_WRITE_PROTECTED_ON_FILES" type="HQL">
2731    <sql>
2732      UPDATE FileData f
2733      SET f.writeProtected = false
2734      WHERE f.writeProtected IS NULL
2735    </sql>
2736    <description>
2737      A HQL query that sets the writeProtected on all files with a
2738      null value to false.
2739    </description>
2740  </query>
2741 
2742  <query id="SET_REMOVE_JOB_ON_JOBS" type="HQL">
2743    <sql>
2744      UPDATE JobData j
2745      SET j.removeJobWhenFinished = false
2746      WHERE j.removeJobWhenFinished IS NULL
2747    </sql>
2748    <description>
2749      A HQL query that sets the deleteJobWhenFinished to false
2750      on all jobs with a null value.
2751    </description>
2752  </query> 
2753 
2754  <query id="GET_INTERNAL_FILES_WITH_NO_LAST_UPDATE" type="HQL">
2755    <sql>
2756      SELECT f
2757      FROM FileData f
2758      WHERE f.lastUpdate IS NULL AND NOT f.internalName IS NULL
2759    </sql>
2760    <description>
2761      A HQL query that sets the writeProtected on all files with a
2762      null value to false.
2763    </description>
2764  </query>
2765 
2766  <query id="LOAD_DEFAULT_GROUPS" type="HQL">
2767    <sql>
2768      SELECT grp
2769      FROM GroupData grp
2770      WHERE grp.default = true
2771    </sql>
2772    <description>
2773      A HQL query that loads all groups which are marked as default
2774      groups.
2775    </description>
2776  </query>
2777 
2778  <query id="LOAD_DEFAULT_ROLES" type="HQL">
2779    <sql>
2780      SELECT rle
2781      FROM RoleData rle
2782      WHERE rle.default = true
2783    </sql>
2784    <description>
2785      A HQL query that loads all roles which are marked as default
2786      roles.
2787    </description>
2788  </query>
2789 
2790  <query id="SET_DEFAULT_ON_GROUPS" type="HQL">
2791    <sql>
2792      UPDATE GroupData grp
2793      SET grp.default = false
2794      WHERE grp.default IS NULL
2795    </sql>
2796    <description>
2797      A HQL query that sets the isDefault flag to false for all
2798      groups with a null value.
2799    </description>
2800  </query>
2801 
2802  <query id="SET_DEFAULT_ON_ROLES" type="HQL">
2803    <sql>
2804      UPDATE RoleData rle
2805      SET rle.default = false
2806      WHERE rle.default IS NULL
2807    </sql>
2808    <description>
2809      A HQL query that sets the isDefault flag to false for all
2810      roles with a null value.
2811    </description>
2812  </query>
2813 
2814  <query id="SET_ITEM_ID_ON_CONTEXTS" type="HQL">
2815    <sql>
2816      UPDATE ContextData ctx
2817      SET ctx.itemId = 0
2818      WHERE ctx.itemId IS NULL
2819    </sql>
2820    <description>
2821      A HQL query that sets the itemId to 0 for all
2822      contexts with a null value.
2823    </description>
2824  </query>
2825 
2826  <query id="SET_AVERAGE_METHOD_ON_FORMULAS" type="HQL">
2827    <sql>
2828      UPDATE FormulaData f
2829      SET f.averageMethod = 2
2830      WHERE f.averageMethod IS NULL
2831    </sql>
2832    <description>
2833      A HQL query that sets the averageMethod to arithmetic mean for all
2834      formulas with a null value.
2835    </description>
2836  </query>
2837 
2838  <query id="SET_AVERAGE_METHOD_ON_EXTRAVALUETYPES" type="HQL">
2839    <sql>
2840      UPDATE ExtraValueTypeData evt
2841      SET evt.averageMethod = 2
2842      WHERE evt.averageMethod IS NULL
2843    </sql>
2844    <description>
2845      A HQL query that sets the averageMethod to arithmetic mean for all
2846      extra value types with a null value.
2847    </description>
2848  </query>
2849 
2850  <query id="UPDATE_PROPERTY_FILTER" type="SQL">
2851    <sql>
2852      UPDATE [PropertyFilters]
2853      SET [property] = :newProperty
2854      WHERE [property] = :oldProperty
2855      AND [context_id] NOT IN
2856      (
2857         SELECT [context_id]
2858         FROM [PropertyFilters]
2859         WHERE [property] = :newProperty
2860      )
2861    </sql>
2862    <description>
2863      An SQL query that changes the property for all PropertyFilters
2864      which filters on a given property. It must ignore any filter that 
2865      causes a duplicate key violation if a filter with the new
2866      property already exists for any context.
2867    </description>
2868  </query>
2869 
2870  <query id="UPDATE_PROPERTY_FILTER_VALUE" type="SQL">
2871    <sql>
2872      UPDATE [PropertyFilters]
2873      SET [value] = :newValue
2874      WHERE [property] = :property AND [value] = :oldValue
2875    </sql>
2876    <description>
2877      An SQL query that changes the property for all PropertyFilters
2878      with a given value.
2879    </description>
2880  </query>
2881 
2882  <query id="SET_AUTOCOMPRESS_ON_MIMETYPES" type="HQL">
2883    <sql>
2884      UPDATE MimeTypeData mt
2885      SET mt.autoCompress = false
2886      WHERE mt.autoCompress IS NULL
2887    </sql>
2888    <description>
2889      A HQL query that sets the autoCompress property to false for all
2890      MIME types with a null value.
2891    </description>
2892  </query>
2893 
2894  <query id="SET_AUTOCOMPRESS_ON_DIRECTORIES" type="HQL">
2895    <sql>
2896      UPDATE DirectoryData dir
2897      SET dir.autoCompress = false
2898      WHERE dir.autoCompress IS NULL
2899    </sql>
2900    <description>
2901      A HQL query that sets the autoCompress property to false for all
2902      directories with a null value.
2903    </description>
2904  </query>
2905
2906  <query id="SET_COMPRESSED_ON_FILES" type="HQL">
2907    <sql>
2908      UPDATE FileData f
2909      SET
2910        f.compressed = false,
2911        f.compressedSize = f.size
2912      WHERE f.compressed IS NULL
2913    </sql>
2914    <description>
2915      A HQL query that sets the compressed property to false and the
2916      compressedSize to size for all files with a null value.
2917    </description>
2918  </query>
2919 
2920  <query id="SET_NUMFEATURES_ON_ARRAYDESIGNS" type="HQL">
2921    <sql>
2922      UPDATE ArrayDesignData ad
2923      SET ad.numDbFeatures = 0, ad.numFileFeatures = 0
2924      WHERE ad.numDbFeatures IS NULL OR ad.numFileFeatures IS NULL
2925    </sql>
2926    <description>
2927      A HQL query that sets the number of file and db features to 0
2928      on all array designs with a null value.
2929    </description>
2930  </query>
2931 
2932  <query id="SET_NUMFILESPOTS_ON_RAWBIOASSAY" type="HQL">
2933    <sql>
2934      UPDATE RawBioAssayData rbd
2935      SET rbd.numFileSpots = 0
2936      WHERE rbd.numFileSpots IS NULL
2937    </sql>
2938    <description>
2939      A HQL query that sets the number of file aspots to 0
2940      on all raw bioassays with a null value.
2941    </description>
2942  </query>
2943
2944  <query id="GET_RAWBIOASSAYS_FOR_PLATFORM" type="HQL">
2945    <sql>
2946      SELECT {1}
2947      FROM RawBioAssayData rba
2948      WHERE rba.platform = :platform
2949    </sql>
2950    <description>
2951      A Hibernate query that gets raw bioassays
2952      with a given platform.
2953    </description>
2954  </query>
2955
2956  <query id="GET_ARRAYDESIGNS_FOR_PLATFORM" type="HQL">
2957    <sql>
2958      SELECT {1}
2959      FROM ArrayDesignData ad
2960      WHERE ad.platform = :platform
2961    </sql>
2962    <description>
2963      A Hibernate query that gets array designs
2964      with a given platform.
2965    </description>
2966  </query>
2967 
2968  <query id="GET_RAWBIOASSAYS_FOR_VARIANT" type="HQL">
2969    <sql>
2970      SELECT {1}
2971      FROM RawBioAssayData rba
2972      WHERE rba.variant = :variant
2973    </sql>
2974    <description>
2975      A Hibernate query that gets raw bioassays
2976      with a given platform variant.
2977    </description>
2978  </query>
2979
2980  <query id="GET_ARRAYDESIGNS_FOR_VARIANT" type="HQL">
2981    <sql>
2982      SELECT {1}
2983      FROM ArrayDesignData ad
2984      WHERE ad.variant = :variant
2985    </sql>
2986    <description>
2987      A Hibernate query that gets array designs
2988      with a given platform variant.
2989    </description>
2990  </query>
2991 
2992  <query id="GET_PLATFORM_FOR_EXTERNAL_ID" type="HQL">
2993    <sql>
2994      SELECT plf
2995      FROM PlatformData plf
2996      WHERE plf.externalId = :externalId
2997    </sql>
2998    <description>
2999      A Hibernate query that loads a platform by external ID.
3000    </description>
3001  </query>
3002 
3003  <query id="GET_PLATFORMVARIANT_FOR_EXTERNAL_ID" type="HQL">
3004    <sql>
3005      SELECT plv
3006      FROM PlatformVariantData plv
3007      WHERE plv.externalId = :externalId
3008    </sql>
3009    <description>
3010      A Hibernate query that loads a platform variant by external ID.
3011    </description>
3012  </query>
3013 
3014  <query id="GET_DATAFILETYPE_FOR_EXTERNAL_ID" type="HQL">
3015    <sql>
3016      SELECT dft
3017      FROM DataFileTypeData dft
3018      WHERE dft.externalId = :externalId
3019    </sql>
3020    <description>
3021      A Hibernate query that loads a data file type by external ID.
3022    </description>
3023  </query>
3024
3025  <query id="GET_FILESETMEMBERS_FOR_DATAFILETYPE" type="HQL">
3026    <sql>
3027      SELECT {1}
3028      FROM FileSetMemberData mbr
3029      WHERE mbr.dataFileType = :dataFileType
3030    </sql>
3031    <description>
3032      A Hibernate query that gets file set members of a specific
3033      data file type.
3034    </description>
3035  </query>
3036
3037  <query id="GET_PLATFORMFILETYPE_FOR_DATAFILETYPE" type="HQL">
3038    <sql>
3039      SELECT {1}
3040      FROM PlatformFileTypeData pft
3041      WHERE pft.dataFileType = :dataFileType
3042    </sql>
3043    <description>
3044      A Hibernate query that gets platform file types of a specific
3045      data file type.
3046    </description>
3047  </query>
3048 
3049  <query id="GET_FILESETMEMBER_FOR_DATAFILETYPE" type="HQL">
3050    <sql>
3051      SELECT mbr
3052      FROM FileSetMemberData mbr
3053      WHERE mbr.dataFileType.externalId = :externalId
3054      AND mbr.fileSet = :fileSet
3055    </sql>
3056    <description>
3057      A Hibernate query that loads a member in a given file set
3058      if we know the external ID of the data file type.
3059    </description>
3060  </query>
3061
3062 
3063  <query id="DELETE_PROPERTY_FILTER" type="SQL">
3064    <sql>
3065      DELETE FROM [PropertyFilters]
3066      WHERE [property] = :property
3067    </sql>
3068    <description>
3069      An SQL query that delete all PropertyFilters
3070      which filter on a given property.
3071    </description>
3072  </query>
3073 
3074  <query id="GET_PLUGINS_WITH_KEYS" type="HQL">
3075    <sql>
3076      SELECT DISTINCT pk.pluginDefinitionId
3077      FROM PluginKeys pk WHERE pk.keyId IN (:keys)
3078    </sql>
3079    <description>
3080      A HQL query that has been granted a specific permission. Used by
3081      update scripts when new item types are added to make sure existing
3082      plug-ins can continue to work.
3083    </description>
3084  </query>
3085
3086  <query id="CHANGE_EXPERIMENT_RAWDATATYPE" type="HQL">
3087    <sql>
3088      UPDATE ExperimentData
3089      SET rawDataType = :newRawDataType
3090      WHERE rawDataType = :oldRawDataType
3091    </sql>
3092    <description>
3093      A HQL query that changes all raw data type for experiments from
3094      an old value to a new value.
3095    </description>
3096  </query>
3097
3098  <query id="GET_PROJECTS_WITH_DEFAULT" type="HQL">
3099    <sql>
3100      SELECT prj
3101      FROM ProjectData prj
3102      WHERE prj.projectDefaults[:name] = :value
3103    </sql>
3104    <description>
3105      A HQL query that loads all projects which has a given default value
3106      for a setting.
3107    </description>
3108  </query>
3109
3110  <query id="SET_USEJOBQUEUE_ON_PLUGINS" type="HQL">
3111    <sql>
3112      UPDATE PluginDefinitionData pld
3113      SET pld.useInternalJobQueue = true
3114      WHERE pld.useInternalJobQueue IS NULL
3115    </sql>
3116    <description>
3117      A HQL query that set the useInternalJobQueue property to true
3118      for all plug-ins.
3119    </description>
3120  </query>
3121 
3122  <query id="SET_FEATUREIDENTIFICATIONMETHOD_ON_ARRAYDESIGNS" type="HQL">
3123    <sql>
3124      UPDATE ArrayDesignData ad
3125      SET ad.featureIdentificationMethod = :method
3126      WHERE ad.featureIdentificationMethod IS NULL
3127    </sql>
3128    <description>
3129      A HQL query that set the featureIdentificationMethod property
3130      on all array designs with a null value.
3131    </description>
3132  </query>
3133 
3134  <query id="UPDATE_JOB_STATUS" type="HQL">
3135    <sql>
3136      UPDATE JobData job
3137      SET
3138        job.percentComplete = :percent,
3139        job.statusMessage = :statusMessage
3140      WHERE job.id = :id
3141    </sql>
3142    <description>
3143      A HQL query that updates the progress information on a specific job.
3144    </description>
3145  </query>
3146 
3147  <query id="APPEND_JOB_STATUS" type="HQL">
3148    <sql>
3149      UPDATE JobData job
3150      SET
3151        job.statusMessage = job.statusMessage || :statusMessage
3152      WHERE job.id = :id
3153    </sql>
3154    <description>
3155      A HQL query that appends a string to the status message on a specific job.
3156    </description>
3157  </query>
3158
3159  <query id="SET_NUMARRAYS_ON_ARRAYDESIGNS" type="HQL">
3160    <sql>
3161      UPDATE ArrayDesignData ad
3162      SET ad.numArrays = :numArrays
3163      WHERE ad.numArrays IS NULL
3164    </sql>
3165    <description>
3166      A HQL query that set the numArrays property
3167      on all array designs with a null value.
3168    </description>
3169  </query>
3170 
3171  <query id="SET_NUMARRAYS_ON_HYBRIDIZATIONS" type="HQL">
3172    <sql>
3173      UPDATE HybridizationData hyb
3174      SET hyb.numArrays = :numArrays
3175      WHERE hyb.numArrays IS NULL
3176    </sql>
3177    <description>
3178      A HQL query that set the numArrays property
3179      on all hybridizations with a null value.
3180    </description>
3181  </query>
3182 
3183  <query id="SET_ARRAYNUM_ON_RAWBIOASSAYS" type="HQL">
3184    <sql>
3185      UPDATE RawBioAssayData rba
3186      SET rba.arrayNum = :arrayNum
3187      WHERE rba.arrayNum IS NULL
3188    </sql>
3189    <description>
3190      A HQL query that set the arrayNum property
3191      on all raw bioassays with a null value.
3192    </description>
3193  </query>
3194 
3195  <query id="SET_FEATUREDIAMETER_ON_ARRAYDESIGNBLOCKS" type="HQL">
3196    <sql>
3197      UPDATE ArrayDesignBlockData adb
3198      SET adb.featureDiameter = :featureDiameter
3199      WHERE adb.featureDiameter IS NULL
3200    </sql>
3201    <description>
3202      A HQL query that set the featureDiameter property
3203      on all array design blocks with a null value.
3204    </description>
3205  </query>
3206 
3207  <query id="LOAD_RAWBIOASSAY_JOBS_IN_EXPERIMENT" type="HQL">
3208    <sql>
3209      SELECT DISTINCT rba.job.id
3210      FROM RawBioAssayData rba
3211      WHERE rba.job.experiment = :experiment
3212    </sql>
3213    <description>
3214      A HQL query that loads the ID:s of all jobs that are part
3215      of a given experiment and also has been assigned to at
3216      least one raw bioassay.
3217    </description>
3218  </query>
3219 
3220  <query id="LOAD_ARRAYDESIGN_JOBS_IN_EXPERIMENT" type="HQL">
3221    <sql>
3222      SELECT ad.job.id
3223      FROM ArrayDesignData ad
3224      WHERE ad.job.experiment = :experiment
3225    </sql>
3226    <description>
3227      A HQL query that loads the ID:s of all jobs that are part
3228      of a given experiment and also has been assigned to at
3229      least one array design.
3230    </description>
3231  </query>
3232
3233  <query id="UNLINK_JOBS_FROM_EXPERIMENT" type="HQL">
3234    <sql>
3235      UPDATE JobData job
3236      SET job.experiment = null
3237      WHERE job.id IN (:list)
3238    </sql>
3239    <description>
3240      A HQL query that set the experiment property to null for
3241      a given set of jobs.
3242    </description>
3243  </query>
3244 
3245  <query id="SET_REPORTERLIST_SIZE" type="HQL">
3246    <sql>
3247      UPDATE ReporterListData rl
3248      SET rl.size = size(rl.reporterListScores)
3249      WHERE rl.size IS NULL
3250    </sql>
3251    <description>
3252      A HQL query that set the size of a reporter list
3253      that is missing this information.
3254    </description>
3255  </query>
3256
3257  <query id="SET_AUTOSHARE_ON_DIRECTORIES" type="HQL">
3258    <sql>
3259      UPDATE DirectoryData dir
3260      SET dir.autoShare = :autoShare
3261      WHERE dir.autoShare IS NULL
3262    </sql>
3263    <description>
3264      A HQL query that set the autoShare property on all
3265      directories witha  null value.
3266    </description>
3267  </query>
3268
3269  <query id="SET_NUMFILEVALUES_ON_BIOASSAYSETS" type="HQL">
3270    <sql>
3271      UPDATE BioAssaySetData bas
3272      SET bas.numFileReporters = 0, bas.numFileSpots = 0
3273      WHERE bas.numFileReporters IS NULL OR bas.numFileSpots IS NULL
3274    </sql>
3275    <description>
3276      A HQL query that set the numFileReporters and numFileSpots properties
3277      to 0 on all bioassay sets with a null value.
3278    </description>
3279  </query>
3280 
3281  <query id="SET_NUMFILEVALUES_ON_BIOASSAYS" type="HQL">
3282    <sql>
3283      UPDATE BioAssayData ba
3284      SET ba.numFileSpots = 0
3285      WHERE ba.numFileSpots IS NULL
3286    </sql>
3287    <description>
3288      A HQL query that set the numFileSpots property
3289      to 0 on all bioassay with a null value.
3290    </description>
3291  </query>
3292 
3293  <query id="SET_NUMFILEVALUES_ON_EXTRAVALUES" type="HQL">
3294    <sql>
3295      UPDATE ExtraValueData ev
3296      SET ev.numFileValues = 0
3297      WHERE ev.numFileValues IS NULL
3298    </sql>
3299    <description>
3300      A HQL query that set the numFileValues property
3301      to 0 on all extra values with a null value.
3302    </description>
3303  </query>
3304 
3305  <query id="SET_DRYRUN_ON_JOBS" type="HQL">
3306    <sql>
3307      UPDATE JobData job
3308      SET job.dryRun = false
3309      WHERE job.dryRun IS NULL
3310    </sql>
3311    <description>
3312      A HQL query that set the dryRun property
3313      to false on all jobs with a null value.
3314    </description>
3315  </query>
3316 
3317  <query id="GET_UNIT_WITH_NAME_FOR_QUANTITY" type="HQL">
3318    <sql>
3319      SELECT unt
3320      FROM UnitData unt
3321      WHERE unt.quantity = :quantity
3322      AND unt.name = :name
3323    </sql>
3324    <description>
3325      A HQL query that finds the unit for a quantity
3326      with a given name.
3327    </description>
3328  </query>
3329
3330  <query id="GET_UNITS_FOR_QUANTITY" type="HQL">
3331    <sql>
3332      SELECT {1}
3333      FROM UnitData unt
3334      WHERE unt.quantity = :quantity
3335    </sql>
3336    <description>
3337      A Hibernate query that gets units
3338      for a given quantity.
3339    </description>
3340  </query>
3341
3342  <query id="GET_ANNOTATIONTYPES_FOR_QUANTITY" type="HQL">
3343    <sql>
3344      SELECT {1}
3345      FROM AnnotationTypeData at
3346      WHERE at.quantity = :quantity
3347    </sql>
3348    <description>
3349      A Hibernate query that gets annotation types
3350      that are using a given quantity.
3351    </description>
3352  </query>
3353 
3354  <query id="GET_ANNOTATIONTYPES_FOR_UNIT" type="HQL">
3355    <sql>
3356      SELECT {1}
3357      FROM AnnotationTypeData at
3358      WHERE at.defaultUnit = :unit
3359    </sql>
3360    <description>
3361      A Hibernate query that gets annotation types
3362      that are using a given unit as default unit.
3363    </description>
3364  </query>
3365 
3366  <query id="GET_ANNOTATIONS_FOR_UNIT" type="HQL">
3367    <sql>
3368      SELECT {1}
3369      FROM AnnotationData a
3370      WHERE a.unit = :unit
3371    </sql>
3372    <description>
3373      A Hibernate query that gets annotations
3374      that are using a given unit.
3375    </description>
3376  </query>
3377 
3378  <query id="GET_UNIT_WITH_SYMBOL_FOR_QUANTITY" type="HQL">
3379    <sql>
3380      SELECT unt
3381      FROM UnitData unt
3382      JOIN unt.symbols smb
3383      WHERE unt.quantity = :quantity
3384      AND smb.symbol = :symbol
3385    </sql>
3386    <description>
3387      A HQL query that finds the unit for a quantity
3388      with a given symbol.
3389    </description>
3390  </query>
3391 
3392  <query id="GET_UNIT_WITH_SYMBOL_FOR_UNIT" type="HQL">
3393    <sql>
3394      SELECT smb.unit
3395      FROM UnitSymbolData smb
3396      JOIN smb.quantity qnt
3397      JOIN qnt.units unt
3398      WHERE unt = :unit
3399      AND smb.symbol = :symbol
3400    </sql>
3401    <description>
3402      A HQL query that finds the unit with a given symbol
3403      that has the same quantity as another unit.
3404    </description>
3405  </query>
3406 
3407  <query id="SET_UNIT_TO_NULL_ON_PROPERTY_FILTERS" type="SQL">
3408    <sql>
3409      UPDATE [PropertyFilters]
3410      SET [unit_id] = null
3411      WHERE [unit_id] = :unit
3412    </sql>
3413    <description>
3414      A SQL query that sets the unit to null for all properties
3415      with a given unit (about to be deleted).
3416    </description>
3417  </query>
3418 
3419  <query id="RECALCULATE_ANNOTATIONS_WITH_ANNOTATIONTYPE" type="SQL">
3420    <sql>
3421      UPDATE {1}
3422      SET value = value * :factor + :offset
3423      WHERE id IN
3424      (
3425        SELECT [value_id]
3426        FROM [Annotations]
3427        WHERE [annotationtype_id] = :annotationType
3428      )
3429    </sql>
3430    <description>
3431      A SQL query that recalculates the annotation values for
3432      a given annotation type.
3433    </description>
3434  </query>
3435 
3436  <query id="SET_UNIT_ON_ANNOTATIONS_WITH_ANNOTATIONTYPE" type="HQL">
3437    <sql>
3438      UPDATE AnnotationData a
3439      SET a.unit = :unit
3440      WHERE a.annotationType = :annotationType
3441    </sql>
3442    <description>
3443      A HQL query that changes the unit for all annotations with a given
3444      annotation type.
3445    </description>
3446  </query>
3447 
3448  <query id="RECALCULATE_ANNOTATIONS_FOR_UNIT" type="SQL">
3449    <sql>
3450      UPDATE {1} SET value = value * :factor + :offset
3451      WHERE id IN
3452      (
3453        SELECT [a].[value_id]
3454        FROM [Annotations] [a]
3455        JOIN [AnnotationTypes] [at] ON [at].[id] = [a].[annotationtype_id]
3456        WHERE [at].[value_type] = :valueType
3457        AND
3458        (
3459          (:case = 1 AND [a].[unit_id] = :unit AND [at].[default_unit_id] &lt;&gt; :unit)
3460          OR
3461          (:case = 2 AND [a].[unit_id] &lt;&gt; :unit AND [at].[default_unit_id] = :unit)
3462        )
3463      )
3464    </sql>
3465    <description>
3466      A SQL query that recalculates the annotation values for
3467      when reference factor and/or offset changes. The query must handle
3468      two cases where either the annotation type's default unit
3469      or the annotation's unit matched. More info in doc for the
3470      Unit.changeReferenceFactorAndOffset() method.
3471    </description>
3472  </query>
3473  <query id="UPDATE_BIOMATERIALLIST_SIZE" type="SQL">
3474    <sql>
3475      UPDATE [BioMaterialLists]
3476      SET [size] = [size] + :delta
3477      WHERE [id] IN (
3478        SELECT bml.[list_id]
3479        FROM [BioMaterialListMembers] bml
3480        WHERE bml.[biomaterial_id] = :bioMaterialId
3481      )
3482    </sql>
3483    <description>
3484      An update query that changes the size for all biomaterial lists
3485      where a given biomaterial is a member. Mainly used to decrease
3486      the size when a biomaterial is deleted.
3487    </description>
3488  </query>
3489 
3490  <query id="GET_BIOMATERIAL_ON_PLATE" type="HQL">
3491    <sql>
3492      SELECT {1}
3493      FROM MeasuredBioMaterialData mbm
3494      JOIN mbm.bioWell bw
3495      WHERE bw.bioPlate = :bioPlate
3496    </sql>
3497    <description>
3498      A HQL query that gets MeasuredBioMaterial:s
3499      located on a given bioplate.
3500    </description>
3501  </query>
3502  <query id="GET_CHILD_PLATES_FOR_PLATE" type="HQL">
3503    <sql>
3504      SELECT {1}
3505      FROM BioPlateData bp
3506      JOIN bp.creationEvent ce
3507      WHERE ce.sourcePlate = :bioPlate
3508    </sql>
3509    <description>
3510      A HQL query that gets BioPlates that are children
3511      to a given bioplate.
3512    </description>
3513  </query>
3514  <query id="SET_AUTOPERMISSION_ON_PROJECTS" type="HQL">
3515    <sql>
3516      UPDATE ProjectData prj
3517      SET prj.autoPermission = :permission
3518      WHERE prj.autoPermission IS NULL
3519    </sql>
3520    <description>
3521      An update query that sets the autoPermission on all
3522      projects that doesn't have a value.
3523    </description>
3524  </query>
3525  <query id="SET_INTENSITYTRANSFORM_ON_BIOASSAYSETS" type="HQL">
3526    <sql>
3527      UPDATE BioAssaySetData bas
3528      SET bas.intensityTransform = :transform
3529      WHERE bas.intensityTransform IS NULL
3530    </sql>
3531    <description>
3532      An update query that sets the intensityTransform on all
3533      bioassay sets that doesn't have a value.
3534    </description>
3535  </query>
3536  <query id="FIND_USED_TYPES_IN_ANYTOANY" type="SQL">
3537    <sql>
3538      SELECT [a].[from_type] FROM [AnyToAny] [a]
3539      UNION
3540      SELECT [a].[to_type] FROM [AnyToAny] [a]
3541    </sql>
3542    <description>
3543      An SQL query that selects all used item types in any-to-any
3544      links. It must select both the the 'from' and 'to' item type.
3545    </description>
3546  </query>
3547  <query id="SELECT_STRAY_ANYTOANY" type="SQL">
3548    <sql>
3549      SELECT [a].[id]
3550      FROM [AnyToAny] [a]
3551      LEFT JOIN [{1}] [t]
3552        ON ([t].[id] = [a].[from_id] AND [a].[from_type] = :type)
3553        OR ([t].[id] = [a].[to_id] AND [a].[to_type] = :type)
3554      WHERE [t].[id] IS NULL
3555      AND ([a].[from_type] = :type OR [a].[to_type] = :type)
3556    </sql>
3557    <description>
3558      An SQL query that selects the ID of all any-to-any links were
3559      either the 'from' or 'to' item is missing. A single query
3560      is used to delete all items of a specific type (both
3561      'from' and 'to).
3562    </description>
3563  </query>
3564  <query id="DELETE_STRAY_ANYTOANY" type="HQL">
3565    <sql>
3566      DELETE FROM AnyToAnyData
3567      WHERE id IN (:ids)
3568    </sql>
3569    <description>
3570      A HQL query that deletes all any-to-any links with the
3571      id's given in the list.
3572    </description>
3573  </query>
3574  <query id="FIND_USED_TYPES_IN_CHANGEHISTORY" type="HQL">
3575    <sql>
3576      SELECT DISTINCT ch.itemType FROM ChangeHistoryDetailData ch
3577    </sql>
3578    <description>
3579      An HQL query that selects all used item types in the change
3580      history table.
3581    </description>
3582  </query>
3583  <query id="DELETE_STRAY_CHANGEHISTORY" type="HQL">
3584    <sql>
3585      DELETE FROM ChangeHistoryDetailData
3586      WHERE id IN (:ids)
3587    </sql>
3588    <description>
3589      A HQL query that deletes all change history entries with the
3590      id's given in the list.
3591    </description>
3592  </query>
3593  <query id="SELECT_STRAY_CHANGEHISTORY" type="SQL">
3594    <sql>
3595      SELECT [ch].[id]
3596      FROM [ChangeHistoryDetails] [ch]
3597      LEFT JOIN [{1}] [t]
3598        ON ([t].[id] = [ch].[item_id] AND [ch].[item_type] = :type)
3599      WHERE [t].[id] IS NULL
3600      AND [ch].[item_type] = :type
3601    </sql>
3602    <description>
3603      An SQL query that selects the ID of all change history entries
3604      that references a missing item of a specified type.
3605    </description>
3606  </query>
3607  <query id="DBLOG_GET_ANNOTATIONTYPE_NAME" type="HQL">
3608    <sql>
3609      SELECT at.name
3610      FROM AnnotationTypeData at
3611      WHERE at.id = :annotationTypeId
3612    </sql>
3613    <description>
3614      An HQL query that loads the name of an annotation type
3615      given the ID.
3616    </description>
3617  </query>
3618  <query id="DBLOG_GET_ANNOTATION_ITEMTYPE" type="HQL">
3619    <sql>
3620      SELECT as.itemType
3621      FROM AnnotationSetData as
3622      WHERE as.id = :annotationSetId
3623    </sql>
3624    <description>
3625      An HQL query that loads the item type value an annotation
3626      set with a given ID belongs to.
3627    </description>
3628  </query>
3629  <query id="DBLOG_GET_ITEMID_WITH_ANNOTATION" type="HQL">
3630    <sql>
3631      SELECT i.id
3632      FROM {1} i
3633      WHERE i.annotationSet = :annotationSetId
3634    </sql>
3635    <description>
3636      An HQL query that loads the ID of the item that
3637      is associated with a given annotation set.
3638    </description>
3639  </query>
3640  <query id="DBLOG_GET_DATAFILETYPE_NAME" type="HQL">
3641    <sql>
3642      SELECT dft.name
3643      FROM DataFileTypeData dft
3644      WHERE dft.id = :dataFileTypeId
3645    </sql>
3646    <description>
3647      An HQL query that loads the name of a data file type
3648      given the ID.
3649    </description>
3650  </query>
3651  <query id="DBLOG_GET_FILESET_ITEMTYPE" type="HQL">
3652    <sql>
3653      SELECT fs.itemType
3654      FROM FileSetData fs
3655      WHERE fs.id = :fileSetId
3656    </sql>
3657    <description>
3658      An HQL query that loads the item type value a file set
3659      set with a given ID belongs to.
3660    </description>
3661  </query>
3662  <query id="DBLOG_GET_ITEMID_WITH_FILESET" type="HQL">
3663    <sql>
3664      SELECT i.id
3665      FROM {1} i
3666      WHERE i.fileSet = :fileSetId
3667    </sql>
3668    <description>
3669      An HQL query that loads the ID of the item that
3670      is associated with a given file set.
3671    </description>
3672  </query>
3673  <query id="DBLOG_GET_PLATEEVENTTYPE_NAME" type="HQL">
3674    <sql>
3675      SELECT pet.name
3676      FROM PlateEventTypeData pet
3677      WHERE pet.id = :plateEventTypeId
3678    </sql>
3679    <description>
3680      An HQL query that loads the name of a plate event type
3681      given the ID.
3682    </description>
3683  </query>
3684  <query id="SET_HIDDENMEMBERS_ON_GROUPS" type="HQL">
3685    <sql>
3686      UPDATE GroupData grp
3687      SET grp.hiddenMembers = :hiddenMembers
3688      WHERE grp.hiddenMembers IS NULL
3689    </sql>
3690    <description>
3691      An HQL query that sets the hiddenMembers flag on all
3692      groups with a null value.
3693    </description>
3694  </query>
3695  <query id="GET_GROUPS_WITH_NONHIDDENMEMBERS" type="HQL">
3696    <sql>
3697      SELECT grp.id
3698      FROM GroupData grp
3699      WHERE grp.hiddenMembers = false
3700      AND grp.id IN (:groups)
3701    </sql>
3702    <description>
3703      A HQL query that selects the ID of the groups among a given set of
3704      groups that has 'hiddenMembers=false'
3705    </description>
3706  </query>
3707  <query id="FIX_NULL_IN_CONTEXTS_SORT_PROPERTY" type="SQL">
3708    <sql>
3709      update [Contexts]
3710      set [sort_property] = null
3711      where [sort_property] like '%null%'
3712    </sql>
3713    <description>
3714      An SQL query that replaces all 'null' strings in Context.sort_property with
3715      null values.
3716    </description>
3717  </query>
3718  <query id="GET_BIOPLATES_FOR_BIOPLATETYPE" type="HQL">
3719    <sql>
3720      SELECT {1}
3721      FROM BioPlateData bpl
3722      WHERE bpl.bioPlateType = :bioPlateType
3723    </sql>
3724    <description>
3725      A HQL query that gets the bioplates using a given type.
3726    </description>
3727  </query>
3728 
3729  <query id="GET_BIOPLATETYPE_WITH_NAME" type="HQL">
3730    <sql>
3731      SELECT bpt
3732      FROM BioPlateTypeData bpt
3733      WHERE bpt.name = :name
3734    </sql>
3735    <description>
3736      A HQL query that gets the bioplate type with a given name.
3737    </description>
3738  </query>
3739  <query id="GET_PROJECTS_FOR_PERMISSION_TEMPLATE" type="HQL">
3740    <sql>
3741      SELECT {1}
3742      FROM ProjectData prj
3743      WHERE prj.permissionTemplate = :permissionTemplate
3744    </sql>
3745    <description>
3746      A HQL query that gets the projects that are using a given permission
3747      template.
3748    </description>
3749  </query>
3750
3751  <query id="SET_PLATETYPE_ON_BIOPLATES" type="HQL">
3752    <sql>
3753      UPDATE BioPlateData bpl
3754      SET bpl.bioPlateType = :plateType
3755      WHERE bpl.bioPlateType IS NULL
3756    </sql>
3757    <description>
3758      An update query that sets the plate type on all
3759      bioplates that doesn't have a value.
3760    </description>
3761  </query>
3762 
3763  <query id="SET_GROUP_TO_NULL_ON_DISK_USAGE" type="HQL">
3764    <sql>
3765      UPDATE DiskUsageData du
3766        SET du.group = null
3767        WHERE du.group = :group
3768    </sql>
3769    <description>
3770      An HQL update-query that sets group to null on all
3771      diskusage that are associated with a given group.
3772    </description>
3773  </query>
3774
3775  <query id="SET_SCHEDULED_FOR_JOBS" type="HQL">
3776    <sql>
3777      UPDATE JobData job
3778      SET job.scheduled = job.created
3779      WHERE job.status > 1 AND job.scheduled IS NULL
3780    </sql>
3781    <description>
3782      An HQL update-query that sets the scheduled date
3783      to the creation date for existing jobs that have been
3784      scheduled and doesn't have a scheduled date.
3785    </description>
3786  </query>
3787
3788  <query id="DELETE_CONTEXTSETTING_BY_NAME_AND_VALUE" type="SQL">
3789    <sql>
3790      DELETE FROM [ContextSettings]
3791      WHERE [name] LIKE :name AND [value] LIKE :value
3792    </sql>
3793    <description>
3794      An SQL-query that delete context-related settings with
3795      name and value mathing a given pattern.
3796    </description>
3797  </query>
3798
3799  <query id="SET_SEND_MESSAGES_AS_EMAIL_FOR_USERS" type="HQL">
3800    <sql>
3801      UPDATE UserData usr
3802      SET usr.sendMessagesAsEmail = :sendMessagesAsEmail
3803      WHERE usr.sendMessagesAsEmail IS NULL
3804    </sql>
3805    <description>
3806      An HQL update-query that sets the 'sendMessagesAsEmail' flag
3807      for all users where it is null.
3808    </description>
3809  </query>
3810
3811  <query id="SET_DESTROYED_FOR_BIOPLATES" type="HQL">
3812    <sql>
3813      UPDATE BioPlateData bp
3814      SET bp.destroyed = false
3815      WHERE bp.destroyed IS NULL
3816    </sql>
3817    <description>
3818      An HQL update-query that sets the 'destroyed' flag
3819      for all bioplates where it is null.
3820    </description>
3821  </query>
3822
3823  <query id="CLEAR_ORIGINAL_BIOMATERIAL_ON_BIOWELLS" type="HQL">
3824    <sql>
3825      UPDATE BioWellData bw
3826      SET bw.originalBioMaterial = null
3827      WHERE bw.originalBioMaterial = :bioMaterial
3828    </sql>
3829    <description>
3830      An HQL update-query that for a given biomaterial clears the
3831      link on all biowells were it is set as the original biomaterial.
3832    </description>
3833  </query>
3834
3835</predefined-queries>
Note: See TracBrowser for help on using the repository browser.