1 24 package org.riotfamily.components; 25 26 import java.util.HashMap ; 27 import java.util.Map ; 28 29 34 public class ComponentVersion { 35 36 private Long id; 37 38 private String type; 39 40 private Map properties; 41 42 private boolean dirty; 43 44 private VersionContainer container; 45 46 public ComponentVersion() { 47 } 48 49 public ComponentVersion(String type) { 50 this.type = type; 51 } 52 53 public ComponentVersion(ComponentVersion prototype) { 54 if (prototype != null) { 55 this.type = prototype.getType(); 56 this.container = prototype.getContainer(); 57 this.properties = new HashMap (prototype.getProperties()); 58 } 59 } 60 61 64 public Long getId() { 65 return this.id; 66 } 67 68 71 public void setId(Long id) { 72 this.id = id; 73 } 74 75 79 public String getType() { 80 return this.type; 81 } 82 83 86 public void setType(String type) { 87 this.type = type; 88 setDirty(true); 89 } 90 91 public Map getProperties() { 92 if (properties == null) { 93 properties = new HashMap (); 94 } 95 return properties; 96 } 97 98 public void setProperties(Map properties) { 99 this.properties = properties; 100 } 101 102 public String getProperty(String key) { 103 if (properties == null) { 104 return null; 105 } 106 return (String ) properties.get(key); 107 } 108 109 public void setProperty(String key, String text) { 110 getProperties().put(key, text); 111 setDirty(true); 112 } 113 114 117 public VersionContainer getContainer() { 118 return container; 119 } 120 121 public void setContainer(VersionContainer container) { 122 this.container = container; 123 } 124 125 public boolean isDirty() { 126 return this.dirty; 127 } 128 129 public void setDirty(boolean dirty) { 130 this.dirty = dirty; 131 } 132 133 } 134 | Popular Tags |