-
Notifications
You must be signed in to change notification settings - Fork 477
/
ConfigurationService.java
223 lines (196 loc) · 7.38 KB
/
ConfigurationService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
* Copyright 2014-2016 CyberVision, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kaaproject.kaa.server.common.dao;
import org.kaaproject.kaa.common.dto.ChangeConfigurationNotification;
import org.kaaproject.kaa.common.dto.ConfigurationDto;
import org.kaaproject.kaa.common.dto.ConfigurationRecordDto;
import org.kaaproject.kaa.common.dto.ConfigurationSchemaDto;
import org.kaaproject.kaa.common.dto.HistoryDto;
import org.kaaproject.kaa.common.dto.VersionDto;
import java.util.Collection;
import java.util.List;
/**
* The interface Configuration service.
*/
public interface ConfigurationService {
/**
* Find latest configuration by application id and configuration major version.
*
* @param applicationId the application id
* @param version the major version of configuration
* @return the configuration dto
*/
ConfigurationDto findConfigurationByAppIdAndVersion(String applicationId, int version);
/**
* Find configuration by group id and configuration major version.
*
* @param endpointGroupId the endpoint group id
* @param version the version
* @return the found configuration object
*/
ConfigurationDto findConfigurationByEndpointGroupIdAndVersion(String endpointGroupId,
int version);
/**
* Find default configuration by configuration schema id.
*
* @param schemaId the schema id
* @return the configuration dto
*/
ConfigurationDto findDefaultConfigurationBySchemaId(String schemaId);
/**
* Find configuration by id.
*
* @param id the id
* @return the configuration dto
*/
ConfigurationDto findConfigurationById(String id);
/**
* Find all configuration records by group id.
*
* @param endpointGroupId the endpoint group id
* @param includeDeprecated the include deprecated
* @return the list of structure records
*/
Collection<ConfigurationRecordDto> findAllConfigurationRecordsByEndpointGroupId(
String endpointGroupId,
boolean includeDeprecated);
/**
* Find configuration record by schema id and group id.
*
* @param schemaId the schema id
* @param endpointGroupId the endpoint group id
* @return the structure record dto
*/
ConfigurationRecordDto findConfigurationRecordBySchemaIdAndEndpointGroupId(
String schemaId,
String endpointGroupId);
/**
* Find all vacant configuration schemas by group id.
* Will be returned schema list where isn't related active or inactive configurations.
*
* @param endpointGroupId the group id
* @return the list of schema objects
*/
List<VersionDto> findVacantSchemasByEndpointGroupId(String endpointGroupId);
/**
* Save configuration. Configuration
*
* @param configurationDto the configuration dto
* @return the configuration dto
*/
ConfigurationDto saveConfiguration(ConfigurationDto configurationDto);
/**
* Activate configuration. Activate existing inactive configuration.
* After that last active configuration will be deactivated.
* Also will be added information to history {@link HistoryService#saveHistory(HistoryDto)}}
*
* @param id the string id
* @param activatedUsername the activated username
* @return the change configuration notification
*/
ChangeConfigurationNotification activateConfiguration(String id, String activatedUsername);
/**
* Deactivate configuration. Deactivate existing active configuration
* and delete if exists inactive.
*
* @param id the id
* @param deactivatedUsername the deactivated username
* @return the change configuration notification
*/
ChangeConfigurationNotification deactivateConfiguration(String id, String deactivatedUsername);
/**
* Delete configuration record.
*
* @param schemaId the configuration schema id
* @param groupId the endpoint group id
* @param deactivatedUsername the deactivated username
* @return the change configuration notification
*/
ChangeConfigurationNotification deleteConfigurationRecord(String schemaId,
String groupId,
String deactivatedUsername);
/**
* Find configurations by endpoint group id.
*
* @param endpointGroupId the endpoint group id
* @return the list
*/
List<ConfigurationDto> findConfigurationsByEndpointGroupId(String endpointGroupId);
/**
* Find conf schemas by application id.
*
* @param applicationId the application id
* @return the list
*/
List<ConfigurationSchemaDto> findConfSchemasByAppId(String applicationId);
/**
* Find configuration schema versions by application id.
*
* @param applicationId the application id
* @return the list
*/
List<VersionDto> findConfigurationSchemaVersionsByAppId(String applicationId);
/**
* Find latest configuration schema by application id and schema version.
*
* @param applicationId the application id
* @param version the version
* @return the configuration schema dto
*/
ConfigurationSchemaDto findConfSchemaByAppIdAndVersion(String applicationId, int version);
/**
* Save Configuration schema.
* Please see {@link ConfigurationService#saveConfSchema(ConfigurationSchemaDto,String)}
*
* @param configurationSchema the configuration schema
* @param groupId group id for generated default configuration based on schema
* @return the configuration schema dto
*/
ConfigurationSchemaDto saveConfSchema(ConfigurationSchemaDto configurationSchema,
String groupId);
/**
* Save Configuration schema. During saving new configuration schema will be generated: <ul>
* <li>Base Schema</li> <li>Override Schema</li> <li>Protocol Schema</li> <li>Base Data -
* Configuration attached to default group</li> </ul> After that will added information
* to history
* {@link HistoryService#saveHistory(HistoryDto historyDto)}
*
* @param configurationSchema the configuration schema
* @return the configuration schema dto
*/
ConfigurationSchemaDto saveConfSchema(ConfigurationSchemaDto configurationSchema);
/**
* Find configuration schema by id.
*
* @param id the id
* @return the configuration schema dto
*/
ConfigurationSchemaDto findConfSchemaById(String id);
/**
* Normalize configuration according to override configuration schema.
*
* @param appId application ID
* @param schemaVersion configuration schema version
* @param configurationBody configuration to validate
*/
String normalizeAccordingToOverrideConfigurationSchema(String appId, int schemaVersion, String configurationBody);
/**
* Remove configuration schemas by application id.
*
* @param appId the application id
*/
void removeConfSchemasByAppId(String appId);
}