001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018: package org.apache.roller.pojos;
019:
020: /**
021: * @author David M Johnson
022: *
023: * @ejb:bean name="FolderAssoc"
024: * @hibernate.class lazy="false" table="folderassoc"
025: * @hibernate.cache usage="read-write"
026: */
027: public class FolderAssoc extends PersistentObject implements Assoc {
028: static final long serialVersionUID = 882325251670705915L;
029: public static final String PARENT = "PARENT";
030: public static final String GRANDPARENT = "GRANDPARENT";
031:
032: private String id;
033: private FolderData folder;
034: private FolderData ancestor;
035: private java.lang.String relation;
036:
037: public FolderAssoc() {
038: }
039:
040: public FolderAssoc(String id, FolderData folder,
041: FolderData ancestor, String relation) {
042: this .id = id;
043: this .folder = folder;
044: this .ancestor = ancestor;
045: this .relation = relation;
046: }
047:
048: public FolderAssoc(FolderAssoc otherData) {
049: setData(otherData);
050: }
051:
052: /**
053: * @ejb:persistent-field
054: * @hibernate.id column="id"
055: * generator-class="uuid.hex" unsaved-value="null"
056: */
057: public java.lang.String getId() {
058: return this .id;
059: }
060:
061: /** @ejb:persistent-field */
062: public void setId(java.lang.String id) {
063: this .id = id;
064: }
065:
066: /**
067: * Setter is needed in RollerImpl.storePersistentObject()
068: */
069: public void setData(
070: org.apache.roller.pojos.PersistentObject otherData) {
071: this .id = otherData.getId();
072: this .folder = ((FolderAssoc) otherData).getFolder();
073: this .ancestor = ((FolderAssoc) otherData).getAncestorFolder();
074: this .relation = ((FolderAssoc) otherData).getRelation();
075: }
076:
077: /**
078: * @ejb:persistent-field
079: * @hibernate.many-to-one column="ancestorid" cascade="none"
080: */
081: public FolderData getAncestorFolder() {
082: return ancestor;
083: }
084:
085: /** @ejb:persistent-field */
086: public void setAncestorFolder(FolderData data) {
087: ancestor = data;
088: }
089:
090: /**
091: * @ejb:persistent-field
092: * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
093: */
094: public FolderData getFolder() {
095: return folder;
096: }
097:
098: /** @ejb:persistent-field */
099: public void setFolder(FolderData data) {
100: folder = data;
101: }
102:
103: /**
104: * @ejb:persistent-field
105: * @hibernate.property column="relation" non-null="true" unique="false"
106: */
107: public java.lang.String getRelation() {
108: return relation;
109: }
110:
111: /** @ejb:persistent-field */
112: public void setRelation(java.lang.String string) {
113: relation = string;
114: }
115:
116: public HierarchicalPersistentObject getObject() {
117: return getFolder();
118: }
119:
120: public void setObject(HierarchicalPersistentObject hpo) {
121: setFolder((FolderData) hpo);
122: }
123:
124: public HierarchicalPersistentObject getAncestor() {
125: return getAncestorFolder();
126: }
127:
128: public void setAncestor(HierarchicalPersistentObject hpo) {
129: setAncestorFolder((FolderData) hpo);
130: }
131:
132: }
|