1
|
/**
|
2
|
* Copyright (C) 2016 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.model.metadata;
|
10
|
|
11
|
import eu.etaxonomy.cdm.model.taxon.Classification;
|
12
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
13
|
|
14
|
/**
|
15
|
* @author a.mueller
|
16
|
\* @since 03.06.2016
|
17
|
*
|
18
|
*/
|
19
|
public class PreferenceSubject {
|
20
|
|
21
|
public static final String ROOT = "/";
|
22
|
public static final String SEP = "/";
|
23
|
public static final String VAADIN = "vaadin";
|
24
|
|
25
|
private String subject;
|
26
|
|
27
|
public static PreferenceSubject NewDatabaseInstance(){
|
28
|
return new PreferenceSubject(ROOT);
|
29
|
}
|
30
|
|
31
|
public static PreferenceSubject NewInstance(Classification classification){
|
32
|
return NewInstance(classification.getRootNode());
|
33
|
}
|
34
|
|
35
|
public static PreferenceSubject NewInstance(TaxonNode taxonNode){
|
36
|
String result = ROOT + "TaxonNode[" + taxonNode.treeIndex() + "]" + SEP;
|
37
|
return new PreferenceSubject(result);
|
38
|
}
|
39
|
|
40
|
public static PreferenceSubject NewVaadinInstance(){
|
41
|
return new PreferenceSubject(ROOT + VAADIN + SEP);
|
42
|
}
|
43
|
|
44
|
|
45
|
// *****************************************************/
|
46
|
|
47
|
private PreferenceSubject(String subject){
|
48
|
this.subject = subject;
|
49
|
}
|
50
|
|
51
|
|
52
|
@Override
|
53
|
public String toString() {
|
54
|
return subject;
|
55
|
}
|
56
|
}
|