Changeset 6959
- Timestamp:
- Oct 1, 2015, 11:37:58 AM (7 years ago)
- Location:
- trunk/src/core/net/sf/basedb/util/overview
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/util/overview/loader/AnyToAnyLoader.java
r6870 r6959 29 29 import net.sf.basedb.core.ItemQuery; 30 30 import net.sf.basedb.core.ItemResultIterator; 31 import net.sf.basedb.core.RootRawBioAssay; 31 32 import net.sf.basedb.util.overview.OverviewContext; 32 33 import net.sf.basedb.util.overview.node.AnyToAnyNameGenerator; … … 67 68 // Load all any-to-any links for the give item 68 69 BasicItem parent = parentNode.getItem(dc); 70 if (parent instanceof RootRawBioAssay) 71 { 72 // The parent may be a root raw bioasay if the overview starts at the 73 // experiment level 74 parent = ((RootRawBioAssay)parent).getRawBioAssay(); 75 } 76 69 77 ItemQuery<AnyToAny> query = context.initQuery(AnyToAny.getLinksFrom(parent), "name"); 70 78 -
trunk/src/core/net/sf/basedb/util/overview/loader/ArrayDesignLoader.java
r5500 r6959 24 24 import net.sf.basedb.core.ArrayBatch; 25 25 import net.sf.basedb.core.ArrayDesign; 26 import net.sf.basedb.core.BasicItem; 26 27 import net.sf.basedb.core.DbControl; 27 28 import net.sf.basedb.core.Item; 28 29 import net.sf.basedb.core.PermissionDeniedException; 29 30 import net.sf.basedb.core.RawBioAssay; 31 import net.sf.basedb.core.RootRawBioAssay; 30 32 import net.sf.basedb.util.overview.OverviewContext; 31 33 import net.sf.basedb.util.overview.node.ChildNodeDirection; … … 81 83 } 82 84 /** 83 Create an array design property node from a raw bioassay node. 84 @return An array design node, or null if the batch doesn't have a design 85 Create an array design property node from a raw bioassay or 86 root raw bioassay node. 87 @return An array design node, or null if the raw bioassay doesn't have a design 85 88 */ 86 89 @Override 87 public Node createPropertyNode(DbControl dc, OverviewContext context, Node rawBioAssayNode)90 public Node createPropertyNode(DbControl dc, OverviewContext context, Node parentNode) 88 91 { 89 92 NodeFactory<ArrayDesign> nf = getNodeFactory(dc, context); … … 92 95 try 93 96 { 94 design = ((RawBioAssay)rawBioAssayNode.getItem(dc)).getArrayDesign(); 97 BasicItem parentItem = parentNode.getItem(dc); 98 if (parentItem instanceof RootRawBioAssay) 99 { 100 // The parent may be a root raw bioasay if the overview starts at the 101 // experiment level 102 parentItem = ((RootRawBioAssay)parentItem).getRawBioAssay(); 103 } 104 if (parentItem instanceof RawBioAssay) 105 { 106 RawBioAssay rba = (RawBioAssay)parentItem; 107 design = rba.getArrayDesign(); 108 } 95 109 } 96 110 catch (PermissionDeniedException ex) … … 99 113 } 100 114 Node designNode = createItemNode(nf, design, design, denied, 101 rawBioAssayNode, ChildNodeDirection.PROPERTY);115 parentNode, ChildNodeDirection.PROPERTY); 102 116 return designNode; 103 117 } -
trunk/src/core/net/sf/basedb/util/overview/loader/BasicItemNodeLoaderFactory.java
r6875 r6959 227 227 registerCheckedNodeLoader(Item.DERIVEDBIOASSAY, DerivedBioAssayLoader.class); 228 228 registerCheckedNodeLoader(Item.RAWBIOASSAY, RawBioAssayLoader.class); 229 registerCheckedNodeLoader(Item.ROOTRAWBIOASSAY, RootRawBioAssayLoader.class); 229 230 registerCheckedNodeLoader(Item.EXPERIMENT, ExperimentLoader.class); 230 231 registerCheckedNodeLoader(Item.BIOPLATE, BioPlateLoader.class); -
trunk/src/core/net/sf/basedb/util/overview/loader/DataFileLoader.java
r4750 r6959 31 31 import net.sf.basedb.core.Item; 32 32 import net.sf.basedb.core.ItemQuery; 33 import net.sf.basedb.core.RootRawBioAssay; 33 34 import net.sf.basedb.util.overview.OverviewContext; 34 35 import net.sf.basedb.util.overview.node.ChildNodeDirection; … … 67 68 Node folderNode = null; 68 69 69 FileStoreEnabled parent = (FileStoreEnabled)parentNode.getItem(dc); 70 Item parentType = parentNode.getItemType(); 71 FileStoreEnabled parent = null; 72 if (parentType == Item.ROOTRAWBIOASSAY) 73 { 74 // The parent may be a root raw bioasay if the overview starts at the 75 // experiment level 76 RootRawBioAssay root = (RootRawBioAssay)parentNode.getItem(dc); 77 parent = root.getRawBioAssay(); 78 } 79 else 80 { 81 parent = (FileStoreEnabled)parentNode.getItem(dc); 82 } 83 70 84 if (parent.hasFileSet()) 71 85 { -
trunk/src/core/net/sf/basedb/util/overview/loader/DerivedBioAssayLoader.java
r6755 r6959 35 35 import net.sf.basedb.core.PhysicalBioAssay; 36 36 import net.sf.basedb.core.RawBioAssay; 37 import net.sf.basedb.core.RootRawBioAssay; 37 38 import net.sf.basedb.core.Type; 38 39 import net.sf.basedb.core.query.Expressions; … … 121 122 { 122 123 returnNode = createReverseNode((RawBioAssay)parentNode.getItem(dc), dc, context, parentNode); 124 } 125 else if (parentType == Item.ROOTRAWBIOASSAY) 126 { 127 RootRawBioAssay root = (RootRawBioAssay)parentNode.getItem(dc); 128 returnNode = createReverseNode(root.getRawBioAssay(), dc, context, parentNode); 123 129 } 124 130 return returnNode; -
trunk/src/core/net/sf/basedb/util/overview/loader/ExperimentLoader.java
r5966 r6959 104 104 105 105 /** 106 Loads the r aw bioassay nodes that are part of this experiment106 Loads the root raw bioassay nodes that are part of this experiment 107 107 @see RawBioAssayLoader#createReverseNode(DbControl, OverviewContext, Node) 108 108 */ … … 110 110 protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node experimentNode) 111 111 { 112 getNodeLoader(context, Item.R AWBIOASSAY).createReverseNode(dc, context, experimentNode);112 getNodeLoader(context, Item.ROOTRAWBIOASSAY).createReverseNode(dc, context, experimentNode); 113 113 } 114 114 // -------------------------------- -
trunk/src/core/net/sf/basedb/util/overview/loader/ExtractLoader.java
r6799 r6959 37 37 import net.sf.basedb.core.ItemResultIterator; 38 38 import net.sf.basedb.core.RawBioAssay; 39 import net.sf.basedb.core.RootRawBioAssay; 39 40 import net.sf.basedb.core.Sample; 40 41 import net.sf.basedb.core.Type; … … 148 149 returnNode = createReverseNode((RawBioAssay)parentNode.getItem(dc), dc, context, parentNode); 149 150 } 151 else if (parentItem == Item.ROOTRAWBIOASSAY) 152 { 153 returnNode = createReverseNode(((RootRawBioAssay)parentNode.getItem(dc)).getRawBioAssay(), dc, context, parentNode); 154 } 150 155 return returnNode; 151 156 } -
trunk/src/core/net/sf/basedb/util/overview/loader/PlatformLoader.java
r6520 r6959 30 30 import net.sf.basedb.core.PlatformVariant; 31 31 import net.sf.basedb.core.RawBioAssay; 32 import net.sf.basedb.core.RootRawBioAssay; 32 33 import net.sf.basedb.util.overview.Node; 33 34 import net.sf.basedb.util.overview.OverviewContext; … … 70 71 { 71 72 BasicItem parentItem = parentNode.getItem(dc); 73 if (parentItem instanceof RootRawBioAssay) 74 { 75 // The parent may be a root raw bioasay if the overview starts at the 76 // experiment level 77 parentItem = ((RootRawBioAssay)parentItem).getRawBioAssay(); 78 } 72 79 if (parentItem instanceof RawBioAssay) 73 80 { -
trunk/src/core/net/sf/basedb/util/overview/loader/ProtocolLoader.java
r6210 r6959 29 29 import net.sf.basedb.core.PermissionDeniedException; 30 30 import net.sf.basedb.core.Protocol; 31 import net.sf.basedb.core.RootRawBioAssay; 31 32 import net.sf.basedb.util.overview.Node; 32 33 import net.sf.basedb.util.overview.OverviewContext; … … 67 68 { 68 69 BasicItem parentItem = parentNode.getItem(dc); 70 if (parentItem instanceof RootRawBioAssay) 71 { 72 // The parent may be a root raw bioasay if the overview starts at the 73 // experiment level 74 parentItem = ((RootRawBioAssay)parentItem).getRawBioAssay(); 75 } 69 76 if (parentItem instanceof Annotatable) 70 77 { -
trunk/src/core/net/sf/basedb/util/overview/loader/SoftwareLoader.java
r6334 r6959 28 28 import net.sf.basedb.core.PermissionDeniedException; 29 29 import net.sf.basedb.core.RawBioAssay; 30 import net.sf.basedb.core.RootRawBioAssay; 30 31 import net.sf.basedb.core.Software; 31 32 import net.sf.basedb.util.overview.Node; … … 67 68 { 68 69 BasicItem parentItem = parentNode.getItem(dc); 70 if (parentItem instanceof RootRawBioAssay) 71 { 72 // The parent may be a root raw bioasay if the overview starts at the 73 // experiment level 74 parentItem = ((RootRawBioAssay)parentItem).getRawBioAssay(); 75 } 69 76 if (parentItem instanceof RawBioAssay) 70 77 { -
trunk/src/core/net/sf/basedb/util/overview/validator/AnnotationValidator.java
r6939 r6959 258 258 259 259 // Check for missing experimental factor values (if we have an experiment in the parent path) 260 if (parentNode.getItemType() == Item.R AWBIOASSAY)260 if (parentNode.getItemType() == Item.ROOTRAWBIOASSAY) 261 261 { 262 262 Node experimentNode = parentNode.getFirstParent(new ItemTypeFilter(Item.EXPERIMENT)); … … 271 271 if (!all.contains(factor)) 272 272 { 273 Fix fix = factor.isEnabledForItem(Item.R AWBIOASSAY) ?273 Fix fix = factor.isEnabledForItem(Item.ROOTRAWBIOASSAY) ? 274 274 new Fix("Add value to experimental factor", (BasicItem)parent, factor, false) : 275 275 new Fix("Inherit annotation from a parent item", (BasicItem)parent, factor, true); -
trunk/src/core/net/sf/basedb/util/overview/validator/ArrayDesignValidator.java
r5814 r6959 34 34 import net.sf.basedb.core.Project; 35 35 import net.sf.basedb.core.RawBioAssay; 36 import net.sf.basedb.core.RootRawBioAssay; 36 37 import net.sf.basedb.util.overview.Fix; 37 38 import net.sf.basedb.util.overview.OverviewContext; … … 85 86 // Check that a raw bioassay has same "direct" array desing as 86 87 // via physical bioassay->slide... 87 if (parentNode != null && parentNode.getItemType() == Item.RAWBIOASSAY) 88 Item parentType = parentNode.getItemType(); 89 if (parentNode != null && (parentType == Item.RAWBIOASSAY || parentType == Item.ROOTRAWBIOASSAY)) 88 90 { 89 RawBioAssay rba = (RawBioAssay)parentNode.getItem(dc);91 RawBioAssay rba = parentType == Item.RAWBIOASSAY ? (RawBioAssay)parentNode.getItem(dc) : ((RootRawBioAssay)parentNode.getItem()).getRawBioAssay(); 90 92 try 91 93 { -
trunk/src/core/net/sf/basedb/util/overview/validator/BasicItemNodeValidatorFactory.java
r6875 r6959 46 46 { 47 47 48 private final Map<Object, Class<? extends NodeValidator<? extends BasicItem>>> validators;48 private final Map<Object, Class<?>> validators; 49 49 private boolean useNullValidator; 50 50 private boolean disabled; … … 55 55 public BasicItemNodeValidatorFactory() 56 56 { 57 validators = new HashMap<Object, Class<? extends NodeValidator<? extends BasicItem>>>();57 validators = new HashMap<Object, Class<?>>(); 58 58 this.useNullValidator = true; 59 59 this.disabled = false; … … 90 90 @return A node validator object 91 91 */ 92 @SuppressWarnings("unchecked") 92 93 @Override 93 94 public NodeValidator<? extends BasicItem> createNodeValidator(Object key) 94 95 { 95 96 NodeValidator<? extends BasicItem> validator = null; 96 Class<? extends NodeValidator<? extends BasicItem>> validatorClass =97 Class<?> validatorClass = 97 98 disabled ? null : validators.get(key); 98 99 if (validatorClass == null) … … 111 112 try 112 113 { 113 validator = validatorClass.newInstance();114 validator = (NodeValidator<BasicItem>)validatorClass.newInstance(); 114 115 } 115 116 catch (Exception ex) … … 172 173 */ 173 174 protected void registerCheckedNodeValidator(Object key, 174 Class<? extends NodeValidator<? extends BasicItem>> validatorClass)175 Class<?> validatorClass) 175 176 { 176 177 if (validatorClass == null) … … 201 202 registerCheckedNodeValidator(Item.DERIVEDBIOASSAY, DerivedBioAssayValidator.class); 202 203 registerCheckedNodeValidator(Item.RAWBIOASSAY, RawBioAssayValidator.class); 204 registerCheckedNodeValidator(Item.ROOTRAWBIOASSAY, RawBioAssayValidator.class); 203 205 registerCheckedNodeValidator(Item.EXPERIMENT, ExperimentValidator.class); 204 206 registerCheckedNodeValidator(Item.BIOPLATE, BioPlateValidator.class); -
trunk/src/core/net/sf/basedb/util/overview/validator/DataFileValidator.java
r6089 r6959 39 39 import net.sf.basedb.core.PlatformFileType; 40 40 import net.sf.basedb.core.PlatformVariant; 41 import net.sf.basedb.core.RootRawBioAssay; 41 42 import net.sf.basedb.core.Subtypable; 42 43 import net.sf.basedb.core.UsableDataFileType; … … 91 92 // The parent node is either a folder (if we have more than one file) 92 93 // or the actual parent (for a single file) 93 FileStoreEnabled parentItem = (FileStoreEnabled)(parentNode.getNodeType() == Node.Type.FOLDER ? 94 parentNode.getParent().getItem(dc) : parentNode.getItem(dc)); 94 BasicItem parentItem = parentNode.getNodeType() == Node.Type.FOLDER ? 95 parentNode.getParent().getItem(dc) : parentNode.getItem(dc); 96 if (parentItem instanceof RootRawBioAssay) 97 { 98 // The parent may be a root raw bioasay if the overview starts at the 99 // experiment level 100 parentItem = ((RootRawBioAssay)parentItem).getRawBioAssay(); 101 } 102 FileStoreEnabled fileStoreItem = (FileStoreEnabled)parentItem; 95 103 96 104 // Check that we have access to the file and it's file type … … 124 132 errorMsg += " is not valid: " + member.getErrorMessage(); 125 133 context.createFailure(Validator.DATAFILE_INVALID, node, errorMsg, 126 new Fix("Select another file", (BasicItem)parentItem, member)134 new Fix("Select another file", parentItem, member) 127 135 ); 128 136 } … … 135 143 context.createFailure(Validator.DATAFILE_NOTVALIDATED, node, 136 144 fileType.getName() + " has not been validated", 137 new Fix("Validate the file / Select another file", (BasicItem)parentItem, member));145 new Fix("Validate the file / Select another file", parentItem, member)); 138 146 } 139 147 … … 143 151 context.createFailure(Validator.DATAFILE_INVALID_ITEM, node, 144 152 "Data file '" + fileType.getName() + "' can't be used on item type: " + parentItem.getType(), 145 new Fix("Remove file", (BasicItem)parentItem, member)153 new Fix("Remove file", parentItem, member) 146 154 ); 147 155 } … … 150 158 try 151 159 { 152 Platform platform = parentItem.getPlatform();153 PlatformVariant variant = parentItem.getVariant();160 Platform platform = fileStoreItem.getPlatform(); 161 PlatformVariant variant = fileStoreItem.getVariant(); 154 162 if (platform != null) 155 163 { … … 213 221 { 214 222 super.postValidateFolder(dc, context, folderNode, parentNode); 215 FileStoreEnabled parentItem = (FileStoreEnabled)parentNode.getItem(dc); 223 BasicItem parentItem = parentNode.getItem(dc); 224 if (parentItem instanceof RootRawBioAssay) 225 { 226 // The parent may be a root raw bioasay if the overview starts at the 227 // experiment level 228 parentItem = ((RootRawBioAssay)parentItem).getRawBioAssay(); 229 } 230 FileStoreEnabled fileStoreItem = (FileStoreEnabled)parentItem; 216 231 217 232 // Check that we have linked a file for all file types that … … 220 235 try 221 236 { 222 Platform platform = parentItem.getPlatform();223 PlatformVariant variant = parentItem.getVariant();237 Platform platform = fileStoreItem.getPlatform(); 238 PlatformVariant variant = fileStoreItem.getVariant(); 224 239 BasicItem pvItem = null; 225 240 ItemSubtype subtype = parentItem instanceof Subtypable ? … … 236 251 Restrictions.eq( 237 252 Hql.property("dft", "itemType"), 238 Expressions.integer(parent Node.getItemType().getValue())253 Expressions.integer(parentItem.getType().getValue()) 239 254 ) 240 255 ); … … 250 265 Restrictions.eq( 251 266 Hql.property("dft", "itemType"), 252 Expressions.integer(parent Node.getItemType().getValue())267 Expressions.integer(parentItem.getType().getValue()) 253 268 ) 254 269 ); 255 270 fileTypes = query.list(dc); 256 271 } 257 FileSet fs = parentItem.hasFileSet() ? parentItem.getFileSet() : null;272 FileSet fs = fileStoreItem.hasFileSet() ? fileStoreItem.getFileSet() : null; 258 273 for (UsableDataFileType fileType : fileTypes) 259 274 { -
trunk/src/core/net/sf/basedb/util/overview/validator/ExtractValidator.java
r6799 r6959 84 84 */ 85 85 /** 86 Do not report missing items if the parent node is a derived or raw bioassay.86 Do not report missing items if the parent node is a derived or (root) raw bioassay. 87 87 */ 88 88 @Override … … 90 90 { 91 91 Item parentType = parentNode.getItemType(); 92 if (parentType == Item.DERIVEDBIOASSAY || parentType == Item.RAWBIOASSAY ) return false;92 if (parentType == Item.DERIVEDBIOASSAY || parentType == Item.RAWBIOASSAY || parentType == Item.ROOTRAWBIOASSAY) return false; 93 93 return super.preMissingItem(dc, context, parentNode); 94 94 } -
trunk/src/core/net/sf/basedb/util/overview/validator/RawBioAssayValidator.java
r6098 r6959 25 25 26 26 import net.sf.basedb.core.ArrayDesign; 27 import net.sf.basedb.core.BasicItem; 27 28 import net.sf.basedb.core.DbControl; 28 29 import net.sf.basedb.core.DerivedBioAssay; 29 30 import net.sf.basedb.core.Extract; 31 import net.sf.basedb.core.Nameable; 30 32 import net.sf.basedb.core.PermissionDeniedException; 31 33 import net.sf.basedb.core.PhysicalBioAssay; … … 33 35 import net.sf.basedb.core.RawBioAssay; 34 36 import net.sf.basedb.core.RawDataType; 37 import net.sf.basedb.core.RootRawBioAssay; 35 38 import net.sf.basedb.util.Values; 36 39 import net.sf.basedb.util.overview.Fix; … … 41 44 42 45 /** 43 Validator implementation for raw bioassays. Validation rules: 46 Validator implementation for raw bioassays and root raw bioassays. 47 Validation rules: 44 48 <ul> 45 49 <li>Non-default raw data type: {@link Validator#NONDEFAULT_RAWDATATYPE} … … 54 58 */ 55 59 public class RawBioAssayValidator 56 extends NameableNodeValidator< RawBioAssay>60 extends NameableNodeValidator<Nameable> 57 61 { 58 62 … … 73 77 // Check raw data type against default raw data type 74 78 Project project = context.getProject(); 75 RawBioAssay rba = (RawBioAssay)node.getItem(dc); 79 BasicItem item = node.getItem(dc); 80 if (item instanceof RootRawBioAssay) 81 { 82 // The parent may be a root raw bioasay if the overview starts at the 83 // experiment level 84 item = ((RootRawBioAssay)item).getRawBioAssay(); 85 } 86 RawBioAssay rba = (RawBioAssay)item; 76 87 if (project != null) 77 88 {
Note: See TracChangeset
for help on using the changeset viewer.