Changeset 3796
- Timestamp:
- Sep 27, 2007, 10:05:24 PM (16 years ago)
- Location:
- branches/filedb
- Files:
-
- 1 deleted
- 27 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/filedb/build.xml
r3783 r3796 1078 1078 <mkdir dir="${docbook.html.out}/userdoc/trashcan"/> 1079 1079 <mkdir dir="${docbook.html.out}/userdoc/webclient"/> 1080 <mkdir dir="${docbook.html.out}/userdoc/overview"/> 1080 1081 <mkdir dir="${docbook.html.out}/faqs" /> 1081 1082 <mkdir dir="${docbook.html.out}/appendix" /> -
branches/filedb/doc/src/docbook/appendix/menuguide.xml
r3675 r3796 37 37 <listitem> 38 38 <simpara> 39 <link linkend="menuguide.tables.config">Config </link>39 <link linkend="menuguide.tables.config">Configurations</link> 40 40 </simpara> 41 41 </listitem> -
branches/filedb/doc/src/docbook/developerdoc/api_overview.xml
r3783 r3796 824 824 The <classname>PlatformData</classname> holds information about a 825 825 platform. A platform can have one or more <classname>PlatformVariant</classname>:s. 826 Both the platform and variant are identified by a systemID that826 Both the platform and variant are identified by an external ID that 827 827 is fixed and can't be changed. <emphasis>Affymetrix</emphasis> 828 828 and <emphasis>Illumina</emphasis> are examples of platforms. … … 837 837 <para> 838 838 Each platform and it's variant can be connected to one or more 839 <classname> FileSetMemberTypeData</classname> items. This item839 <classname>DataFileTypeData</classname> items. This item 840 840 describes the kind of files that are used to hold data for 841 841 the platform and/or variant. The file types are re-usable between … … 848 848 <para> 849 849 The file type is also identified 850 by a fixed, non-changable systemID. The <varname>itemType</varname>850 by a fixed, non-changable external ID. The <varname>itemType</varname> 851 851 property tells us what type of item the file holds data for (ie. 852 852 array design or raw bioassay). It also links to a <classname>FileType</classname> … … 857 857 get another file. 858 858 </para> 859 <para> 860 The <varname>required</varname> flag in <classname>PlatformFileTypeData</classname> 861 is used to signal that the file is a required file. This will, however, not be 862 enforeced by the core. It is intended to be used by client applications 863 for creating a better GUI and/or validation of an experiment. 864 </para> 859 865 860 866 </sect3> 861 867 862 868 <sect3 id="data_api.platforms.files"> 863 <title> Files</title>869 <title>Data files</title> 864 870 865 871 <para> 866 872 An item must implement the <interfacename>FileStoreEnabledData</interfacename> 867 873 interface to be able to store data in files instead of in the database. 868 The interface creates a link to a <classname>FileSetData</classname> object. 869 In a file set it is only possible to store one file for each 870 <classname>FileSetMemberTypeData</classname> item. 874 The interface creates a link to a <classname>FileSetData</classname> object, 875 which is can hold several <classname>FileSetMemberData</clasname> items. 876 Each member points to specific <classname>FileData</classname> item. 877 A file set can only store one file of each type. 871 878 </para> 872 879 … … 1030 1037 <para> 1031 1038 Given that we have a <interfacename>FileStoreEnabled</interfacename> 1032 item we use the <methodname> FileSetMemberType.getQuery()</methodname>1039 item we use the <methodname>DataFileType.getQuery()</methodname> 1033 1040 method to find which file types that can be used for that 1034 1041 item. Internally, the <methodname>getQuery()</methodname> … … 1039 1046 a platform or variant the query will only return file types 1040 1047 that are associated with the given item type, but not with any specific 1041 platform. In any case, we get a list of <classname> FileSetMemberType</classname>1048 platform. In any case, we get a list of <classname>DataFileType</classname> 1042 1049 items, each one representing a specific file type that 1043 1050 we should ask the user about. Examples: … … 1069 1076 DbControl dc = ... 1070 1077 FileStoreEnabled item = ... 1071 ItemQuery< FileSetMemberType> query =1072 FileSetMemberType.getQuery(item);1073 List< FileSetMemberType> types = query.list(dc);1078 ItemQuery<DataFileType> query = 1079 DataFileType.getQuery(item); 1080 List<DataFileType> types = query.list(dc); 1074 1081 // We now have a list of file types... 1075 1082 // ... ask the user to select a file for each one of them … … 1099 1106 and metadata extraction is automatically done by the core when a 1100 1107 file is added to a file set. The process is partly pluggable 1101 since each <classname> FileSetMemberType</classname> can name a class1108 since each <classname>DataFileType</classname> can name a class 1102 1109 that should do the validation and/or metadata extraction. 1103 1110 Here is the general outline: … … 1106 1113 <programlisting> 1107 1114 FileStoreEnabled item = ... 1108 FileSetMemberType type = ...1115 DataFileType type = ... 1109 1116 File file = ... 1110 1117 FileSetMember member = new FileSetMember(file, type); 1111 1118 1112 FileValidator validator = type.getValidator();1113 MetadataReader metadata = type.getMetadataReader();1119 DataFileValidator validator = type.getValidator(); 1120 DataFileMetadataReader metadata = type.getMetadataReader(); 1114 1121 validator.setFile(member); 1115 1122 validator.setItem(item); … … 1135 1142 <para> 1136 1143 All validators and meta data extractors should extend 1137 the <classname>Abstract FileHandler</classname> class. The reason1138 is that we may want to add more methods to the <interfacename> FileHandler</interfacename>1139 interface in the future. The <classname>Abstract FileHandler</classname> will1144 the <classname>AbstractDataFileHandler</classname> class. The reason 1145 is that we may want to add more methods to the <interfacename>DataFileHandler</interfacename> 1146 interface in the future. The <classname>AbstractDataFileHandler</classname> will 1140 1147 be used to provide default implementations for backwards compatibility. 1141 1148 </para> -
branches/filedb/doc/src/docbook/developerdoc/documentation.xml
r3715 r3796 982 982 <tip> 983 983 <para> 984 Change your BASE <link linkend="webclient.configuration.preferences"985 >preferences</link> to a smaller font size or use986 the zoom functionality in the web browser to make more information987 fit in the same image width.984 Change your BASE preferences, see 985 <xref linkend="webclient.configuration.preferences" />, 986 to a smaller font size or use the zoom functionality in the web 987 browser to make more information fit in the same image width. 988 988 </para> 989 989 </tip> -
branches/filedb/doc/src/docbook/userdoc/index.xml
r3783 r3796 29 29 <?dbhtml dir="userdoc"?> 30 30 <title>User documentation</title> 31 <include file=" userdoc_overview.xml"/>31 <include file="overview.xml"/> 32 32 <include file="webclient.xml"/> 33 33 <include file="project_permission.xml"/> -
branches/filedb/doc/src/docbook/userdoc/project_permission.xml
r3684 r3796 107 107 <listitem> 108 108 <para> 109 Permission to change the owner of an item. This is implemented110 as a <link linkend="webclient.items.takeownership">Take ownership</link>111 function in the web client, where you can take the ownership of112 items that you do not alreadyown.109 Permission to change the owner of an item. This is implemented as a 110 <synopsis>Take ownership</synopsis> function in the web client 111 (<xref linkend="webclient.items.takeownership" />), where you can 112 take the ownership of items that you do not already own. 113 113 </para> 114 114 </listitem> … … 386 386 <listitem> 387 387 <para> 388 The easiest way and the one you will probably 389 use most of the time is to use the 390 <link linkend="webclient.intro.menubar">menu bar</link> shortcut. 391 Look in the menu for the project icon (<guiicon><inlinemediaobject> 392 <imageobject><imagedata fileref="figures/project.gif" format="GIF" /></imageobject> 393 </inlinemediaobject></guiicon>). Next to it, the name of the active project 394 is displayed. If you see <guilabel>- none -</guilabel> here, it 395 means that no project is active. Click on the icon or project name 396 to open a drop-down menu and select a project to set as the active 397 project. If another project is already active it will automatically 398 be unactivated. 388 The easiest way and the one you will probably use most of the time 389 is to use the menu bar shortcut. Look in the menu for the project 390 icon 391 (<guiicon> 392 <inlinemediaobject> 393 <imageobject> 394 <imagedata fileref="figures/project.gif" format="GIF" /> 395 </imageobject> 396 </inlinemediaobject> 397 </guiicon>). 398 Next to it, the name of the active project is displayed. If you see 399 <guilabel>- none -</guilabel> 400 here, it means that no project is active. Click on the icon or 401 project name to open a drop-down menu and select a project to set as 402 the active project. If another project is already active it will 403 automatically be inactivated. 399 404 </para> 400 405 </listitem> -
branches/filedb/doc/src/docbook/userdoc/webclient.xml
r3675 r3796 1006 1006 the same protocol is used the next time you create another extract. 1007 1007 In fact, BASE will remember as many items as specified by 1008 the <link linkend="webclient.configuration.preferences.appearance"> 1009 <guilabel>Recently used items</guilabel></link> setting (default is 4), 1010 allowing you to quickly select one of those protocols. 1008 the 1009 <guilabel>Recently used items</guilabel> setting (default is 4), 1010 allowing you to quickly select one of those protocols. 1011 <xref linkend="webclient.configuration.preferences.appearance"/> 1012 contains more information about the setting. 1011 1013 </para> 1012 1014 </listitem> … … 1101 1103 You can restore deleted items either from the trashcan, 1102 1104 from the list view or from the single-item view. This section only covers the last two 1103 cases. The trashcan has a <link linkend="trashcan">chapter of it's own</link>.1105 cases. The trashcan has a section of it's own(<xref linkend="trashcan"/>). 1104 1106 </para> 1105 1107 … … 1322 1324 1323 1325 <para> 1324 Use the <link linkend="webclient.intro.menubar">menu</link> to 1325 open a page listing items. Most list pages can only 1326 list one type of items. For example: use the 1327 <menuchoice><guimenu>View</guimenu><guimenuitem>Samples</guimenuitem></menuchoice> 1328 menu to list samples and the 1329 <menuchoice><guimenu>View</guimenu><guimenuitem>Experiments</guimenuitem></menuchoice> 1330 menu to list experiments. 1326 Use the menu to open a page listing items. Most list pages can only list one type of 1327 items. For example: use the 1328 <menuchoice> 1329 <guimenu>View</guimenu> 1330 <guimenuitem>Samples</guimenuitem> 1331 </menuchoice> 1332 menu to list samples and the 1333 <menuchoice> 1334 <guimenu>View</guimenu> 1335 <guimenuitem>Experiments</guimenuitem> 1336 </menuchoice> 1337 menu to list experiments. 1331 1338 </para> 1332 1339 1333 1340 <tip> 1334 1341 An example of a list page that can list … … 1680 1687 <listitem> 1681 1688 <para><guilabel>Other…</guilabel> - 1682 Open the <link linkend="webclient.itemlist.columns">configure columns dialog box</link>.</para> 1689 Open the configure columns dialog box, described in 1690 <xref linkend="webclient.itemlist.columns"/>.</para> 1683 1691 </listitem> 1684 1692 </itemizedlist> -
branches/filedb/src/core/net/sf/basedb/core/Install.java
r3793 r3796 107 107 method. 108 108 */ 109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(4 2).intValue();109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(43).intValue(); 110 110 111 111 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
branches/filedb/src/core/net/sf/basedb/core/InvalidPathException.java
r3679 r3796 43 43 public InvalidPathException(String path) 44 44 { 45 super( "Invalid path: " +path);45 super(path); 46 46 } 47 47 -
branches/filedb/src/core/net/sf/basedb/core/ItemContext.java
r3679 r3796 898 898 // Tempoarary storage for all associations that must be left joined 899 899 Set<String> leftJoins = autoLeftJoin ? new HashSet<String>() : null; 900 Set<String> sortedProperties = autoLeftJoin ? new HashSet<String>() : null; 900 901 901 902 // Add sort order information … … 930 931 if (dotIndex >= 0) 931 932 { 932 leftJoins.add(sortProperty.substring(0, dotIndex)); 933 String toJoin = sortProperty.substring(0, dotIndex); 934 leftJoins.add(toJoin); 935 sortedProperties.add(toJoin); 933 936 } 934 937 } … … 995 998 { 996 999 int i = 0; 1000 // Use fetch joins for columns appearing in the ORDER BY clause 1001 // if the query is distinct and the database requires it 1002 boolean selectOrderBy = query.isDistinct() && 1003 HibernateUtil.getDbEngine().selectOrderByColumnsIfDistinct(); 997 1004 for (String property : leftJoins) 998 1005 { 1006 boolean fetch = selectOrderBy && sortedProperties.contains(property); 999 1007 if (property.startsWith("@")) property = property.substring(1); 1000 1008 i++; 1001 query.join(Hql.leftJoin( property, "alj"+i));1009 query.join(Hql.leftJoin(null, property, "alj"+i, null, fetch)); 1002 1010 } 1003 1011 } -
branches/filedb/src/core/net/sf/basedb/core/Job.java
r3719 r3796 997 997 throws InvalidDataException, PermissionDeniedException, BaseException 998 998 { 999 checkPermission(Permission.WRITE); 1000 if (name == null) throw new InvalidUseOfNullException("name"); 999 1001 if (getStatus() == Status.EXECUTING) 1000 1002 { … … 1002 1004 } 1003 1005 getData().setStatus(Status.WAITING.getValue()); 1004 setParameterValuesInternal(name, label, description, parameterType, Arrays.asList(value) );1006 setParameterValuesInternal(name, label, description, parameterType, Arrays.asList(value), true); 1005 1007 } 1006 1008 … … 1046 1048 throws InvalidDataException, PermissionDeniedException, BaseException 1047 1049 { 1050 checkPermission(Permission.WRITE); 1051 if (name == null) throw new InvalidUseOfNullException("name"); 1048 1052 if (getStatus() == Status.EXECUTING) 1049 1053 { … … 1051 1055 } 1052 1056 getData().setStatus(Status.WAITING.getValue()); 1053 setParameterValuesInternal(name, label, description, parameterType, values );1057 setParameterValuesInternal(name, label, description, parameterType, values, true); 1054 1058 } 1055 1059 … … 1111 1115 @param values A list containing the new values, null or empty to remove the 1112 1116 configuration values 1117 @param validate If validation by {@link ParameterType#validate(String, List)} 1118 is needed or not 1113 1119 @throws PermissionDeniedException If the logged in user doesn't have 1114 1120 write permission … … 1117 1123 @throws BaseException If there is another error 1118 1124 */ 1119 void setParameterValuesInternal(String name, String label, String description, ParameterType<?> parameterType, List<?> values) 1125 void setParameterValuesInternal(String name, String label, String description, 1126 ParameterType<?> parameterType, List<?> values, boolean validate) 1120 1127 throws InvalidDataException, PermissionDeniedException, BaseException 1121 1128 { 1122 checkPermission(Permission.WRITE);1123 if (name == null) throw new InvalidUseOfNullException("name");1124 1129 ParameterValueData old = null; 1125 1130 if (values == null || values.size() == 0) … … 1130 1135 { 1131 1136 if (parameterType == null) throw new InvalidUseOfNullException("parameterType"); 1132 parameterType.validate(name, values);1137 if (validate) parameterType.validate(name, values); 1133 1138 ParameterValueData<?> parameterValue = parameterType.newParameterValueData(); 1134 1139 parameterValue.setLabel(label); -
branches/filedb/src/core/net/sf/basedb/core/ParameterType.java
r3679 r3796 218 218 if (!items.contains(value)) 219 219 { 220 throw new InvalidDataException("The value '" + value + "' isn't in the list of allowed values .");220 throw new InvalidDataException("The value '" + value + "' isn't in the list of allowed values for parameter '" + name + "'."); 221 221 } 222 222 } -
branches/filedb/src/core/net/sf/basedb/core/ParameterValuesImpl.java
r3679 r3796 161 161 if (writeProtected) 162 162 { 163 throw new PermissionDeniedException(Permission.WRITE, "Job parameter: "+name); 164 } 163 throw new PermissionDeniedException(Permission.WRITE, "Parameter: "+name); 164 } 165 if (name == null) throw new InvalidUseOfNullException("name"); 166 if (type == null) throw new InvalidUseOfNullException("type[name=" + name + "]"); 165 167 if (value == null && type.getNotNull()) value = type.getDefaultValue(); 168 type.validate(name, value); 166 169 List<T> l = new ArrayList<T>(1); 167 170 l.add(value); … … 176 179 if (writeProtected) 177 180 { 178 throw new PermissionDeniedException(Permission.WRITE, "Job parameter: "+name); 179 } 181 throw new PermissionDeniedException(Permission.WRITE, "Parameter: "+name); 182 } 183 if (name == null) throw new InvalidUseOfNullException("name"); 184 if (type == null) throw new InvalidUseOfNullException("type[name=" + name + "]"); 180 185 if ((values == null || values.size() == 0) && type.getNotNull() && type.getDefaultValue() != null) 181 186 { 182 187 values = Arrays.asList(type.getDefaultValue()); 183 188 } 189 type.validate(name, values); 184 190 parameters.put(name, values); 185 191 parameterTypes.put(name, type); … … 203 209 if (pp == null) 204 210 { 205 job.setParameterValuesInternal(name, null, null, parameterTypes.get(name), parameters.get(name)); 211 job.setParameterValuesInternal(name, null, null, 212 parameterTypes.get(name), parameters.get(name), false); 206 213 } 207 214 else 208 215 { 209 job.setParameterValuesInternal(name, pp.getLabel(), pp.getDescription(), parameterTypes.get(name), parameters.get(name)); 216 job.setParameterValuesInternal(name, pp.getLabel(), pp.getDescription(), 217 parameterTypes.get(name), parameters.get(name), false); 210 218 } 211 219 } … … 223 231 if (pp == null) 224 232 { 225 config.setParameterValues(name, null, null, parameterTypes.get(name), parameters.get(name)); 233 config.setParameterValuesInternal(name, null, null, 234 parameterTypes.get(name), parameters.get(name), false); 226 235 } 227 236 else 228 237 { 229 config.setParameterValues(name, pp.getLabel(), pp.getDescription(), parameterTypes.get(name), parameters.get(name)); 238 config.setParameterValuesInternal(name, pp.getLabel(), pp.getDescription(), 239 parameterTypes.get(name), parameters.get(name), false); 230 240 } 231 241 } -
branches/filedb/src/core/net/sf/basedb/core/Path.java
r3679 r3796 143 143 } 144 144 filename = parts[parts.length-1]; 145 if (!Path.isValidName(filename)) 146 { 147 throw new InvalidPathException("Path contains invalid characters ("+Path.INVALID_CHARACTERS+"): "+path); 148 } 145 149 parts[parts.length-1] = ""; 146 150 } -
branches/filedb/src/core/net/sf/basedb/core/PathParameterType.java
r3675 r3796 87 87 Checks if the value is a valif {@link Path} value. 88 88 @param value The value to test 89 @throws InvalidDataException If the value is not a string or too long89 @throws InvalidDataException If the value is not a valid path 90 90 */ 91 91 void validateValue(String name, String value) 92 92 throws InvalidDataException 93 93 { 94 new Path(value, pathType); 94 try 95 { 96 new Path(value, pathType); 97 } 98 catch (InvalidPathException ex) 99 { 100 throw new InvalidPathException("Path for parameter '"+ name + "' is invalid: " + ex.getMessage()); 101 } 95 102 } 96 103 /** -
branches/filedb/src/core/net/sf/basedb/core/PluginConfiguration.java
r3783 r3796 428 428 checkPermission(Permission.WRITE); 429 429 if (name == null) throw new InvalidUseOfNullException("name"); 430 430 setParameterValuesInternal(name, label, description, parameterType, values, true); 431 } 432 433 /** 434 Set the values of a configuration parameter. 435 @param name The name of the configuration parameter 436 @param label The label of the parameter (optional) 437 @param description A description of the parameter (optional) 438 @param parameterType The type of the parameter 439 @param values A list containing the new values, null or empty to remove the 440 configuration values 441 @param validate If validation by {@link ParameterType#validate(String, List)} 442 is needed or not 443 @throws PermissionDeniedException If the logged in user doesn't have 444 write permission 445 @throws InvalidDataException If name is null or the new value doesn't 446 validate against the parameter type 447 @throws BaseException If there is another error 448 */ 449 void setParameterValuesInternal(String name, String label, String description, 450 ParameterType<?> parameterType, List<?> values, boolean validate) 451 throws InvalidDataException, PermissionDeniedException, BaseException 452 { 453 431 454 VersionedParameter param = new VersionedParameter(name, getNewParameterVersion()); 432 433 455 if (values == null || values.size() == 0) 434 456 { … … 438 460 { 439 461 if (parameterType == null) throw new InvalidUseOfNullException("parameterType"); 440 parameterType.validate(name, values);462 if (validate) parameterType.validate(name, values); 441 463 ParameterValueData<?> parameterValue = parameterType.newParameterValueData(); 442 464 parameterValue.setLabel(label); … … 446 468 } 447 469 } 448 470 449 471 /** 450 472 Copy all parameter values from another plugin configuration. This method -
branches/filedb/src/core/net/sf/basedb/core/Update.java
r3741 r3796 474 474 <td>40</td> 475 475 <td> 476 Change invalid property filter on 'guiContexts.itemType' to 477 '$ctx.itemType'. 476 Used to "Change invalid property filter on 'guiContexts.itemType' to 477 '$ctx.itemType'", but since the source problem never was fixed this is now 478 done in 43. 478 479 </td> 479 480 </tr> … … 499 500 The update will query the database or check the CDF file to get 500 501 the information. 502 </td> 503 </tr> 504 505 <tr> 506 <td>43</td> 507 <td> 508 Change invalid property filter on 'guiContexts.itemType' to 509 '$ctx.itemType'". Was originally fixed by 40, but since the source 510 problem never was fixed it must be done again. 501 511 </td> 502 512 </tr> … … 697 707 schemaVersion = updateToSchemaVersion39(session); 698 708 } 699 700 if (schemaVersion < 40) 701 { 702 if (progress != null) progress.display((int)(39*progress_factor), "--Updating schema version: " + schemaVersion + " -> 40..."); 703 schemaVersion = updateToSchemaVersion40(session); 704 } 705 709 706 710 if (schemaVersion < 41) 707 711 { … … 714 718 if (progress != null) progress.display((int)(41*progress_factor), "--Updating schema version: " + schemaVersion + " -> 42..."); 715 719 schemaVersion = updateToSchemaVersion42(session); 720 } 721 722 if (schemaVersion < 43) 723 { 724 if (progress != null) progress.display((int)(42*progress_factor), "--Updating schema version: " + schemaVersion + " -> 43..."); 725 schemaVersion = updateToSchemaVersion43(session); 716 726 } 717 727 … … 1589 1599 if (tx != null) HibernateUtil.rollback(tx); 1590 1600 log.error("updateToSchemaVersion39: FAILED", ex); 1591 throw ex;1592 }1593 return schemaVersion;1594 }1595 1596 /**1597 Update property filter on 'guiContexts.itemType' to '$ctx.itemType'1598 @return The new schema version (=40)1599 */1600 private static int updateToSchemaVersion40(org.hibernate.Session session)1601 {1602 final int schemaVersion = 40;1603 org.hibernate.Transaction tx = null;1604 try1605 {1606 tx = HibernateUtil.newTransaction(session);1607 1608 // Change property values1609 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session,1610 "UPDATE_PROPERTY_FILTER");1611 /*1612 UPDATE PropertyFilters pf1613 SET pf.property = :newProperty1614 WHERE pf.property = :oldProperty1615 */1616 query.setString("oldProperty", "guiContexts.itemType");1617 query.setString("newProperty", "$ctx.itemType");1618 HibernateUtil.executeUpdate(query);1619 1620 // Update the schema version number1621 setSchemaVersion(session, schemaVersion);1622 1623 // Commit the changes1624 HibernateUtil.commit(tx);1625 log.info("updateToSchemaVersion40: OK");1626 }1627 catch (BaseException ex)1628 {1629 if (tx != null) HibernateUtil.rollback(tx);1630 log.error("updateToSchemaVersion40: FAILED", ex);1631 1601 throw ex; 1632 1602 } … … 1718 1688 } 1719 1689 1720 1690 /** 1691 Update property filter on 'guiContexts.itemType' to '$ctx.itemType' 1692 @return The new schema version (=43) 1693 */ 1694 private static int updateToSchemaVersion43(org.hibernate.Session session) 1695 { 1696 final int schemaVersion = 43; 1697 org.hibernate.Transaction tx = null; 1698 try 1699 { 1700 tx = HibernateUtil.newTransaction(session); 1701 1702 // Change property values 1703 org.hibernate.Query query = HibernateUtil.getPredefinedSQLQuery(session, 1704 "UPDATE_PROPERTY_FILTER"); 1705 /* 1706 UPDATE PropertyFilters pf 1707 SET pf.property = :newProperty 1708 WHERE pf.property = :oldProperty 1709 */ 1710 query.setString("oldProperty", "guiContexts.itemType"); 1711 query.setString("newProperty", "$ctx.itemType"); 1712 HibernateUtil.executeUpdate(query); 1713 1714 // Update the schema version number 1715 setSchemaVersion(session, schemaVersion); 1716 1717 // Commit the changes 1718 HibernateUtil.commit(tx); 1719 log.info("updateToSchemaVersion40: OK"); 1720 } 1721 catch (BaseException ex) 1722 { 1723 if (tx != null) HibernateUtil.rollback(tx); 1724 log.error("updateToSchemaVersion40: FAILED", ex); 1725 throw ex; 1726 } 1727 return schemaVersion; 1728 } 1729 1721 1730 /** 1722 1731 Adjust the existing items in the database to be compatible with the latest mappings. -
branches/filedb/src/core/net/sf/basedb/util/overview/ExperimentOverview.java
r3675 r3796 283 283 284 284 // Load 'Required for MIAME' annotation types (parameter='false' must also be set) 285 ItemQuery<AnnotationType> query = initQuery(AnnotationType.getQuery(null), "name");285 ItemQuery<AnnotationType> query = initQuery(AnnotationType.getQuery(null), null, "name"); 286 286 query.restrict( 287 287 Restrictions.eq( … … 556 556 Node efNode = new Node("experimental.factors", "Experimental factors", rootNode); 557 557 Experiment experiment = (Experiment)rootNode.getItem(); 558 ItemQuery<AnnotationType> efQuery = initQuery(experiment.getExperimentalFactors(), "name");558 ItemQuery<AnnotationType> efQuery = initQuery(experiment.getExperimentalFactors(), null, "name"); 559 559 for (AnnotationType ef : efQuery.list(dc)) 560 560 { … … 574 574 Node rawBioAssaysNode = new Node("rawbioassays", "Raw bioassays", rootNode); 575 575 Experiment experiment = (Experiment)rootNode.getItem(); 576 ItemQuery<RawBioAssay> rbaQuery = initQuery(experiment.getRawBioAssays(), "name");576 ItemQuery<RawBioAssay> rbaQuery = initQuery(experiment.getRawBioAssays(), null, "name"); 577 577 Set<BasicItem> arrayDesigns = new HashSet<BasicItem>(); 578 578 for (RawBioAssay rba : rbaQuery.list(dc)) … … 801 801 Node imagesNode = new Node("images", "Images", scanNode); 802 802 Scan scan = (Scan)scanNode.getItem(); 803 ItemQuery<Image> imageQuery = initQuery(scan.getImages(), "name");803 ItemQuery<Image> imageQuery = initQuery(scan.getImages(), null, "name"); 804 804 for (Image image : imageQuery.list(dc)) 805 805 { … … 831 831 Hybridization hyb = (Hybridization)hybNode.getItem(); 832 832 ItemQuery<LabeledExtract> leQuery = 833 (ItemQuery<LabeledExtract>)initQuery(hyb.getCreationEvent().getSources(), "label.name");833 (ItemQuery<LabeledExtract>)initQuery(hyb.getCreationEvent().getSources(), null, "label.name"); 834 834 int added = 0; 835 835 int channels = experiment.getRawDataType().getChannels(); … … 935 935 936 936 ItemQuery<LabeledExtract> sourceQuery = 937 initQuery((ItemQuery<LabeledExtract>)product.getCreationEvent().getSources(), "name");937 initQuery((ItemQuery<LabeledExtract>)product.getCreationEvent().getSources(), null, "name"); 938 938 939 939 int added = 0; … … 1058 1058 1059 1059 ItemQuery<Extract> sourceQuery = 1060 initQuery((ItemQuery<Extract>)product.getCreationEvent().getSources(), "name");1060 initQuery((ItemQuery<Extract>)product.getCreationEvent().getSources(), null, "name"); 1061 1061 1062 1062 int added = 0; … … 1162 1162 1163 1163 ItemQuery<Sample> sourceQuery = 1164 initQuery((ItemQuery<Sample>)product.getCreationEvent().getSources(), "name");1164 initQuery((ItemQuery<Sample>)product.getCreationEvent().getSources(), null, "name"); 1165 1165 1166 1166 int added = 0; … … 1534 1534 AnnotationSet as = annotatable != null && annotatable.isAnnotated() ? 1535 1535 annotatable.getAnnotationSet() : null; 1536 ItemQuery<AnnotationType> parameterQuery = initQuery(protocol.getParameters(), "name");1536 ItemQuery<AnnotationType> parameterQuery = initQuery(protocol.getParameters(), null, "name"); 1537 1537 List<AnnotationType> parameters = parameterQuery.list(dc); 1538 1538 Node parameterNode = null; … … 1582 1582 annotationsNode = new Node("annotations", "Annotations", parentNode); 1583 1583 AnnotationSet as = parent.getAnnotationSet(); 1584 ItemQuery<Annotation> annotationQuery = initQuery(as.getAnnotations(), "annotationType.name");1584 ItemQuery<Annotation> annotationQuery = initQuery(as.getAnnotations(), null, "annotationType.name"); 1585 1585 1586 1586 for (Annotation a : annotationQuery.list(dc)) … … 1662 1662 annotationTypes.clear(); 1663 1663 AnnotationSet as = parent.getAnnotationSet(); 1664 ItemQuery<Annotation> annotationQuery = initQuery(as.getAllInheritedAnnotations(), "annotationType.name"); 1664 ItemQuery<Annotation> annotationQuery = initQuery(as.getAllInheritedAnnotations(), "at", "name"); 1665 annotationQuery.join(Hql.innerJoin(null, "annotationType", "at", true)); 1665 1666 List<Annotation> inherited = annotationQuery.list(dc); 1666 1667 if (inherited.size() > 0) … … 1727 1728 Set include options and sorting order for a query. 1728 1729 */ 1729 private <T extends BasicItem> ItemQuery<T> initQuery(ItemQuery<T> query, String sort Property)1730 private <T extends BasicItem> ItemQuery<T> initQuery(ItemQuery<T> query, String sortAlias, String sortProperty) 1730 1731 { 1731 1732 query.include(Include.MINE, Include.IN_PROJECT, Include.SHARED, Include.OTHERS); 1732 query.order(Orders.asc(Hql.property(sort Property)));1733 query.order(Orders.asc(Hql.property(sortAlias, sortProperty))); 1733 1734 return query; 1734 1735 } -
branches/filedb/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java
r3783 r3796 1377 1377 if (bas == null) 1378 1378 { 1379 bas = t.newProduct( null, "new", false);1379 bas = t.newProduct("new", "new", false); 1380 1380 } 1381 1381 spotBatcher = bas.getSpotBatcher(); -
branches/filedb/src/plugins/core/net/sf/basedb/plugins/PackedFileExporter.java
r3675 r3796 376 376 // Prepare for compression 377 377 String rootPath = rootDir.getPath().toString(); 378 if (!rootPath.endsWith("/")) rootPath += "/"; 378 379 out.setMimeType(packer.getMimeType()); 379 380 out.setFilename(generateDefaultName(packer, rootDir, itemsToPack)); … … 405 406 406 407 // Remove rootPath from entryPath 407 entryPath = entryPath.substring(rootPath.length() +1);408 entryPath = entryPath.substring(rootPath.length()); 408 409 409 410 // Update progress … … 657 658 private String generateDefaultPath(FilePacker packer, Directory rootDir, Collection<Nameable> selectedItems) 658 659 { 659 String defaultPath = rootDir == null ? "~/" : rootDir.getPath().toString() + "/"; 660 String defaultPath = rootDir == null ? "~/" : rootDir.getPath().toString(); 661 if (!defaultPath.endsWith("/")) defaultPath += "/"; 660 662 defaultPath += generateDefaultName(packer, rootDir, selectedItems); 661 663 return defaultPath; -
branches/filedb/src/test/TestAnnotation.java
r3783 r3796 26 26 27 27 import net.sf.basedb.core.*; 28 import net.sf.basedb.core.query.Hql; 29 import net.sf.basedb.core.query.Orders; 28 30 29 31 import java.util.Date; … … 81 83 // Test: list inherited annotations and annotation sets 82 84 test_list_inherited_annotations(rawBioAssayId, 2); 85 test_list_allinherited_annotations(rawBioAssayId, 9); 83 86 test_list_inherited_annotationsets(rawBioAssayId, 1); 84 87 test_list_inheriting_annotationsets(arrayDesignId, 1); … … 342 345 } 343 346 } 347 348 static void test_list_allinherited_annotations(int rawBioAssayId, int expectedResults) 349 { 350 if (rawBioAssayId == 0) return; 351 DbControl dc = null; 352 try 353 { 354 dc = TestUtil.getDbControl(); 355 RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId); 356 ItemQuery<Annotation> query = rba.getAnnotationSet().getAllInheritedAnnotations(); 357 query.join(Hql.innerJoin(null, "annotationType", "at", true)); 358 query.order(Orders.asc(Hql.property("at", "name"))); 359 List<Annotation> l = query.list(dc); 360 for (int i = 0; i<l.size(); i++) 361 { 362 write_item(i, l.get(i)); 363 } 364 if (expectedResults >= 0 && expectedResults != l.size()) 365 { 366 throw new BaseException("Expected "+expectedResults+" results, not "+l.size()); 367 } 368 write("--List all inherited annotations OK ("+l.size()+")"); 369 } 370 catch (Throwable ex) 371 { 372 write("--List all inherited annotations FAILED"); 373 ex.printStackTrace(); 374 ok = false; 375 } 376 finally 377 { 378 if (dc != null) dc.close(); 379 } 380 } 344 381 345 382 static void test_list_inherited_annotationsets(int rawBioAssayId, int expectedResults) -
branches/filedb/src/test/TestPath.java
r3679 r3796 42 42 { 43 43 write("++Testing path"); 44 test_create("/filename", Path.Type.FILE );45 test_create("/directory/filename", Path.Type.FILE );46 test_create("/directory/subdirectory/filename", Path.Type.FILE );47 test_create("~userlogin/filename", Path.Type.FILE );48 test_create("~userlogin/directory/filename", Path.Type.FILE );49 test_create("~userlogin/directory/subdirectory/filename", Path.Type.FILE );50 test_create("~/filename", Path.Type.FILE );51 test_create("~/directory/filename", Path.Type.FILE );52 test_create("~/directory/subdirectory/filename", Path.Type.FILE );44 test_create("/filename", Path.Type.FILE, false); 45 test_create("/directory/filename", Path.Type.FILE, false); 46 test_create("/directory/subdirectory/filename", Path.Type.FILE, false); 47 test_create("~userlogin/filename", Path.Type.FILE, false); 48 test_create("~userlogin/directory/filename", Path.Type.FILE, false); 49 test_create("~userlogin/directory/subdirectory/filename", Path.Type.FILE, false); 50 test_create("~/filename", Path.Type.FILE, false); 51 test_create("~/directory/filename", Path.Type.FILE, false); 52 test_create("~/directory/subdirectory/filename", Path.Type.FILE, false); 53 53 54 test_create("/", Path.Type.DIRECTORY );55 test_create("/directory", Path.Type.DIRECTORY );56 test_create("/directory/subdirectory", Path.Type.DIRECTORY );57 test_create("/directory/subdirectory/subsub", Path.Type.DIRECTORY );58 test_create("~userlogin", Path.Type.DIRECTORY );59 test_create("~userlogin/directory", Path.Type.DIRECTORY );60 test_create("~userlogin/directory/subdirectory", Path.Type.DIRECTORY );61 test_create("~userlogin/directory/subdirectory/subsub", Path.Type.DIRECTORY );62 test_create("~", Path.Type.DIRECTORY );63 test_create("~/directory", Path.Type.DIRECTORY );64 test_create("~/directory/subdirectory", Path.Type.DIRECTORY );65 test_create("~/directory/subdirectory/subsub", Path.Type.DIRECTORY );54 test_create("/", Path.Type.DIRECTORY, false); 55 test_create("/directory", Path.Type.DIRECTORY, false); 56 test_create("/directory/subdirectory", Path.Type.DIRECTORY, false); 57 test_create("/directory/subdirectory/subsub", Path.Type.DIRECTORY, false); 58 test_create("~userlogin", Path.Type.DIRECTORY, false); 59 test_create("~userlogin/directory", Path.Type.DIRECTORY, false); 60 test_create("~userlogin/directory/subdirectory", Path.Type.DIRECTORY, false); 61 test_create("~userlogin/directory/subdirectory/subsub", Path.Type.DIRECTORY, false); 62 test_create("~", Path.Type.DIRECTORY, false); 63 test_create("~/directory", Path.Type.DIRECTORY, false); 64 test_create("~/directory/subdirectory", Path.Type.DIRECTORY, false); 65 test_create("~/directory/subdirectory/subsub", Path.Type.DIRECTORY, false); 66 66 67 67 test_valid_name("abc", true); … … 77 77 test_valid_name("|abc", false); 78 78 79 test_create("/file<name>", Path.Type.FILE, true); 80 test_create("/dire<ctory>/filename", Path.Type.FILE, true); 81 test_create("/directory/file<name>", Path.Type.FILE, true); 82 test_create("/sub<dir>", Path.Type.DIRECTORY, true); 83 test_create("/directory/sub<dir>", Path.Type.DIRECTORY, true); 84 79 85 test_replace_invalid("abc", ".", "abc"); 80 86 test_replace_invalid("~abc", ".", ".abc"); … … 85 91 } 86 92 87 static void test_create(String path, Path.Type type )93 static void test_create(String path, Path.Type type, boolean shouldFail) 88 94 { 89 95 try … … 95 101 throw new Exception("Original path ("+path+") is different from path: "+pp); 96 102 } 97 write("--Path " + p.getType() + ": '"+p+"' OK"); 103 if (shouldFail) 104 { 105 write("--Path '"+path+"' FAILED"); 106 new Throwable("Expected test to fail but it didn't.").printStackTrace(); 107 ok = false; 108 } 109 else 110 { 111 write("--Path " + p.getType() + ": '"+p+"' OK"); 112 } 98 113 } 99 114 catch (Throwable ex) 100 115 { 101 write("--Path '"+path+"' FAILED"); 102 ex.printStackTrace(); 103 ok = false; 116 if (!shouldFail) 117 { 118 write("--Path '"+path+"' FAILED"); 119 ex.printStackTrace(); 120 ok = false; 121 } 122 else 123 { 124 write("--Path " + type + ": '"+path+"' OK"); 125 } 104 126 } 105 127 } -
branches/filedb/www/common/annotations/list_annotations.jsp
r3679 r3796 83 83 { 84 84 ItemQuery<Annotation> inheritedQuery = as.getAllInheritedAnnotations(); 85 // Need FETCH JOIN because Postgres don't like the DISTINCT keyword 86 // if we sort on a non-selected column See ticket #731 87 inheritedQuery.join(Hql.innerJoin(null, "annotationType", "at", true)); 85 88 inheritedQuery.order(Orders.asc(Hql.property("annotationSet"))); 86 inheritedQuery.order(Orders.asc(Hql.property("a nnotationType.name")));89 inheritedQuery.order(Orders.asc(Hql.property("at", "name"))); 87 90 inheritedAnnotations = inheritedQuery.list(dc); 88 91 } -
branches/filedb/www/views/reporters/index.jsp
r3679 r3796 41 41 import="net.sf.basedb.core.DataQuery" 42 42 import="net.sf.basedb.core.PermissionDeniedException" 43 import="net.sf.basedb.core.BaseException" 43 44 import="net.sf.basedb.util.RemovableUtil" 44 45 import="net.sf.basedb.util.ShareableUtil" … … 175 176 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 176 177 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 177 batcher.delete(cc.getId()); 178 batcher.close(); 179 dc.commit(); 180 redirect = listPage; 178 try 179 { 180 batcher.delete(cc.getId()); 181 batcher.close(); 182 dc.commit(); 183 redirect = listPage; 184 } 185 catch (BaseException bex) 186 { 187 message = "The reporter can not be deleted. " + 188 "Probably because it is used by other items"; 189 redirect = viewPage + "&popmessage="+HTML.urlEncode(message); 190 } 181 191 } 182 192 else if ("DeleteItems".equals(cmd)) … … 186 196 ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, pageContext, defaultContext); 187 197 ReporterBatcher batcher = ReporterBatcher.getNew(dc); 198 batcher.setBatchSize(1); 199 int notDeleted = 0; 188 200 for (int reporterId : cc.getSelected()) 189 201 { 190 batcher.delete(reporterId); 191 } 192 batcher.close(); 202 try 203 { 204 batcher.delete(reporterId); 205 } 206 catch (BaseException bex) 207 { 208 notDeleted++; 209 } 210 } 193 211 dc.commit(); 194 redirect = listPage; 212 message = notDeleted > 0 ? notDeleted + " reporters can not be deleted. " + 213 "Probably because they are used by other items" : null; 214 redirect = listPage+(message != null ? "&popmessage="+HTML.urlEncode(message) : ""); 195 215 } 196 216 else if ("ExportItems".equals(cmd))
Note: See TracChangeset
for help on using the changeset viewer.