KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > rm > metadata > ProfileValue


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.rm.metadata;
20
21 import java.util.List JavaDoc;
22
23 import org.openharmonise.commons.dsi.*;
24 import org.openharmonise.rm.DataAccessException;
25 import org.openharmonise.rm.resources.AbstractProfiledObject;
26 import org.openharmonise.rm.resources.metadata.properties.*;
27 import org.openharmonise.rm.resources.metadata.properties.ranges.*;
28
29
30 /**
31  * This class represents a <code>Profile</code> which is a value of a profile
32  * property instance. It extends <code>Profile</code> with a different
33  * implementation of <code>getAvailableProperties</code> which is dependant
34  * on the <code>Property</code> which this profile is the value for the
35  * instance of.
36  *
37  * @author Michael Bell
38  * @version $Revision: 1.2 $
39  *
40  */

41 public class ProfileValue extends Profile {
42
43     /**
44      * The <code>Property</code> which this profile is the value for the
45      * instance of
46      */

47     private Property m_prop = null;
48
49     /**
50      * Constructs a <code>ProfileValue</code>
51      *
52      */

53     public ProfileValue() {
54         super();
55     }
56
57     /**
58      * Constructs a <code>ProfileValue</code> with an interface to the data store
59      *
60      * @param dbintrf the data store interface
61      */

62     public ProfileValue(AbstractDataStoreInterface dbintrf) {
63         super(dbintrf);
64
65     }
66
67     /**
68      * Constructs a <code>ProfileValue</code> with an interface to the data store
69      * and a reference to the profiled object which this value is associated to.
70      *
71      * @param dbintrf the data store interface
72      * @param obj the profiled object
73      */

74     public ProfileValue(
75         AbstractDataStoreInterface dbintrf,
76         AbstractProfiledObject obj) {
77         super(dbintrf, obj);
78
79     }
80
81     /**
82      * Constructs an existing <code>ProfileValue</code> with an interface to the
83      * data store, the id of the <code>ProfileValue</code> and a reference to the
84      * profiled object which this value is associated to
85      *
86      * @param dbintrf the data store interface
87      * @param nId the profile id
88      * @param obj the profiled object
89      */

90     public ProfileValue(
91         AbstractDataStoreInterface dbintrf,
92         int nId,
93         AbstractProfiledObject obj) {
94         super(dbintrf, nId, obj);
95
96     }
97
98     /**
99      * Sets the <code>Property</code> this <code>Profile</code> is a value for.
100      *
101      * @param prop the <code>Property</code>
102      */

103     public void setProperty(Property prop) {
104         m_prop = prop;
105     }
106
107     /**
108      * Returns the <code>Property</code> for which this <code>Profile</code>
109      * is a value for.
110      *
111      * @return the <code>Property</code> for which this <code>Profile</code>
112      * is a value for
113      */

114     public Property getProperty() {
115         return m_prop;
116     }
117
118     /* (non-Javadoc)
119      * @see org.openharmonise.rm.metadata.Profile#getAvailableProperties()
120      */

121     public List JavaDoc getAvailableProperties() throws DataAccessException {
122         List JavaDoc props = null;
123         if(m_prop != null) {
124             ProfileRange range = (ProfileRange) m_prop.getRange();
125
126             props = range.getAllowedProperties(m_dsi);
127         } else {
128             props = super.getAvailableProperties();
129         }
130         
131         return props;
132     }
133
134 }
135
Popular Tags