]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/structure/SimpleSElement.java
Progress on serialized exchanges
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / structure / SimpleSElement.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.argeo.slc.core.structure;
18
19 import java.util.Map;
20 import java.util.TreeMap;
21
22 import org.argeo.slc.core.structure.tree.TreeSPath;
23 import org.argeo.slc.structure.StructureElement;
24
25 /**
26 * Basic implementation of <code>StructureElement</code>.
27 *
28 * @see TreeSPath
29 */
30 public class SimpleSElement implements StructureElement {
31 /** For ORM */
32 private Long tid;
33 private String label;
34 private Map<String, String> tags = new TreeMap<String, String>();
35
36 /** For ORM */
37 public SimpleSElement() {
38 }
39
40 /** Constructor */
41 public SimpleSElement(String label) {
42 this.label = label;
43 }
44
45 /** Constructor */
46 public SimpleSElement(String label, String defaultLabel) {
47 this(label != null ? label : defaultLabel);
48 }
49
50 /** Constructor */
51 public SimpleSElement(SimpleSElement sElement) {
52 setLabel(sElement.getLabel());
53 setTags(new TreeMap<String, String>(sElement.getTags()));
54 }
55
56 public String getLabel() {
57 return label;
58 }
59
60 /** Sets the label. */
61 public void setLabel(String label) {
62 this.label = label;
63 }
64
65 public Long getTid() {
66 return tid;
67 }
68
69 void setTid(Long tid) {
70 this.tid = tid;
71 }
72
73 public Map<String, String> getTags() {
74 return tags;
75 }
76
77 public void setTags(Map<String, String> tags) {
78 this.tags = tags;
79 }
80
81 @Override
82 public SimpleSElement clone() {
83 return new SimpleSElement(this);
84 }
85
86 }