source: ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/frontend/CMDItemInfo.java @ 5549

Last change on this file since 5549 was 5549, checked in by olhsha@mpi.nl, 10 years ago

Added group service. Tested via the tomcat on loclahots (test URI and postman), old unit tests are adjusted and work well. Todo: retest on localhost tomcat, look at run-time exceptions, add new unit tests, adjust front-end

File size: 2.8 KB
Line 
1package clarin.cmdi.componentregistry.frontend;
2
3import java.io.Serializable;
4
5import clarin.cmdi.componentregistry.MDMarshaller;
6import clarin.cmdi.componentregistry.RegistrySpace;
7import clarin.cmdi.componentregistry.model.BaseDescription;
8
9public class CMDItemInfo implements Serializable {
10
11    private static final long serialVersionUID = 1L;
12
13    private final MDMarshaller marshaller;
14    private String description;
15    private String content;
16    private String name;
17    private boolean forceUpdate = false;
18
19    private DisplayDataNode displayNode;
20
21    private boolean deletable = false;
22    private boolean undeletable = false;
23
24    private boolean editable = false;
25
26    public CMDItemInfo(MDMarshaller marshaller) {
27        this.marshaller = marshaller;
28    }
29   
30    public void setDescription(String descriptionText) {
31        this.description = descriptionText;
32    }
33
34    public String getDescription() {
35        return description;
36    }
37
38    public void setName(String name) {
39        this.name = name;
40    }
41
42    public String getName() {
43        if (displayNode != null) {
44            name = displayNode.toString();
45        }
46        return name;
47    }
48
49    public DisplayDataNode getDataNode() {
50        return displayNode;
51    }
52
53    public void setDataNode(DisplayDataNode dataNode) {
54        this.displayNode = dataNode;
55        setUndeletable(false);
56        setDeletable(false);
57        setEditable(false);
58        setDescription("");
59        setContent("");
60        if (dataNode != null) {
61            BaseDescription desc = dataNode.getDescription();
62            if (desc != null) {
63                String contentDescr = marshaller.marshalToString(desc);
64                setDescription(contentDescr);
65                setEditable(true);
66                if (dataNode.isDeleted()) {
67                    setUndeletable(true);
68                } else {
69                    setDeletable(true);
70                } 
71            }
72        }
73
74    }
75
76    public void setDeletable(boolean deletable) {
77        this.deletable = deletable;
78    }
79
80    public boolean isDeletable() {
81        return deletable;
82    }
83
84    public void setUndeletable(boolean undeletable) {
85        this.undeletable = undeletable;
86    }
87
88    public boolean isUndeletable() {
89        return undeletable;
90    }
91
92    public boolean isEditable() {
93        return editable;
94    }
95
96    public void setEditable(boolean editable) {
97        this.editable = editable;
98    }
99
100   
101    public RegistrySpace getSpace() {
102        return displayNode.getSpace();
103    }
104       
105    public void setForceUpdate(boolean forceUpdate) {
106        this.forceUpdate = forceUpdate;
107    }
108
109    public boolean isForceUpdate() {
110        return forceUpdate;
111    }
112
113    public void setContent(String content) {
114        this.content = content;
115    }
116
117    public String getContent() {
118        return content;
119    }
120
121}
Note: See TracBrowser for help on using the repository browser.