1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.businessobjects.environment;
16
17 import org.figure8.join.core.EntityObject;
18
19 import java.util.Date;
20 /**
21 * This is the representation of a resource version. Such version can only be applied
22 * to {@link VersionedResource} (so that is uses {@link VersionedResourceType} in its
23 * constructor).
24 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
25 * @version $Revision: 1.2 $
26 *
27 * @hibernate.class table="join_resourceversions" lazy="true"
28 * @hibernate.cache usage="read-write"
29 *
30 * @hibernate.query name="join.resourceversion_findByType"
31 * query="from ResourceVersion ver where ver.resourceType = :resType"
32 * @hibernate.query name="join.resourceversion_findByName"
33 * query="from ResourceVersion ver left join fetch ver.resourceType where ver.name = :verName"
34 */
35 public class ResourceVersion extends EntityObject{
36
37
38
39 /** This resource version name (should be unique) */
40 private String name;
41 /** This resource version description */
42 private String description;
43 /** This resource version creation date */
44 private Date creationDate;
45
46 /** The type of resources this version can apply to (this impl uses {@link VersionedResourceType} impl) */
47 private VersionedResourceType resourceType;
48
49
50
51
52 /** Creates a new instance of ResourceVersion */
53 public ResourceVersion(){
54 }
55
56 /**
57 * Creates a new instance of ResourceVersion with mandatory attributes
58 * @param name The name of this resource version
59 * @param description The description of this resource version
60 */
61 public ResourceVersion(String name, String description, VersionedResourceType resourceType){
62 this.name = name;
63 this.description = description;
64 this.resourceType = resourceType;
65
66 creationDate = new Date();
67 }
68
69
70
71
72 /**
73 * @hibernate.property column="s_name"
74 * not-null="true" unique="true"
75 * length="50" update="false"
76 * @return The name of this resource version
77 */
78 public String getName(){
79 return name;
80 }
81 /** @param name The name of this resource version */
82 public void setName(String name){
83 this.name = name;
84 }
85
86 /**
87 * @hibernate.property column="s_description" length="255"
88 * @return The description of this resource version
89 */
90 public String getDescription(){
91 return description;
92 }
93 /** @param description The description of this resource version */
94 public void setDescription(String description){
95 this.description = description;
96 }
97
98 /**
99 * @hibernate.property column="d_creation"
100 * not-null="true" type="timestamp"
101 * @return The date of creation of this resource version
102 */
103 public Date getCreationDate(){
104 return creationDate;
105 }
106 /** @param creationDate The date of creation of this resource version */
107 public void setCreationDate(Date creationDate){
108 this.creationDate = creationDate;
109 }
110
111 /**
112 * @hibernate.many-to-one column="n_type_fk" not-null="true"
113 * class="org.figure8.join.businessobjects.environment.VersionedResourceType"
114 * @return The type of this resource
115 */
116 public VersionedResourceType getResourceType(){
117 return resourceType;
118 }
119 /** @param resourceType The type of this resource */
120 public void setResourceType(VersionedResourceType resourceType){
121 this.resourceType = resourceType;
122 }
123
124 }