1 package org.infoglue.cms.util.validators; 2 3 import java.util.Collection ; 4 import java.util.HashMap ; 5 import java.util.Iterator ; 6 import java.util.List ; 7 import java.util.Map ; 8 import java.util.Set ; 9 10 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController; 11 import org.infoglue.cms.controllers.kernel.impl.simple.ContentVersionController; 12 import org.infoglue.cms.entities.content.ContentVersionVO; 13 import org.infoglue.cms.entities.management.ContentTypeAttribute; 14 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO; 15 16 public class ContentVersionBean implements Map { 17 private Map delegate = new HashMap (); 18 19 public ContentVersionBean(ContentTypeDefinitionVO contentType, ContentVersionVO contentVersionVO) { 20 List contentTypeAttributes = ContentTypeDefinitionController.getController().getContentTypeAttributes(contentType.getSchemaValue()); 21 for(Iterator i=contentTypeAttributes.iterator(); i.hasNext();) { 22 ContentTypeAttribute attribute = (ContentTypeAttribute) i.next(); 23 String name = attribute.getName(); 24 String value = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionVO, name, false); 25 delegate.put(name, value); 26 } 27 } 28 29 public Object get(Object key) { return delegate.get(key); } 31 public int size() { return delegate.size(); } 32 public boolean isEmpty() { return delegate.isEmpty(); } 33 public boolean containsKey(Object key) { return delegate.containsKey(key); } 34 public boolean containsValue(Object value) { return delegate.containsValue(value); } 35 public Object put(Object key, Object value) { return null; } 36 public void putAll(Map t) {} 37 public Object remove(Object key) { return null; } 38 public void clear() {} 39 public Set keySet() { return delegate.keySet(); } 40 public Collection values() { return delegate.values(); } 41 public Set entrySet() { return delegate.entrySet(); } 42 public boolean equals(Object o) { return delegate.equals(o); } 43 public int hashCode() { return delegate.hashCode(); } 44 } 45 | Popular Tags |