View Javadoc
1 /* 2 * Copyright (c) 2003 3 * Information Desire GmbH 4 * All rights reserved. 5 */ 6 package com.infodesire.infobit.dao; 7 8 import com.infodesire.infobit.data.Infobit; 9 import com.infodesire.infobit.data.Version; 10 import com.infodesire.infobit.data.Acl; 11 import com.infodesire.infobit.data.Attributed; 12 13 import java.util.Collection; 14 import java.util.Collections; 15 import java.util.List; 16 import java.util.ArrayList; 17 18 import java.util.Map; 19 import java.util.HashMap; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 /*** 25 * Infobit - just an versioned, secured and attributed chunk of information 26 * 27 * @author konstantin 28 * @created July 29, 2003 29 * @version $Revision: 1.10 $ 30 * @hibernate.class table="infobit" 31 * @hibernate.query name="infobitById" query="from infobit in class 32 * com.infodesire.infobit.dao.InfobitImpl where infobit.name = :name" 33 * @todo implement lifecycle to preven removal of infobit used in 34 * scripts or as templates 35 */ 36 class InfobitImpl extends BaseEntityImpl implements Infobit, Attributed, AttributeSettable { 37 38 /*** 39 */ 40 private static Log _log = LogFactory.getLog(InfobitImpl.class); 41 42 /*** 43 */ 44 private Version _actualVersion; 45 46 /*** 47 */ 48 private String _name; 49 50 /*** 51 */ 52 private AclImpl _acl; 53 54 /*** 55 */ 56 private List _versions = new ArrayList(); 57 58 /*** 59 */ 60 private Map _attributes = new HashMap(); 61 62 63 /*** 64 * @return The ActualVersion value 65 * @hibernate.many-to-one cascade="none" 66 * class="com.infodesire.infobit.dao.VersionImpl" lazy="true" 67 * column="actualversionid" notnull="false" not-null="false" 68 */ 69 public Version getActualVersion() { 70 return _actualVersion; 71 } 72 73 74 75 /*** 76 * @return The Attributes value 77 * @hibernate.map cascade="all" lazy="true" 78 * table="infobit_attributes" 79 * @hibernate.collection-key column="infobitid" 80 * @hibernate.collection-index column="name" type="string" 81 * @hibernate.collection-element column="value" type="string" 82 */ 83 public Map getAttributes() { 84 return _attributes; 85 } 86 87 88 /*** 89 * infobit name is human readable identification of infobit. we assume 90 * immutability by hibernate mapping - thou shall not put this column in 91 * update statement... 92 * 93 * @return The Name value 94 * @hibernate.property unique="true" insert="true" update="false" 95 * not-null="true" 96 */ 97 public String getName() { 98 return _name; 99 } 100 101 102 /*** 103 * @return The Acl value 104 * @hibernate.many-to-one cascade="none" not-null="true" column="aclid" 105 * outer-join="true" class="com.infodesire.infobit.dao.AclImpl" 106 */ 107 public Acl getAcl() { 108 return _acl; 109 } 110 111 112 113 /*** 114 * Gets the Versions attribute of the InfobitImpl object 115 * 116 * @return The Versions value 117 * @hibernate.collection-key column="infobitid" 118 * @hibernate.collection-one-to-many 119 * class="com.infodesire.infobit.dao.VersionImpl" 120 * @hibernate.bag cascade="delete" lazy="true" 121 * order-by="dateMillis desc" 122 */ 123 public List getVersions() { 124 return _versions; 125 } 126 127 128 /*** 129 * provide unmodifiable attrobute map. 130 * 131 * @return Description of the Returned Value 132 */ 133 public Map getAttributeMap() { 134 return Collections.unmodifiableMap(getAttributes()); 135 } 136 137 138 /*** 139 * @param attributes The new Attributes value 140 */ 141 public void setAttributes(Map attributes) { 142 _attributes = attributes; 143 } 144 145 146 /*** 147 * @param actualVersion The new ActualVersion value 148 */ 149 public void setActualVersion(Version actualVersion) { 150 _actualVersion = actualVersion; 151 } 152 153 154 /*** 155 * Sets the Versions attribute of the InfobitImpl object 156 * 157 * @param versions The new Versions value 158 */ 159 public void setVersions(List versions) { 160 _versions = versions; 161 } 162 163 164 /*** 165 * Sets the Name attribute of the Infobit object 166 * 167 * @param name The new Name value 168 */ 169 public void setName(String name) { 170 _name = name; 171 } 172 173 174 /*** 175 * @param acl The new Acl value 176 */ 177 public void setAcl(AclImpl acl) { 178 _acl = acl; 179 } 180 181 182 /*** 183 * Adds a feature to the Version attribute of the InfobitImpl object 184 * 185 * @param version The feature to be added to the Version attribute 186 */ 187 public void addVersion(VersionImpl version) { 188 version.setInfobit(this); 189 getVersions().add(version); 190 } 191 }

This page was automatically generated by Maven