View Javadoc

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   * Helper class for implementing persistent ResourceTypes.
20   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
21   * @version $Revision: 1.1 $
22   *
23   * @hibernate.class table="join_resourcetypes" lazy="true"
24   * @hibernate.discriminator column="resourcetype_category" type="string" not-null="true"
25   * @hibernate.cache usage="read-write"
26   *
27   * @hibernate.query name="join.resourcetype_findByKey"
28   *    query="from AbstractResourceType type where type.key = :typeKey"
29   */
30  public abstract class AbstractResourceType extends EntityObject implements ResourceType{
31  
32     // Attributes ---------------------------------------------------------------
33  
34     /** The key of this resource type (should be a unique business meaningfull identifier )*/
35     private String key;
36     /** The label of this resource type (should be use for display purpose) */
37     private String label;
38  
39  
40     // Constructors -------------------------------------------------------------
41  
42     /** Creates a new instance of AbstractResourceType */
43     public AbstractResourceType(){
44     }
45  
46     /**
47      * Creates a new instance of AbstractResourceType with mandatory attributes
48      * @param key This new type key (should be unique)
49      * @param label This new type label for display
50      */
51     public AbstractResourceType(String key, String label){
52        this.key = key;
53        this.label = label;
54     }
55  
56  
57     // Public -------------------------------------------------------------------
58  
59     /** @param key This resource type unique key */
60     public void setKey(String key){
61        this.key = key;
62     }
63     /** @param label This resource type display label */
64     public void setLabel(String label){
65        this.label = label;
66     }
67  
68  
69     // Implementation of ResourceType -------------------------------------------
70  
71     /**
72      * @hibernate.property column="s_key"
73      *    not-null="true" unique="true"
74      *    length="10"
75      * @return This resource type unique key
76      */
77     public String getKey(){
78        return key;
79     }
80  
81     /**
82      * @hibernate.property column="s_label"
83      *    not-null="true" unique="true"
84      *    length="40"
85      * @return This resource type label
86      */
87     public String getLabel(){
88        return label;
89     }
90  }
91