1 17 package org.alfresco.web.bean.repository; 18 19 import java.util.Collection ; 20 import java.util.Map ; 21 import java.util.Set ; 22 23 import org.alfresco.service.cmr.repository.NodeRef; 24 import org.alfresco.service.cmr.repository.NodeService; 25 26 32 public class MapNode extends Node implements Map <String , Object > 33 { 34 private static final long serialVersionUID = 4051322327734433079L; 35 36 private boolean propsInitialised = false; 37 38 39 44 public MapNode(NodeRef nodeRef) 45 { 46 super(nodeRef); 47 } 48 49 56 public MapNode(NodeRef nodeRef, NodeService nodeService, boolean initProps) 57 { 58 super(nodeRef); 59 if (initProps == true) 60 { 61 getProperties(); 62 } 63 } 64 65 66 69 72 public void clear() 73 { 74 getProperties().clear(); 75 } 76 77 80 public boolean containsKey(Object key) 81 { 82 return getProperties().containsKey(key); 83 } 84 85 88 public boolean containsValue(Object value) 89 { 90 return getProperties().containsKey(value); 91 } 92 93 96 public Set entrySet() 97 { 98 return getProperties().entrySet(); 99 } 100 101 104 public Object get(Object key) 105 { 106 Object obj = null; 107 108 Map <String , Object > props = getProperties(); 111 if (propsInitialised == false) 112 { 113 props.put("id", this.getId()); 115 props.put("name", this.getName()); props.put("nodeRef", this.getNodeRef()); 117 118 propsInitialised = true; 119 } 120 121 return props.get(key); 122 } 123 124 127 public boolean isEmpty() 128 { 129 return getProperties().isEmpty(); 130 } 131 132 135 public Set keySet() 136 { 137 return getProperties().keySet(); 138 } 139 140 143 public Object put(String key, Object value) 144 { 145 return getProperties().put(key, value); 146 } 147 148 151 public void putAll(Map t) 152 { 153 getProperties().putAll(t); 154 } 155 156 159 public Object remove(Object key) 160 { 161 return getProperties().remove(key); 162 } 163 164 167 public int size() 168 { 169 return getProperties().size(); 170 } 171 172 175 public Collection values() 176 { 177 return getProperties().values(); 178 } 179 } 180 | Popular Tags |