00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 package org.openmobileis.modules.profils.embedded.data;
00030
00031 import java.util.*;
00032
00040 public class EmbeddedProfilRubric {
00041
00042 protected String name;
00043 protected String description;
00044 protected boolean isSelected = false;
00045 protected Hashtable propertiesList;
00046
00047 public EmbeddedProfilRubric() {
00048 propertiesList = new Hashtable(5);
00049 }
00050
00051 public EmbeddedProfilRubric(String rubName, String rubdescription) {
00052 this();
00053 this.name = rubName;
00054 this.description = rubdescription;
00055 }
00056
00057 public void setName (String name) {
00058 this.name = name;
00059 }
00060
00061 public String getName() {
00062 return name;
00063 }
00064
00065 public String getDescription() {
00066 return description;
00067 }
00068
00069 public void setDescription (String description) {
00070 this.description = description;
00071 }
00072
00073 public void addProperty(String key, String value) {
00074 propertiesList.put(key, value);
00075 }
00076
00077 public String getProperty(String key) {
00078 return (String)propertiesList.get(key);
00079 }
00080
00081 public boolean removeProperty(String key) {
00082 return (propertiesList.remove(key) != null);
00083 }
00084
00085 public void setSelection (boolean isSelected) {
00086 this.isSelected = isSelected;
00087 }
00088
00089 public boolean isSelected () {
00090 return isSelected;
00091 }
00092
00093 public String getXmlDescription() {
00094 StringBuffer buffer = new StringBuffer();
00095 buffer.append("<rubric>\n");
00096 buffer.append("<name>");
00097 buffer.append(name);
00098 buffer.append("</name>\n");
00099 buffer.append("<description>");
00100 buffer.append(description);
00101 buffer.append("</description>\n");
00102 if (isSelected)
00103 buffer.append("<selected/>\n");
00104 Enumeration propEnum = propertiesList.keys();
00105 while (propEnum.hasMoreElements()) {
00106 String key = (String) propEnum.nextElement();
00107 buffer.append("<property key=\"").append(key).append("\" value=\"").append(propertiesList.get(key)).append("\"/>\n");
00108 }
00109 buffer.append("</rubric>\n");
00110 return buffer.toString();
00111 }
00112 }