1524 |
25 Jan 12 |
nicklas |
1 |
package net.sf.basedb.reggie.dao; |
1524 |
25 Jan 12 |
nicklas |
2 |
|
1524 |
25 Jan 12 |
nicklas |
3 |
import net.sf.basedb.core.DbControl; |
1524 |
25 Jan 12 |
nicklas |
4 |
import net.sf.basedb.core.Sample; |
1524 |
25 Jan 12 |
nicklas |
5 |
import net.sf.basedb.reggie.Reggie; |
3845 |
14 Apr 16 |
nicklas |
6 |
import net.sf.basedb.reggie.projectarchive.ProjectArchiveService; |
1524 |
25 Jan 12 |
nicklas |
7 |
|
1524 |
25 Jan 12 |
nicklas |
8 |
/** |
1524 |
25 Jan 12 |
nicklas |
Class for handling information related to consent information. |
1524 |
25 Jan 12 |
nicklas |
10 |
|
1524 |
25 Jan 12 |
nicklas |
@author nicklas |
1524 |
25 Jan 12 |
nicklas |
@since 2.2 |
1524 |
25 Jan 12 |
nicklas |
13 |
*/ |
1524 |
25 Jan 12 |
nicklas |
14 |
public class Consent |
1524 |
25 Jan 12 |
nicklas |
15 |
{ |
1524 |
25 Jan 12 |
nicklas |
16 |
|
1524 |
25 Jan 12 |
nicklas |
17 |
/** |
1524 |
25 Jan 12 |
nicklas |
Load all consent-related annotations for the given item. |
1524 |
25 Jan 12 |
nicklas |
19 |
*/ |
3572 |
02 Nov 15 |
nicklas |
20 |
public static void loadConsentAnnotations(DbControl dc, ReggieItem<?> item) |
1524 |
25 Jan 12 |
nicklas |
21 |
{ |
1610 |
23 Apr 12 |
nicklas |
22 |
item.loadAnnotations(dc, "consent", Annotationtype.CONSENT, null); |
1610 |
23 Apr 12 |
nicklas |
23 |
item.loadAnnotations(dc, "consentDate", Annotationtype.CONSENT_DATE, Reggie.CONVERTER_DATE_TO_STRING); |
1524 |
25 Jan 12 |
nicklas |
24 |
} |
1524 |
25 Jan 12 |
nicklas |
25 |
|
1524 |
25 Jan 12 |
nicklas |
26 |
|
1524 |
25 Jan 12 |
nicklas |
27 |
/** |
1524 |
25 Jan 12 |
nicklas |
Copy all consent-related annotations from one item to the other. |
5277 |
05 Feb 19 |
nicklas |
@param force TRUE to overwrite existing annotations, FALSE to not |
5277 |
05 Feb 19 |
nicklas |
@return TRUE if any of the consent information was changed, FALSE if no |
1524 |
25 Jan 12 |
nicklas |
31 |
*/ |
5277 |
05 Feb 19 |
nicklas |
32 |
public static boolean copyConsentAnnotations(DbControl dc, Sample from, Sample to, boolean force) |
1524 |
25 Jan 12 |
nicklas |
33 |
{ |
5277 |
05 Feb 19 |
nicklas |
34 |
boolean copiedConsent = Annotationtype.CONSENT.copyAnnotationValues(dc, from, to, force); |
5277 |
05 Feb 19 |
nicklas |
35 |
boolean copiedDate = Annotationtype.CONSENT_DATE.copyAnnotationValues(dc, from, to, force); |
3845 |
14 Apr 16 |
nicklas |
36 |
ProjectArchiveService.getInstance().setForceCheck(); |
5277 |
05 Feb 19 |
nicklas |
37 |
return copiedConsent || copiedDate; |
1524 |
25 Jan 12 |
nicklas |
38 |
} |
1524 |
25 Jan 12 |
nicklas |
39 |
|
2839 |
20 Oct 14 |
olle |
40 |
/** |
2839 |
20 Oct 14 |
olle |
Flag value for the {@link Annotationtype#FLAG} annotation when an |
2839 |
20 Oct 14 |
olle |
item has been flagged to be connected to a retracted consent, |
2839 |
20 Oct 14 |
olle |
or having been erroneously included, without a consent. |
2839 |
20 Oct 14 |
olle |
@since 2.17 |
2839 |
20 Oct 14 |
olle |
45 |
*/ |
2839 |
20 Oct 14 |
olle |
46 |
public static final String FLAG_RETRACTED = "Retracted"; |
2839 |
20 Oct 14 |
olle |
47 |
|
1524 |
25 Jan 12 |
nicklas |
48 |
} |