Changeset 7772
- Timestamp:
- Feb 17, 2020, 8:46:13 AM (3 years ago)
- Location:
- trunk/src/core/net/sf/basedb
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/query/IdListRestriction.java
r7771 r7772 52 52 public IdListRestriction(Set<Integer> idList) 53 53 { 54 this.idList = idList;54 this.idList = new HashSet<>(idList); 55 55 this.idExpression = Hql.property("id"); 56 56 } -
trunk/src/core/net/sf/basedb/util/listable/ExtractToParentExtractTransformer.java
r6848 r7772 48 48 private final boolean includeSourcesInTarget; 49 49 private CollectExtracts collectedExtracts; 50 private boolean pushOnly; 50 51 51 52 /** … … 57 58 super(Item.EXTRACT, Item.EXTRACT); 58 59 this.includeSourcesInTarget = includeSourcesInTarget; 60 } 61 62 /** 63 Create a new extract to parent extract transformer that only load parents 64 to extracts that has a subtype with "push annotations" set. This functionality 65 should only be used in the first transformation step. 66 @see PushToParentsTransformer 67 @since 3.16 68 */ 69 public ExtractToParentExtractTransformer(boolean includeSourcesInTarget, boolean childrensThatPushOnly) 70 { 71 this(includeSourcesInTarget); 72 this.pushOnly = childrensThatPushOnly; 59 73 } 60 74 … … 87 101 ) 88 102 ); 103 if (pushOnly) 104 { 105 query.join(Hql.innerJoin("bm", "itemSubtype", "st")); 106 query.restrict(Restrictions.eq(Hql.property("st", "pushAnnotations"), Expressions.bool(true))); 107 } 89 108 90 109 // If we have collected downstream extracts we must -
trunk/src/core/net/sf/basedb/util/listable/ExtractToSampleTransformer.java
r6848 r7772 47 47 { 48 48 49 private boolean pushOnly; 50 49 51 public ExtractToSampleTransformer() 50 52 { 51 53 super(Item.EXTRACT, Item.SAMPLE); 54 } 55 56 /** 57 Create a new extract to sample transformer that only load parent samples 58 to extracts that has a subtype with "push annotations" set. This functionality 59 should only be used in the first transformation step. 60 @see PushToParentsTransformer 61 @since 3.16 62 */ 63 public ExtractToSampleTransformer(boolean childrensThatPushOnly) 64 { 65 this(); 66 this.pushOnly = childrensThatPushOnly; 52 67 } 53 68 … … 68 83 ) 69 84 ); 85 if (pushOnly) 86 { 87 query.join(Hql.innerJoin("ch", "itemSubtype", "st")); 88 query.restrict(Restrictions.eq(Hql.property("st", "pushAnnotations"), Expressions.bool(true))); 89 } 70 90 return safeIdList(context.getDbControl(), query, "extracts", source); 71 91 } -
trunk/src/core/net/sf/basedb/util/listable/SampleToBioSourceTransformer.java
r6848 r7772 44 44 { 45 45 46 private boolean pushOnly; 47 46 48 public SampleToBioSourceTransformer() 47 49 { 48 50 super(Item.SAMPLE, Item.BIOSOURCE); 51 } 52 53 /** 54 Create a new sample to biosource transformer that only load parent biosources 55 to sample that has a subtype with "push annotations" set. This functionality 56 should only be used in the first transformation step. 57 @see PushToParentsTransformer 58 @since 3.16 59 */ 60 public SampleToBioSourceTransformer(boolean childrensThatPushOnly) 61 { 62 this(); 63 this.pushOnly = childrensThatPushOnly; 49 64 } 50 65 … … 65 80 ) 66 81 ); 82 if (pushOnly) 83 { 84 query.join(Hql.innerJoin("ch", "itemSubtype", "st")); 85 query.restrict(Restrictions.eq(Hql.property("st", "pushAnnotations"), Expressions.bool(true))); 86 } 67 87 return safeIdList(context.getDbControl(), query, "samples", source); 68 88 } -
trunk/src/core/net/sf/basedb/util/listable/SampleToParentSampleTransformer.java
r6848 r7772 47 47 48 48 private final boolean includeSourcesInTarget; 49 private boolean pushOnly; 49 50 50 51 /** … … 57 58 this.includeSourcesInTarget = includeSourcesInTarget; 58 59 } 59 60 61 /** 62 Create a new sample to parent sample transformer that only load parents 63 to samples that has a subtype with "push annotations" set. This functionality 64 should only be used in the first transformation step. 65 @see PushToParentsTransformer 66 @since 3.16 67 */ 68 public SampleToParentSampleTransformer(boolean includeSourcesInTarget, boolean childrensThatPushOnly) 69 { 70 this(includeSourcesInTarget); 71 this.pushOnly = childrensThatPushOnly; 72 } 73 60 74 @Override 61 75 public Set<Integer> transform(TransformContext context, Set<Integer> source) … … 74 88 ) 75 89 ); 90 if (pushOnly) 91 { 92 query.join(Hql.innerJoin("bm", "itemSubtype", "st")); 93 query.restrict(Restrictions.eq(Hql.property("st", "pushAnnotations"), Expressions.bool(true))); 94 } 76 95 77 96 // Keep track of all seen children and parents -
trunk/src/core/net/sf/basedb/util/listable/SourceItemTransformerWithCache.java
r7770 r7772 22 22 package net.sf.basedb.util.listable; 23 23 24 import java.util.Collections; 24 25 import java.util.List; 25 26 import java.util.Set; … … 124 125 if (cache != null) cache.store(key, target); 125 126 } 126 return target;127 return Collections.unmodifiableSet(target); 127 128 } 128 129 } -
trunk/src/core/net/sf/basedb/util/listable/ToDerivedBioAssaySourceItemTransformerFactory.java
r7219 r7772 75 75 if (sourceItemType == Item.SAMPLE || stepBySource == Item.SAMPLE) 76 76 { 77 // Expand source selection to parents if the children push annotations upwards 78 if (sourceItemType == Item.SAMPLE) chain.add(new PushToParentsTransformer(sourceItemType)); 77 79 // Load child samples including the original samples 78 80 chain.add(new SampleToChildSampleTransformer(true)); … … 89 91 // Collect parent extracts since those are also valid when joining child derived bioassays 90 92 chain.add(collectedExtracts.collectParentsOfSource(false)); 93 // Expand source selection to parents if the children push annotations upwards 94 chain.add(new PushToParentsTransformer(sourceItemType)); 91 95 } 92 96 -
trunk/src/core/net/sf/basedb/util/listable/ToExtractSourceItemTransformerFactory.java
r6801 r7772 75 75 if (sourceItemType == Item.SAMPLE || stepBySource == Item.SAMPLE) 76 76 { 77 // Expand source selection to parents if the children push annotations upwards 78 if (sourceItemType == Item.SAMPLE) chain.add(new PushToParentsTransformer(sourceItemType)); 77 79 // Load child samples and include the source samples 78 80 chain.add(new SampleToChildSampleTransformer(true)); … … 83 85 if (sourceItemType == Item.EXTRACT || stepBySource == Item.EXTRACT) 84 86 { 87 // Expand source selection to parents if the children push annotations upwards 88 if (sourceItemType == Item.EXTRACT) chain.add(new PushToParentsTransformer(sourceItemType)); 85 89 // Load child extract and maybe include source extracts 86 90 chain.add(new ExtractToChildExtractTransformer(sourceItemType != Item.EXTRACT)); -
trunk/src/core/net/sf/basedb/util/listable/ToPhysicalBioAssaySourceItemTransformerFactory.java
r6792 r7772 75 75 if (sourceItemType == Item.SAMPLE || stepBySource == Item.SAMPLE) 76 76 { 77 // Expand source selection to parents if the children push annotations upwards 78 if (sourceItemType == Item.SAMPLE) chain.add(new PushToParentsTransformer(sourceItemType)); 77 79 // Load child samples including the original samples 78 80 chain.add(new SampleToChildSampleTransformer(true)); … … 83 85 if (sourceItemType == Item.EXTRACT || stepBySource == Item.EXTRACT) 84 86 { 87 // Expand source selection to parents if the children push annotations upwards 88 if (sourceItemType == Item.EXTRACT) chain.add(new PushToParentsTransformer(sourceItemType)); 85 89 // Load child extract and include the source extracts 86 90 chain.add(new ExtractToChildExtractTransformer(true)); -
trunk/src/core/net/sf/basedb/util/listable/ToRawBioAssaySourceItemTransformerFactory.java
r6801 r7772 74 74 if (sourceItemType == Item.SAMPLE || stepBySource == Item.SAMPLE) 75 75 { 76 // Expand source selection to parents if the children push annotations upwards 77 if (sourceItemType == Item.SAMPLE) chain.add(new PushToParentsTransformer(sourceItemType)); 76 78 // Load child samples including the original samples 77 79 chain.add(new SampleToChildSampleTransformer(true)); … … 88 90 // Collect parent extracts since those are also valid when joining child derived bioassays 89 91 chain.add(collectedExtracts.collectParentsOfSource(false)); 92 // Expand source selection to parents if the children push annotations upwards 93 chain.add(new PushToParentsTransformer(sourceItemType)); 90 94 } 91 95 -
trunk/src/core/net/sf/basedb/util/listable/ToSampleSourceItemTransformerFactory.java
r6791 r7772 75 75 if (sourceItemType == Item.SAMPLE || stepBySource == Item.SAMPLE) 76 76 { 77 // Expand source selection to parents if the children push annotations upwards 78 if (sourceItemType == Item.SAMPLE) chain.add(new PushToParentsTransformer(sourceItemType)); 77 79 // Load child samples and maybe include source samples 78 80 chain.add(new SampleToChildSampleTransformer(sourceItemType != Item.SAMPLE));
Note: See TracChangeset
for help on using the changeset viewer.