Changeset 4 for trunk/grails-app/domain
- Timestamp:
- Jan 17, 2011, 3:49:20 PM (13 years ago)
- Location:
- trunk/grails-app/domain/nl/tno/metagenomics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/nl/tno/metagenomics/AssaySample.groovy
r3 r4 142 142 _averageQuality = -1; 143 143 } 144 145 /** 146 * Check whether this assay-sample combination contains information that should be saved in trash on a delete 147 * @return 148 */ 149 public boolean containsData() { 150 return tagSequence || oligoNumber || numFiles() > 0; 151 } 152 153 /** 154 * Move information that should be kept on delete to another assaySample object. 155 * 156 * N.B. The sequencedata objects are really moved, so removed from the original object! 157 * 158 * @param otherAssaySample Object to move 159 */ 160 public void moveValuableDataTo( AssaySample otherAssaySample ) { 161 // Copy properties 162 otherAssaySample.tagSequence = tagSequence; 163 otherAssaySample.oligoNumber = oligoNumber; 164 165 // Move attached data 166 def dataList = sequenceData?.toList() 167 def otherAssay = otherAssaySample.assay; 168 169 if( dataList && dataList.size() > 0 ) { 170 for( def j = dataList.size() - 1; j >= 0; j-- ) { 171 // Check whether the run of this sequenceData object is also connected to the assay 172 def run = dataList[j].run; 173 174 if( !otherAssay.runs || !otherAssay.runs.contains( run ) ) { 175 otherAssay.addToRuns( run ); 176 } 177 178 // Copy data 179 dataList[j].sample = otherAssaySample; 180 this.removeFromSequenceData( dataList[j] ); 181 otherAssaySample.addToSequenceData( dataList[j] ); 182 dataList[j].save(); 183 } 184 } 185 } 144 186 } -
trunk/grails-app/domain/nl/tno/metagenomics/Study.groovy
r2 r4 13 13 String studyToken 14 14 String name 15 16 // Set to true only on the specific study object that acts as 17 // a trash can for deleted objects. If objects are deleted in GSCF but still 18 // contain data in this module, they will be moved to the trashcan. 19 Boolean trashcan = false 15 20 16 21 // If a study is set to be dirty, it should be updated … … 31 36 static constraints = { 32 37 studyToken(unique:true) 38 trashcan(nullable:true) 39 isDirty(nullable:true) 33 40 } 34 41 … … 70 77 return authorization.isOwner 71 78 } 79 72 80 }
Note: See TracChangeset
for help on using the changeset viewer.