001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.xml.elements;
019:
020: import java.util.HashMap;
021: import java.util.Map;
022:
023: public class ResourceElement {
024:
025: private static final int TEXT = 0;
026:
027: private static final int STRING = 1;
028:
029: private static final int NUMBER = 2;
030:
031: private static final int BINARY = 3;
032:
033: private static final int INVALIDATED = 4;
034:
035: private String data, value, contentType, extension, src,
036: identifier, constraints;
037:
038: private Map supportedCategories = new HashMap();
039:
040: private int type;
041:
042: public void setText(String data) {
043: setData(data);
044: type = TEXT;
045: }
046:
047: public void setString(String data) {
048: setData(data);
049: type = STRING;
050: }
051:
052: public void setNumber(String data) {
053: setData(data);
054: type = NUMBER;
055: }
056:
057: public void setBinary(String data) {
058: type = BINARY;
059: }
060:
061: public void setInvalidated() {
062: type = INVALIDATED;
063: }
064:
065: public boolean isString() {
066: return type == STRING;
067: }
068:
069: public boolean isText() {
070: return type == TEXT;
071: }
072:
073: public boolean isNumber() {
074: return type == NUMBER;
075: }
076:
077: public boolean isBinary() {
078: return type == BINARY;
079: }
080:
081: public boolean isInvalidated() {
082: return type == INVALIDATED;
083: }
084:
085: public void setValue(String value) {
086: setData(value);
087: type = STRING;
088: }
089:
090: public String getValue() {
091: return data;
092: }
093:
094: public void setData(String data) {
095: this .data = data;
096: }
097:
098: public String getData() {
099: return data;
100: }
101:
102: public String getSrc() {
103: return src;
104: }
105:
106: public void setSrc(String src) {
107: this .src = src;
108: }
109:
110: public String getContentType() {
111: return contentType;
112: }
113:
114: public void setContentType(String contentType) {
115: this .contentType = contentType;
116: }
117:
118: public String getExtension() {
119: return extension;
120: }
121:
122: public void setExtension(String extension) {
123: this .extension = extension;
124: }
125:
126: public String getConstraints() {
127: return constraints;
128: }
129:
130: public void setConstraints(String constraints) {
131: this .constraints = constraints;
132: }
133:
134: public String getIdentifier() {
135: return identifier;
136: }
137:
138: public void setIdentifier(String identifier) {
139: this .identifier = identifier;
140: }
141:
142: public void addSupportedCategory(String name, String value) {
143: supportedCategories.put(name, value);
144: }
145:
146: public Map getSupportedCategories() {
147: return supportedCategories;
148: }
149: }
|