001: /*
002: * Copyright 2002-2005 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package info.jtrac.domain;
018:
019: import java.io.Serializable;
020:
021: import static info.jtrac.domain.Field.Name.*;
022:
023: /**
024: * A JTrac installation can be divided into different project
025: * areas or workspaces. The Space entity represents this concept.
026: * The Metdata of a Space determines the type of
027: * Items contained within the space. Users can be mapped to a
028: * space with different access permissions.
029: */
030: public class Space implements Serializable {
031:
032: private long id;
033: private int version;
034: private Integer type;
035: private String prefixCode;
036: private String name;
037: private String description;
038: private boolean guestAllowed;
039: private SpaceSequence spaceSequence;
040: private Metadata metadata;
041:
042: public Space() {
043: spaceSequence = new SpaceSequence();
044: spaceSequence.setSpace(this );
045: metadata = new Metadata();
046: }
047:
048: //=======================================================
049:
050: public int getVersion() {
051: return version;
052: }
053:
054: public void setVersion(int version) {
055: this .version = version;
056: }
057:
058: public SpaceSequence getSpaceSequence() {
059: return spaceSequence;
060: }
061:
062: public void setSpaceSequence(SpaceSequence spaceSequence) {
063: this .spaceSequence = spaceSequence;
064: }
065:
066: public String getPrefixCode() {
067: return prefixCode;
068: }
069:
070: public void setPrefixCode(String prefixCode) {
071: this .prefixCode = prefixCode;
072: }
073:
074: public String getName() {
075: return name;
076: }
077:
078: public void setName(String name) {
079: this .name = name;
080: }
081:
082: public String getDescription() {
083: return description;
084: }
085:
086: public void setDescription(String description) {
087: this .description = description;
088: }
089:
090: public Metadata getMetadata() {
091: return metadata;
092: }
093:
094: public void setMetadata(Metadata metadata) {
095: this .metadata = metadata;
096: }
097:
098: public long getId() {
099: return id;
100: }
101:
102: public void setId(long id) {
103: this .id = id;
104: }
105:
106: public Integer getType() {
107: return type;
108: }
109:
110: public void setType(Integer type) {
111: this .type = type;
112: }
113:
114: public boolean isGuestAllowed() {
115: return guestAllowed;
116: }
117:
118: public void setGuestAllowed(boolean guestAllowed) {
119: this .guestAllowed = guestAllowed;
120: }
121:
122: @Override
123: public String toString() {
124: StringBuffer sb = new StringBuffer();
125: sb.append("id [").append(id);
126: sb.append("]; prefixCode [").append(prefixCode);
127: sb.append("]");
128: return sb.toString();
129: }
130:
131: @Override
132: public boolean equals(Object o) {
133: if (this == o) {
134: return true;
135: }
136: if (!(o instanceof Space)) {
137: return false;
138: }
139: final Space s = (Space) o;
140: return prefixCode.equals(s.getPrefixCode());
141: }
142:
143: @Override
144: public int hashCode() {
145: return prefixCode.hashCode();
146: }
147:
148: }
|