1 18 19 package cowsultants.itracker.ejb.client.models; 20 21 import java.io.Serializable ; 22 23 import cowsultants.itracker.ejb.client.util.SystemConfigurationUtilities; 24 25 public class SystemConfigurationModel extends GenericModel { 26 private String version; 27 28 private CustomFieldModel[] customFields = new CustomFieldModel[0]; 29 30 private ConfigurationModel[] resolutions = new ConfigurationModel[0]; 31 private ConfigurationModel[] severities = new ConfigurationModel[0]; 32 private ConfigurationModel[] statuses = new ConfigurationModel[0]; 33 34 public SystemConfigurationModel() { 35 } 36 37 public String getVersion() { 38 return (version == null ? "" : version); 39 } 40 41 public void setVersion(String value) { 42 version = value; 43 } 44 45 public CustomFieldModel[] getCustomFields() { 46 return customFields; 47 } 48 49 public void setCustomFields(CustomFieldModel[] value) { 50 if(value != null) { 51 customFields = value; 52 } 53 } 54 55 public ConfigurationModel[] getResolutions() { 56 return (resolutions == null ? new ConfigurationModel[0] : resolutions); 57 } 58 59 public void setResolutions(ConfigurationModel[] value) { 60 if(value != null) { 61 resolutions = value; 62 } 63 } 64 65 public ConfigurationModel[] getSeverities() { 66 return (severities == null ? new ConfigurationModel[0] : severities); 67 } 68 69 public void setSeverities(ConfigurationModel[] value) { 70 if(value != null) { 71 severities = value; 72 } 73 } 74 75 public ConfigurationModel[] getStatuses() { 76 return (statuses == null ? new ConfigurationModel[0] : statuses); 77 } 78 79 public void setStatuses(ConfigurationModel[] value) { 80 if(value != null) { 81 statuses = value; 82 } 83 } 84 85 public void addConfiguration(ConfigurationModel model) { 86 if(model != null) { 87 ConfigurationModel[] newArray; 88 89 if(model.getType() == SystemConfigurationUtilities.TYPE_RESOLUTION) { 90 newArray = new ConfigurationModel[getResolutions().length + 1]; 91 if(getResolutions().length > 0) { 92 System.arraycopy((Object ) resolutions, 0, (Object ) newArray, 0, resolutions.length); 93 } 94 newArray[getResolutions().length] = model; 95 setResolutions(newArray); 96 } else if(model.getType() == SystemConfigurationUtilities.TYPE_SEVERITY) { 97 newArray = new ConfigurationModel[getSeverities().length + 1]; 98 if(getSeverities().length > 0) { 99 System.arraycopy((Object ) severities, 0, (Object ) newArray, 0, severities.length); 100 } 101 newArray[getSeverities().length] = model; 102 setSeverities(newArray); 103 } else if(model.getType() == SystemConfigurationUtilities.TYPE_STATUS) { 104 newArray = new ConfigurationModel[getStatuses().length + 1]; 105 if(getStatuses().length > 0) { 106 System.arraycopy((Object ) statuses, 0, (Object ) newArray, 0, statuses.length); 107 } 108 newArray[getStatuses().length] = model; 109 setStatuses(newArray); 110 } 111 } 112 } 113 114 public String toString() { 115 StringBuffer buf = new StringBuffer ("SystemConfiguration Version: " + getVersion() + "\n"); 116 buf.append(" Resolutions:"); 117 for(int i = 0; i < resolutions.length; i++) { 118 buf.append(" " + resolutions[i].getName() + "(" + resolutions[i].getValue() + ")"); 119 } 120 buf.append("\n"); 121 buf.append(" Severities:"); 122 for(int i = 0; i < severities.length; i++) { 123 buf.append(" " + severities[i].getName() + "(" + severities[i].getValue() + ")"); 124 } 125 buf.append("\n"); 126 buf.append(" Statuses:"); 127 for(int i = 0; i < statuses.length; i++) { 128 buf.append(" " + statuses[i].getName() + "(" + statuses[i].getValue() + ")"); 129 } 130 buf.append("\n"); 131 132 return buf.toString(); 133 } 134 } 135 | Popular Tags |