Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SDK / java / org / iotivity / service / ssm / ModelData.java
1 /******************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20 /**
21  * @file    ModelData.java
22  *
23  * @brief    This file provides a class for Model data operations
24  * message
25  *
26  */
27
28 package org.iotivity.service.ssm;
29
30 /**
31  * @class    ModelData
32  * @brief    This class provides a set of API for DataReader class to handle the data
33  *         received by IQueryEngineEvent listeners from SSMCore
34  *
35  */
36 public class ModelData
37 {
38
39         private int pIModelDataInstance;
40
41         public ModelData(int iModelDataInstance)
42         {
43             pIModelDataInstance = iModelDataInstance;
44         }
45
46         /**
47          * Get the affected DataId. ContextModel has plenty of data so returned data is matched 
48          *               from given condition which in this case is the model data object instance
49          *
50          * @return int - the affected DataId
51          * 
52          */
53         public int getDataId()
54         {
55             return CoreController.getInstance().getDataId(pIModelDataInstance);
56         }
57
58         /**
59          * ContextModel has at least one property that contains data \n
60          *           property is described from its specification.
61          *
62          * @return int - number of properties
63          * 
64          */
65         public int getPropertyCount()
66         {
67             return CoreController.getInstance().getPropertyCount(
68                        pIModelDataInstance);
69         }
70
71         /**
72          * Retrieve the name of the property using the given index
73          *
74          * @param propertyIndex 
75          *               - index of property to read
76          *
77          * @return String - property name
78          * 
79          */
80         public String getPropertyName(int propertyIndex)
81         {
82             return CoreController.getInstance().getPropertyName(
83                        pIModelDataInstance, propertyIndex);
84         }
85
86         /**
87          * Retrieve the value of the property using the given index
88          *
89          * @param propertyIndex 
90          *               - index of property to read
91          *
92          * @return String - property value
93          * 
94          */
95         public String getPropertyValue(int propertyIndex)
96         {
97             return CoreController.getInstance().getPropertyValue(
98                        pIModelDataInstance, propertyIndex);
99         }
100 }