Changeset 4527
- Timestamp:
- Sep 16, 2008, 12:58:42 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/AnyToAny.java
r4517 r4527 126 126 if (from == null) throw new InvalidUseOfNullException("from"); 127 127 if (name == null) throw new InvalidUseOfNullException("name"); 128 AnyToAny ata = dc.getItem(AnyToAny.class, 129 getDataByName(dc.getHibernateSession(), from.getId(), from.getType(), name)); 130 if (ata == null) throw new ItemNotFoundException("AnyToAny[name="+name+"]"); 131 return ata; 132 } 133 134 /** 135 Get an any-to-any link. 136 @param session An open Hibernate session 137 @param fromId The id of the source item 138 @param fromType The type of the source item 139 @param name The name of the link 140 @return The linked item, or null if no link is found 141 @since 2.9 142 */ 143 static AnyToAnyData getDataByName(org.hibernate.Session session, int fromId, Item fromType, String name) 144 { 128 145 name = name.trim(); 129 org.hibernate.Query query = HibernateUtil.getPredefinedQuery( dc.getHibernateSession(),146 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 130 147 "GET_ANYTOANY_FOR_NAME"); 131 148 /* … … 134 151 WHERE ata.fromId = :fromId AND ata.fromType = :fromType AND ata.name = :name 135 152 */ 136 query.setInteger("fromId", from .getId());137 query.setInteger("fromType", from .getType().getValue());153 query.setInteger("fromId", fromId); 154 query.setInteger("fromType", fromType.getValue()); 138 155 query.setString("name", name); 139 AnyToAny ata = dc.getItem(AnyToAny.class, HibernateUtil.loadData(AnyToAnyData.class, query)); 140 if (ata == null) throw new ItemNotFoundException("AnyToAny[name="+name+"]"); 141 return ata; 156 AnyToAnyData ata = HibernateUtil.loadData(AnyToAnyData.class, query); 157 return ata; 142 158 } 143 159 -
trunk/src/core/net/sf/basedb/core/ArrayBatch.java
r4517 r4527 24 24 25 25 import net.sf.basedb.core.data.ArrayBatchData; 26 import net.sf.basedb.core.data.HardwareData; 27 import net.sf.basedb.core.data.ProtocolData; 26 28 import net.sf.basedb.core.query.Hql; 27 29 import net.sf.basedb.core.query.Restrictions; … … 175 177 return using; 176 178 } 179 /** 180 Set print robot and protocol from project default settings. 181 @since 2.9 182 */ 183 @Override 184 void setProjectDefaults(Project activeProject) 185 throws BaseException 186 { 187 super.setProjectDefaults(activeProject); 188 if (!robotHasBeenSet) 189 { 190 HardwareData robot = 191 (HardwareData)activeProject.getDefaultData(getDbControl(), 192 Project.Default.PRINTROBOT_HARDWARE); 193 if (robot != null) getData().setPrintRobot(robot); 194 robotHasBeenSet = true; 195 } 196 if (!protocolHasBeenSet) 197 { 198 ProtocolData protocol = 199 (ProtocolData)activeProject.getDefaultData(getDbControl(), 200 Project.Default.PRINTING_PROTOCOL); 201 if (protocol != null) getData().setProtocol(protocol); 202 protocolHasBeenSet = true; 203 } 204 } 177 205 // ------------------------------------------- 178 206 … … 221 249 } 222 250 251 private boolean protocolHasBeenSet = false; 223 252 /** 224 253 Set the {@link Protocol} used for printing the arrays. … … 235 264 checkPermission(Permission.WRITE); 236 265 if (protocol != null) protocol.checkPermission(Permission.USE); 266 protocolHasBeenSet = true; 237 267 getData().setProtocol(protocol == null ? null : protocol.getData()); 238 268 } … … 252 282 return getDbControl().getItem(Hardware.class, getData().getPrintRobot()); 253 283 } 284 private boolean robotHasBeenSet = false; 254 285 /** 255 286 Set the {@link Hardware print robot} used for this array batch. … … 266 297 checkPermission(Permission.WRITE); 267 298 if (printRobot != null) printRobot.checkPermission(Permission.USE); 299 robotHasBeenSet = true; 268 300 getData().setPrintRobot(printRobot == null ? null : printRobot.getData()); 269 301 } -
trunk/src/core/net/sf/basedb/core/BasicItem.java
r4517 r4527 438 438 439 439 /** 440 This method is called before inserting new items into the database 441 to allow items to propagate default values from the active project. 442 This method is only called when a project is active. 443 <p> 444 Implementation note! Subclasses should only set default values 445 for properties that hasn't been set explicitly by client code, 446 also accounting for setAbc(null) calls. 447 448 @param activeProject The currently active project 449 @throws BaseException 450 @since 2.9 451 */ 452 void setProjectDefaults(Project activeProject) 453 throws BaseException 454 {} 455 456 /** 440 457 This method is called on all items directly after Hibernate has inserted 441 458 it into the database. This method can be used in place of the -
trunk/src/core/net/sf/basedb/core/BioMaterialEvent.java
r4517 r4527 27 27 28 28 import net.sf.basedb.core.data.BioMaterialEventData; 29 import net.sf.basedb.core.data.HardwareData; 29 30 import net.sf.basedb.core.data.MeasuredBioMaterialData; 31 import net.sf.basedb.core.data.ProtocolData; 30 32 import net.sf.basedb.core.data.UserData; 31 33 import net.sf.basedb.core.data.UsedQuantity; … … 250 252 super.initPermissions(granted, denied); 251 253 } 254 /** 255 Set protocol and hardware from project default settings. 256 @since 2.9 257 */ 258 @Override 259 void setProjectDefaults(Project activeProject) 260 throws BaseException 261 { 262 super.setProjectDefaults(activeProject); 263 if (getEventType() == Type.OTHER) return; 264 265 Project.Default defaultProtocolType = null; 266 Project.Default defaultHardwareType = null; 267 268 if (getEventType() == Type.HYBRIDIZATION) 269 { 270 defaultProtocolType = Project.Default.HYBRIDIZATION_PROTOCOL; 271 defaultHardwareType = Project.Default.HYBRIDIZATION_HARDWARE; 272 } 273 else 274 { 275 MeasuredBioMaterial parent = getBioMaterial(); 276 Item parentType = parent.getType(); 277 if (parent.isPooled()) 278 { 279 defaultProtocolType = Project.Default.POOLING_PROTOCOL; 280 } 281 else if (parentType == Item.SAMPLE) 282 { 283 defaultProtocolType = Project.Default.SAMPLING_PROTOCOL; 284 } 285 else if (parentType == Item.EXTRACT) 286 { 287 defaultProtocolType = Project.Default.EXTRACTING_PROTOCOL; 288 } 289 else if (parentType == Item.LABELEDEXTRACT) 290 { 291 defaultProtocolType = Project.Default.LABELING_PROTOCOL; 292 } 293 } 294 295 if (!protocolHasBeenSet && defaultProtocolType != null) 296 { 297 ProtocolData protocol = 298 (ProtocolData)activeProject.getDefaultData(getDbControl(), 299 defaultProtocolType); 300 if (protocol != null) getData().setProtocol(protocol); 301 protocolHasBeenSet = true; 302 } 303 if (!hardwareHasBeenSet && defaultHardwareType != null) 304 { 305 HardwareData hardware = 306 (HardwareData)activeProject.getDefaultData(getDbControl(), 307 defaultHardwareType); 308 if (hardware != null) getData().setHardware(hardware); 309 hardwareHasBeenSet = true; 310 } 311 } 252 312 // ------------------------------------------- 253 313 /* … … 365 425 } 366 426 427 private boolean protocolHasBeenSet = false; 367 428 /** 368 429 Set the {@link Protocol} that describes the procedure used in this event. … … 376 437 checkPermission(Permission.WRITE); 377 438 if (protocol != null) protocol.checkPermission(Permission.USE); 439 protocolHasBeenSet = true; 378 440 getData().setProtocol(protocol == null ? null : protocol.getData()); 379 441 } … … 392 454 } 393 455 456 private boolean hardwareHasBeenSet = false; 394 457 /** 395 458 Get the {@link Hardware} that was used in this event. … … 403 466 checkPermission(Permission.WRITE); 404 467 if (hardware != null) hardware.checkPermission(Permission.USE); 468 hardwareHasBeenSet = true; 405 469 getData().setHardware(hardware == null ? null : hardware.getData()); 406 470 } -
trunk/src/core/net/sf/basedb/core/DbControl.java
r4517 r4527 328 328 sc.updateLastAccess(); 329 329 330 Project activeProject = sc.getActiveProjectId() == 0 ? 331 null : Project.getById(this, sc.getActiveProjectId()); 332 330 333 Map<BasicItem, Transactional.Action> tempQueue = null; 331 334 Map<BasicItem, Transactional.Action> afterCommitQueue = new HashMap<BasicItem, Transactional.Action>(); … … 377 380 if (action == Transactional.Action.CREATE) 378 381 { 382 if (activeProject != null) item.setProjectDefaults(activeProject); 379 383 HibernateUtil.saveData(hSession, data); 380 384 item.onAfterInsert(); -
trunk/src/core/net/sf/basedb/core/Project.java
r4517 r4527 24 24 package net.sf.basedb.core; 25 25 26 import net.sf.basedb.core.data.AnyToAnyData; 26 27 import net.sf.basedb.core.data.BasicData; 27 28 import net.sf.basedb.core.data.ProjectData; … … 36 37 import java.util.ArrayList; 37 38 import java.util.EnumSet; 39 import java.util.HashMap; 38 40 import java.util.HashSet; 39 41 import java.util.List; 42 import java.util.Map; 40 43 import java.util.Set; 41 44 import java.util.Collections; … … 145 148 146 149 150 private Map<Default, BasicData> defaults; 151 147 152 Project(ProjectData projectData) 148 153 { … … 533 538 { 534 539 String lnkName = defaultType.getName(); 540 BasicData defaultData = null; 535 541 if (defaultItem == null) 536 542 { … … 540 546 { 541 547 AnyToAny defaultLink = AnyToAny.getNewOrExisting(dc, this, lnkName, defaultItem, false); 542 if (defaultLink.getId() == 0) 543 {544 dc.saveItem(defaultLink);545 }546 }548 if (defaultLink.getId() == 0) dc.saveItem(defaultLink); 549 defaultData = defaultItem.getData(); 550 } 551 if (defaults == null) defaults = new HashMap<Default, BasicData>(); 552 defaults.put(defaultType, defaultData); 547 553 } 548 554 … … 558 564 public BasicItem getDefaultItem(DbControl dc, Default defaultType) 559 565 { 560 if (defaultType == null) throw new InvalidUseOfNullException("defaultType"); 561 BasicItem defaultItem = null; 562 AnyToAny ata; 563 try 564 { 565 ata = AnyToAny.getByName(dc, this, defaultType.getName()); 566 defaultItem = ata.getTo(); 567 } 568 catch (ItemNotFoundException ex) 569 { 570 defaultItem = null; 571 } 572 return defaultItem; 573 } 566 if (defaultType == null) throw new InvalidUseOfNullException("defaultType"); 567 BasicData defaultData = getDefaultData(dc, defaultType); 568 return dc.getItem(BasicItem.class, defaultData); 569 } 570 571 /** 572 Gets the project's default item as a data object. 573 If no item of the specified type is found this will return Null 574 @since 2.9 575 */ 576 BasicData getDefaultData(DbControl dc, Default defaultType) 577 { 578 BasicData defaultData = null; 579 if (defaults != null && defaults.containsKey(defaultType)) 580 { 581 defaultData = defaults.get(defaultType); 582 } 583 else 584 { 585 org.hibernate.Session session = dc.getHibernateSession(); 586 AnyToAnyData any = AnyToAny.getDataByName(session, getId(), getType(), defaultType.getName()); 587 if (any != null) 588 { 589 defaultData = HibernateUtil.loadData(session, 590 defaultType.getItemType().getDataClass(), any.getToId()); 591 } 592 if (defaults == null) defaults = new HashMap<Default, BasicData>(); 593 defaults.put(defaultType, defaultData); 594 } 595 return defaultData; 596 } 574 597 575 598 /** -
trunk/src/core/net/sf/basedb/core/RawBioAssay.java
r4517 r4527 28 28 import net.sf.basedb.core.data.PlatformData; 29 29 import net.sf.basedb.core.data.PlatformVariantData; 30 import net.sf.basedb.core.data.ProtocolData; 30 31 import net.sf.basedb.core.data.RawBioAssayData; 31 32 import net.sf.basedb.core.data.RawData; 32 33 import net.sf.basedb.core.data.ReporterData; 34 import net.sf.basedb.core.data.SoftwareData; 33 35 import net.sf.basedb.core.data.SpotImagesData; 34 36 … … 426 428 } 427 429 } 430 /** 431 Set software, protocol and array design from project default settings. 432 @since 2.9 433 */ 434 @Override 435 void setProjectDefaults(Project activeProject) 436 throws BaseException 437 { 438 super.setProjectDefaults(activeProject); 439 if (!softwareHasBeenSet) 440 { 441 SoftwareData software = 442 (SoftwareData)activeProject.getDefaultData(getDbControl(), 443 Project.Default.SOFTWARE); 444 if (software != null) getData().setSoftware(software); 445 softwareHasBeenSet = true; 446 } 447 if (!arrayDesignHasBeenSet) 448 { 449 ArrayDesignData design = 450 (ArrayDesignData)activeProject.getDefaultData(getDbControl(), 451 Project.Default.ARRAYDESIGN); 452 if (design != null) getData().setArrayDesign(design); 453 arrayDesignHasBeenSet = true; 454 } 455 if (!protocolHasBeenSet) 456 { 457 ProtocolData protocol = 458 (ProtocolData)activeProject.getDefaultData(getDbControl(), 459 Project.Default.FEATURE_EXTRACTION_PROTOCOL); 460 if (protocol != null) getData().setProtocol(protocol); 461 protocolHasBeenSet = true; 462 } 463 } 428 464 429 465 /** … … 688 724 } 689 725 726 private boolean softwareHasBeenSet = false; 690 727 /** 691 728 Set the {@link Software} used while analysing the scanned images. … … 701 738 checkPermission(Permission.WRITE); 702 739 if (software != null) software.checkPermission(Permission.USE); 740 softwareHasBeenSet = true; 703 741 getData().setSoftware(software == null ? null : software.getData()); 704 742 } … … 718 756 } 719 757 758 private boolean protocolHasBeenSet = false; 720 759 /** 721 760 Set the {@link Protocol} used while analysing the scanned images. … … 731 770 checkPermission(Permission.WRITE); 732 771 if (protocol != null) protocol.checkPermission(Permission.USE); 772 protocolHasBeenSet = true; 733 773 getData().setProtocol(protocol == null ? null : protocol.getData()); 734 774 } … … 750 790 } 751 791 792 private boolean arrayDesignHasBeenSet = false; 752 793 /** 753 794 Set the {@link ArrayDesign} this raw data uses. The array design can't be … … 771 812 throw new PermissionDeniedException("Not allowed to change the array design after raw data has been added"); 772 813 } 814 arrayDesignHasBeenSet = true; 773 815 getData().setArrayDesign(arrayDesign == null ? null : arrayDesign.getData()); 774 816 } -
trunk/src/core/net/sf/basedb/core/Scan.java
r4517 r4527 25 25 import net.sf.basedb.core.data.ArrayBatchData; 26 26 import net.sf.basedb.core.data.ArraySlideData; 27 import net.sf.basedb.core.data.HardwareData; 27 28 import net.sf.basedb.core.data.HybridizationData; 29 import net.sf.basedb.core.data.ProtocolData; 28 30 import net.sf.basedb.core.data.ScanData; 29 31 import net.sf.basedb.core.query.Restrictions; … … 173 175 return using; 174 176 } 177 /** 178 Set scanner and protocol from project default settings. 179 @since 2.9 180 */ 181 @Override 182 void setProjectDefaults(Project activeProject) 183 throws BaseException 184 { 185 super.setProjectDefaults(activeProject); 186 if (!scannerHasBeenSet) 187 { 188 HardwareData scanner = 189 (HardwareData)activeProject.getDefaultData(getDbControl(), 190 Project.Default.SCANNER_HARDWARE); 191 if (scanner != null) getData().setScanner(scanner); 192 scannerHasBeenSet = true; 193 } 194 if (!protocolHasBeenSet) 195 { 196 ProtocolData protocol = 197 (ProtocolData)activeProject.getDefaultData(getDbControl(), 198 Project.Default.SCANNING_PROTOCOL); 199 if (protocol != null) getData().setProtocol(protocol); 200 protocolHasBeenSet = true; 201 } 202 } 175 203 // ------------------------------------------- 176 204 … … 222 250 } 223 251 252 private boolean scannerHasBeenSet = false; 224 253 /** 225 254 Set the {@link Hardware} (scanner) used to create this scan. … … 235 264 checkPermission(Permission.WRITE); 236 265 if (scanner != null) scanner.checkPermission(Permission.USE); 266 scannerHasBeenSet = true; 237 267 getData().setScanner(scanner == null ? null : scanner.getData()); 238 268 } … … 252 282 } 253 283 284 private boolean protocolHasBeenSet = false; 254 285 /** 255 286 Set the {@link Protocol} used to create this scan. … … 265 296 checkPermission(Permission.WRITE); 266 297 if (protocol != null) protocol.checkPermission(Permission.USE); 298 protocolHasBeenSet = true; 267 299 getData().setProtocol(protocol == null ? null : protocol.getData()); 268 300 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java
r4513 r4527 64 64 import net.sf.basedb.core.PlatformVariant; 65 65 import net.sf.basedb.core.PluginParameter; 66 import net.sf.basedb.core.Project; 66 67 import net.sf.basedb.core.Protocol; 68 import net.sf.basedb.core.RawDataType; 67 69 import net.sf.basedb.core.RequestInformation; 68 70 import net.sf.basedb.core.Sample; … … 1132 1134 return findReferencedItem(dc, idMethod, platformQuery, identifier); 1133 1135 } 1136 /** 1137 Get the default platform of the currently active project. 1138 @return The active platform, or null if no project is active or 1139 the project doesn't specify a platform 1140 @since 2.9 1141 */ 1142 protected Platform getProjectDefaultPlatform(DbControl dc) 1143 { 1144 if (sc.getActiveProjectId() == 0) return null; 1145 Project activeProject = Project.getById(dc, sc.getActiveProjectId()); 1146 return (Platform)activeProject.getDefaultItem(dc, Project.Default.PLATFORM); 1147 } 1148 1149 /** 1150 Get the default platform variant of the currently active project. 1151 @return The active platform variant, or null if no project is active or 1152 the project doesn't specify a variant 1153 @since 2.9 1154 */ 1155 protected PlatformVariant getProjectDefaultVariant(DbControl dc) 1156 { 1157 if (sc.getActiveProjectId() == 0) return null; 1158 Project activeProject = Project.getById(dc, sc.getActiveProjectId()); 1159 return (PlatformVariant)activeProject.getDefaultItem(dc, Project.Default.PLATFORM_VARIANT); 1160 } 1134 1161 1135 1162 private ItemQuery<PlatformVariant> variantQuery; … … 1166 1193 return findReferencedItem(dc, idMethod, variantQuery, identifier); 1167 1194 } 1195 1196 /** 1197 Get the default raw data type of the currently active project. 1198 @return The active raw data type, or null if no project is active or 1199 the project doesn't specify raw data type 1200 @since 2.9 1201 */ 1202 protected RawDataType getProjectDefaultRawDataType(DbControl dc) 1203 { 1204 if (sc.getActiveProjectId() == 0) return null; 1205 Project activeProject = Project.getById(dc, sc.getActiveProjectId()); 1206 return activeProject.getDefaultRawDataType(); 1207 } 1208 1168 1209 1169 1210 private ItemQuery<DataFileType> fileTypeQuery; -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayDesignImporter.java
r4513 r4527 252 252 platform = findPlatform(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, platformMapper.getValue(data)); 253 253 } 254 else 255 { 256 platform = getProjectDefaultPlatform(dc); 257 } 254 258 if (variantMapper != null) 255 259 { 256 260 variant = findVariant(dc, platform, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, variantMapper.getValue(data)); 261 } 262 else 263 { 264 variant = getProjectDefaultVariant(dc); 257 265 } 258 266 -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java
r4513 r4527 315 315 platform = findPlatform(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, platformMapper.getValue(data)); 316 316 } 317 else 318 { 319 platform = getProjectDefaultPlatform(dc); 320 } 317 321 if (variantMapper != null) 318 322 { 319 323 variant = findVariant(dc, platform, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, variantMapper.getValue(data)); 320 324 } 325 else 326 { 327 variant = getProjectDefaultVariant(dc); 328 } 321 329 if (rawDataTypeMapper != null) 322 330 { 323 331 rawDataType = RawDataTypes.getRawDataType(rawDataTypeMapper.getValue(data)); 332 } 333 else 334 { 335 rawDataType = getProjectDefaultRawDataType(dc); 324 336 } 325 337 -
trunk/src/test/TestProject.java
r4514 r4527 70 70 test_listgroups(id, 0); 71 71 TestGroup.test_delete(groupId); 72 72 73 // Extra test: set default item. 74 int samplingId = TestProtocol.test_create( 75 SystemItems.getId(ProtocolType.SAMPLING), "Sampling protocol", false); 76 int hybStationId = TestHardware.test_create( 77 SystemItems.getId(HardwareType.HYBRIDIZATION_STATION), "Hyb station", false); 78 test_defaultItem(id, Project.Default.SAMPLING_PROTOCOL, samplingId); 79 test_defaultItem(id, Project.Default.HYBRIDIZATION_HARDWARE, hybStationId); 80 73 81 // Extra test: activate project, create shared item, and list all items 74 82 test_activate_project(id); 75 int labelId = TestLabel.test_create(true);76 int clientId = TestClient.test_create("shared.to.project", true);83 int sampleId = TestSample.test_create(0, "Sample (shared)", false); 84 int hybId = TestHybridization.test_create(0, false, new int[] {}); 77 85 test_list_items(id, 2); 78 86 test_noactive_project(); 87 79 88 if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter(); 80 TestLabel.test_delete(labelId); 81 TestClient.test_delete(clientId); 82 83 // Extra test: set default item. 84 test_defaultItem(id); 85 89 TestSample.test_delete(sampleId); 90 TestHybridization.test_delete(hybId); 86 91 87 92 // Standard test: Delete 88 93 test_delete(id); 89 94 test_delete(id2); 95 TestProtocol.test_delete(sampleId); 96 TestHardware.test_delete(hybStationId); 97 90 98 write("++Testing projects "+(ok ? "OK" : "Failed")+"\n"); 91 99 return ok; 92 100 } 93 101 94 static void test_defaultItem(int id)95 { 96 if ( id == 0) return;102 static void test_defaultItem(int project_id, Project.Default defaultType, int item_id) 103 { 104 if (project_id == 0 || item_id == 0) return; 97 105 DbControl dc = null; 98 106 try 99 107 { 100 dc = TestUtil.getDbControl(); 101 int adId = TestArrayDesign.test_create(Platform.GENERIC, false); 102 ArrayDesign ad = ArrayDesign.getById(dc, adId); 103 Project p = Project.getById(dc, id); 104 105 p.setDefaultItem(dc, ad, Project.Default.ARRAYDESIGN); 106 dc.commit(); 107 write("--Set default item OK"); 108 dc = TestUtil.getDbControl(); 109 ArrayDesign testAD = (ArrayDesign)p.getDefaultItem(dc, Project.Default.ARRAYDESIGN); 110 if (testAD.getId() != adId) throw new BaseException("Expected " + adId + " but got " + testAD.getId()); 111 write("--Get default item OK"); 112 if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter(); 113 p.setDefaultItem(dc, null, Project.Default.ARRAYDESIGN); 114 dc.commit(); 115 dc = TestUtil.getDbControl(); 116 try 117 { 118 testAD = (ArrayDesign)p.getDefaultItem(dc, Project.Default.ARRAYDESIGN); 119 } 120 catch(ItemNotFoundException ex) 121 { 122 write("--Reset default item OK"); 123 } 124 TestArrayDesign.test_delete(adId); 108 dc = TestUtil.getDbControl(); 109 Project p = Project.getById(dc, project_id); 110 BasicItem defaultItem = defaultType.getItemType().getById(dc, item_id); 111 p.setDefaultItem(dc, defaultItem, defaultType); 112 dc.commit(); 113 write("--Set default item OK (" + defaultType + "; id=" + item_id + ")"); 125 114 } 126 115 catch(Throwable ex) 127 116 { 128 write("--Set default item FAILED ");117 write("--Set default item FAILED (" + defaultType + "; id=" + item_id + ")"); 129 118 ex.printStackTrace(); 130 119 ok = false;
Note: See TracChangeset
for help on using the changeset viewer.