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

Last change on this file since 4383 was 4380, checked in by Nicklas Nordborg, 15 years ago

Fixes #1064: Add support for dry-run to the plug-in system

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