1 16 package org.jmanage.core.config; 17 18 import org.jmanage.core.util.Expression; 19 20 import java.util.List ; 21 import java.util.Iterator ; 22 23 28 public class GraphConfig { 29 30 private String id; 31 private String name; 32 private long pollingInterval; 33 private String yAxisLabel; 35 private Double scaleFactor; 36 private Boolean scaleUp; 37 38 private List attributes; 40 private ApplicationConfig appConfig; 41 42 public static String getNextGraphId(){ 43 return String.valueOf(System.currentTimeMillis()); 44 } 45 46 public GraphConfig(String id, 47 String name, 48 long pollingInterval, 49 ApplicationConfig appConfig, 50 List attributes){ 51 this.id = id; 52 this.name = name; 53 this.pollingInterval = pollingInterval; 54 this.appConfig = appConfig; 55 this.attributes = attributes; 56 } 57 58 public String getId() { 59 return id; 60 } 61 62 public String getName() { 63 return name; 64 } 65 66 public long getPollingInterval() { 67 return pollingInterval; 68 } 69 70 public List getAttributes() { 71 return attributes; 72 } 73 74 public ApplicationConfig getAppConfig() { 75 return appConfig; 76 } 77 78 85 public String getAttributesAsString() { 86 StringBuffer graphAttributes = new StringBuffer (); 87 for(Iterator it=attributes.iterator(); it.hasNext();){ 88 if(graphAttributes.length() > 0){ 89 graphAttributes.append(","); 90 } 91 GraphAttributeConfig attrConfig = (GraphAttributeConfig)it.next(); 92 93 graphAttributes.append("["); 97 Expression expr = new Expression(appConfig.getName(), 98 attrConfig.getMBean(), 99 attrConfig.getAttribute()); 100 graphAttributes.append(expr.toString()); 101 graphAttributes.append("]"); 102 } 103 return graphAttributes.toString(); 104 } 105 106 110 public String getAttributeDisplayNames(){ 111 StringBuffer displayNames = new StringBuffer (); 112 for(Iterator it=attributes.iterator(); it.hasNext();){ 113 if(displayNames.length() > 0){ 114 displayNames.append("|"); 115 } 116 GraphAttributeConfig attrConfig = (GraphAttributeConfig)it.next(); 117 displayNames.append(attrConfig.getDisplayName()); 118 } 119 return displayNames.toString(); 120 } 121 122 public void setName(String name) { 123 this.name = name; 124 } 125 126 public void setPollingInterval(long pollingInterval) { 127 this.pollingInterval = pollingInterval; 128 } 129 130 public void setAttributes(List attributes) { 131 this.attributes = attributes; 132 } 133 134 public void setAppConfig(ApplicationConfig appConfig) { 135 this.appConfig = appConfig; 136 } 137 138 public String getYAxisLabel() { 139 return this.yAxisLabel; 140 } 141 142 public Double getScaleFactor() { 143 return this.scaleFactor; 144 } 145 146 public Boolean isScaleUp() { 147 return this.scaleUp; 148 } 149 150 public void setYAxisLabel(String yAxisLabel) { 151 this.yAxisLabel = yAxisLabel; 152 } 153 154 public void setScaleFactor(Double scaleFactor) { 155 this.scaleFactor = scaleFactor; 156 } 157 158 public void setScaleUp(Boolean scaleUp) { 159 this.scaleUp = scaleUp; 160 } 161 } 162 | Popular Tags |