~halvdanhg/dhis2/message-fixes

« back to all changes in this revision

Viewing changes to dhis-2/dhis-api/src/main/java/org/hisp/dhis/node/AbstractNode.java

  • Committer: Morten Olav Hansen
  • Date: 2015-01-09 03:27:44 UTC
  • Revision ID: mortenoh@gmail.com-20150109032744-gxdfhmef19jgs3s3
expose Property on Nodes

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
29
29
 */
30
30
 
31
 
import java.util.Collections;
32
 
import java.util.List;
33
 
import java.util.Objects;
34
 
 
 
31
import com.google.common.base.MoreObjects;
 
32
import com.google.common.collect.ImmutableList;
 
33
import com.google.common.collect.Lists;
35
34
import org.hisp.dhis.node.exception.InvalidTypeException;
36
35
import org.hisp.dhis.node.types.SimpleNode;
 
36
import org.hisp.dhis.schema.Property;
37
37
import org.springframework.core.OrderComparator;
38
38
import org.springframework.core.Ordered;
39
39
 
40
 
import com.google.common.base.MoreObjects;
41
 
import com.google.common.collect.ImmutableList;
42
 
import com.google.common.collect.Lists;
 
40
import java.util.Collections;
 
41
import java.util.List;
 
42
import java.util.Objects;
43
43
 
44
44
/**
45
45
 * @author Morten Olav Hansen <mortenoh@gmail.com>
58
58
 
59
59
    protected List<Node> children = Lists.newArrayList();
60
60
 
 
61
    protected Property property;
 
62
 
61
63
    protected AbstractNode( String name, NodeType nodeType )
62
64
    {
63
65
        this.name = name;
64
66
        this.nodeType = nodeType;
65
67
    }
66
68
 
 
69
    protected AbstractNode( String name, NodeType nodeType, Property property )
 
70
    {
 
71
        this.name = name;
 
72
        this.nodeType = nodeType;
 
73
        this.property = property;
 
74
    }
 
75
 
67
76
    @Override
68
77
    public String getName()
69
78
    {
139
148
    }
140
149
 
141
150
    @Override
 
151
    public Property getProperty()
 
152
    {
 
153
        return property;
 
154
    }
 
155
 
 
156
    public void setProperty( Property property )
 
157
    {
 
158
        this.property = property;
 
159
    }
 
160
 
 
161
    public boolean haveProperty()
 
162
    {
 
163
        return property != null;
 
164
    }
 
165
 
 
166
    @Override
142
167
    public <T extends Node> T addChild( T child ) throws InvalidTypeException
143
168
    {
144
169
        if ( child == null || child.getName() == null )