View Javadoc

1   /*
2    * Copyright 2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * 	http://www.osedu.org/licenses/ECL-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the Lic+ense is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.r2.lum.lu.service.impl;
17  
18  import java.util.ArrayList;
19  import java.util.Date;
20  import java.util.LinkedHashMap;
21  import java.util.LinkedHashSet;
22  import java.util.List;
23  import java.util.Map;
24  import java.util.Set;
25  import org.kuali.rice.core.api.criteria.QueryByCriteria;
26  import org.kuali.student.common.util.UUIDHelper;
27  import org.kuali.student.r2.common.dto.ContextInfo;
28  import org.kuali.student.r2.common.dto.MetaInfo;
29  import org.kuali.student.r2.common.dto.StatusInfo;
30  import org.kuali.student.r2.common.dto.ValidationResultInfo;
31  import org.kuali.student.r2.common.exceptions.AlreadyExistsException;
32  import org.kuali.student.r2.common.exceptions.CircularRelationshipException;
33  import org.kuali.student.r2.common.exceptions.DataValidationErrorException;
34  import org.kuali.student.r2.common.exceptions.DependentObjectsExistException;
35  import org.kuali.student.r2.common.exceptions.DoesNotExistException;
36  import org.kuali.student.r2.common.exceptions.IllegalVersionSequencingException;
37  import org.kuali.student.r2.common.exceptions.InvalidParameterException;
38  import org.kuali.student.r2.common.exceptions.MissingParameterException;
39  import org.kuali.student.r2.common.exceptions.OperationFailedException;
40  import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
41  import org.kuali.student.r2.common.exceptions.ReadOnlyException;
42  import org.kuali.student.r2.common.exceptions.UnsupportedActionException;
43  import org.kuali.student.r2.common.exceptions.VersionMismatchException;
44  import org.kuali.student.r2.core.class1.type.dto.TypeInfo;
45  import org.kuali.student.r2.core.search.dto.SearchRequestInfo;
46  import org.kuali.student.r2.core.search.dto.SearchResultInfo;
47  import org.kuali.student.r2.core.versionmanagement.dto.VersionDisplayInfo;
48  import org.kuali.student.r2.core.versionmanagement.dto.VersionInfo;
49  import org.kuali.student.r2.lum.clu.dto.CluCluRelationInfo;
50  import org.kuali.student.r2.lum.clu.dto.CluInfo;
51  import org.kuali.student.r2.lum.clu.dto.CluLoRelationInfo;
52  import org.kuali.student.r2.lum.clu.dto.CluPublicationInfo;
53  import org.kuali.student.r2.lum.clu.dto.CluResultInfo;
54  import org.kuali.student.r2.lum.clu.dto.CluSetInfo;
55  import org.kuali.student.r2.lum.clu.dto.CluSetTreeViewInfo;
56  import org.kuali.student.r2.lum.clu.dto.ResultOptionInfo;
57  import org.kuali.student.r2.lum.clu.service.CluService;
58  
59  public class CluServiceMockImpl implements CluService {
60      // cache variable 
61      // The LinkedHashMap is just so the values come back in a predictable order
62  
63      private Map<String, TypeInfo> typeMap = new LinkedHashMap<String, TypeInfo>();
64      private Map<String, CluInfo> cluMap = new LinkedHashMap<String, CluInfo>();
65      private Map<String, CluCluRelationInfo> cluCluRelationMap = new LinkedHashMap<String, CluCluRelationInfo>();
66      private Map<String, CluPublicationInfo> cluPublicationMap = new LinkedHashMap<String, CluPublicationInfo>();
67      private Map<String, CluResultInfo> cluResultMap = new LinkedHashMap<String, CluResultInfo>();
68      private Map<String, CluLoRelationInfo> cluLoRelationMap = new LinkedHashMap<String, CluLoRelationInfo>();
69      private Map<String, CluSetInfo> cluSetMap = new LinkedHashMap<String, CluSetInfo>();
70      private Map<String, CluSetTreeViewInfo> cluSetTreeViewMap = new LinkedHashMap<String, CluSetTreeViewInfo>();
71      private Map<String, VersionInfo> cluVersionMap = new LinkedHashMap<String, VersionInfo>();
72  
73      public void clear() {
74          this.typeMap.clear();
75          this.cluMap.clear();
76          this.cluCluRelationMap.clear();
77          this.cluPublicationMap.clear();
78          this.cluResultMap.clear();
79          this.cluLoRelationMap.clear();
80          this.cluSetMap.clear();
81          this.cluSetTreeViewMap.clear();
82          this.cluVersionMap.clear();
83      }
84  
85      @Override
86      public List<TypeInfo> getDeliveryMethodTypes(ContextInfo contextInfo)
87              throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
88          // GET_TYPES
89          return new ArrayList<TypeInfo>(typeMap.values());
90      }
91  
92      @Override
93      public TypeInfo getDeliveryMethodType(String deliveryMethodTypeKey, ContextInfo contextInfo)
94              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
95          // GET_TYPE
96          if (!this.typeMap.containsKey(deliveryMethodTypeKey)) {
97              throw new OperationFailedException(deliveryMethodTypeKey);
98          }
99          return this.typeMap.get(deliveryMethodTypeKey);
100     }
101 
102     @Override
103     public List<TypeInfo> getInstructionalFormatTypes(ContextInfo contextInfo)
104             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
105         // GET_TYPES
106         return new ArrayList<TypeInfo>(typeMap.values());
107     }
108 
109     @Override
110     public TypeInfo getInstructionalFormatType(String instructionalFormatTypeKey, ContextInfo contextInfo)
111             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
112         // GET_TYPE
113         if (!this.typeMap.containsKey(instructionalFormatTypeKey)) {
114             throw new OperationFailedException(instructionalFormatTypeKey);
115         }
116         return this.typeMap.get(instructionalFormatTypeKey);
117     }
118 
119     @Override
120     public List<TypeInfo> getLuTypes(ContextInfo contextInfo)
121             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
122         // GET_TYPES
123         return new ArrayList<TypeInfo>(typeMap.values());
124     }
125 
126     @Override
127     public TypeInfo getLuType(String luTypeKey, ContextInfo contextInfo)
128             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
129         // GET_TYPE
130         if (!this.typeMap.containsKey(luTypeKey)) {
131             throw new OperationFailedException(luTypeKey);
132         }
133         return this.typeMap.get(luTypeKey);
134     }
135 
136     @Override
137     public List<TypeInfo> getLuCodeTypes(ContextInfo contextInfo)
138             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
139         // GET_TYPES
140         return new ArrayList<TypeInfo>(typeMap.values());
141     }
142 
143     @Override
144     public TypeInfo getLuCodeType(String luCodeTypeKey, ContextInfo contextInfo)
145             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
146         // GET_TYPE
147         if (!this.typeMap.containsKey(luCodeTypeKey)) {
148             throw new OperationFailedException(luCodeTypeKey);
149         }
150         return this.typeMap.get(luCodeTypeKey);
151     }
152 
153     @Override
154     public List<TypeInfo> getCluCluRelationTypes(ContextInfo contextInfo)
155             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
156         // GET_TYPES
157         return new ArrayList<TypeInfo>(typeMap.values());
158     }
159 
160     @Override
161     public TypeInfo getLuLuRelationType(String cluCluRelationTypeKey, ContextInfo contextInfo)
162             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
163         // GET_TYPE
164         if (!this.typeMap.containsKey(cluCluRelationTypeKey)) {
165             throw new OperationFailedException(cluCluRelationTypeKey);
166         }
167         return this.typeMap.get(cluCluRelationTypeKey);
168     }
169 
170     @Override
171     public List<String> getAllowedLuLuRelationTypesForLuType(String luTypeKey, String relatedLuTypeKey, ContextInfo contextInfo)
172             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
173         // UNKNOWN
174         throw new OperationFailedException("getAllowedLuLuRelationTypesForLuType has not been implemented");
175     }
176 
177     @Override
178     public List<TypeInfo> getLuPublicationTypes(ContextInfo contextInfo)
179             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
180         // GET_TYPES
181         return new ArrayList<TypeInfo>(typeMap.values());
182     }
183 
184     @Override
185     public TypeInfo getLuPublicationType(String luPublicationTypeKey, ContextInfo contextInfo)
186             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
187         // GET_TYPE
188         if (!this.typeMap.containsKey(luPublicationTypeKey)) {
189             throw new OperationFailedException(luPublicationTypeKey);
190         }
191         return this.typeMap.get(luPublicationTypeKey);
192     }
193 
194     @Override
195     public List<String> getLuPublicationTypesForLuType(String luTypeKey, ContextInfo contextInfo)
196             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
197         // UNKNOWN
198         throw new OperationFailedException("getLuPublicationTypesForLuType has not been implemented");
199     }
200 
201     @Override
202     public List<TypeInfo> getCluResultTypes(ContextInfo contextInfo)
203             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
204         // GET_TYPES
205         return new ArrayList<TypeInfo>(typeMap.values());
206     }
207 
208     @Override
209     public TypeInfo getCluResultType(String cluResultTypeKey, ContextInfo contextInfo)
210             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
211         // GET_TYPE
212         if (!this.typeMap.containsKey(cluResultTypeKey)) {
213             throw new OperationFailedException(cluResultTypeKey);
214         }
215         return this.typeMap.get(cluResultTypeKey);
216     }
217 
218     @Override
219     public List<TypeInfo> getCluResultTypesForLuType(String luTypeKey, ContextInfo contextInfo)
220             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
221         // GET_TYPES
222         return new ArrayList<TypeInfo>(typeMap.values());
223     }
224 
225     @Override
226     public List<TypeInfo> getResultUsageTypes(ContextInfo contextInfo)
227             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
228         // GET_TYPES
229         return new ArrayList<TypeInfo>(typeMap.values());
230     }
231 
232     @Override
233     public TypeInfo getResultUsageType(String resultUsageTypeKey, ContextInfo contextInfo)
234             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
235         // GET_TYPE
236         if (!this.typeMap.containsKey(resultUsageTypeKey)) {
237             throw new OperationFailedException(resultUsageTypeKey);
238         }
239         return this.typeMap.get(resultUsageTypeKey);
240     }
241 
242     @Override
243     public List<String> getAllowedResultUsageTypesForLuType(String luTypeKey, ContextInfo contextInfo)
244             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
245         // UNKNOWN
246         throw new OperationFailedException("getAllowedResultUsageTypesForLuType has not been implemented");
247     }
248 
249     @Override
250     public List<String> getAllowedResultComponentTypesForResultUsageType(String resultUsageTypeKey, ContextInfo contextInfo)
251             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
252         // UNKNOWN
253         throw new OperationFailedException("getAllowedResultComponentTypesForResultUsageType has not been implemented");
254     }
255 
256     @Override
257     public List<TypeInfo> getCluLoRelationTypes(ContextInfo contextInfo)
258             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
259         // GET_TYPES
260         return new ArrayList<TypeInfo>(typeMap.values());
261     }
262 
263     @Override
264     public TypeInfo getCluLoRelationType(String cluLoRelationTypeKey, ContextInfo contextInfo)
265             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
266         // GET_TYPE
267         if (!this.typeMap.containsKey(cluLoRelationTypeKey)) {
268             throw new OperationFailedException(cluLoRelationTypeKey);
269         }
270         return this.typeMap.get(cluLoRelationTypeKey);
271     }
272 
273     @Override
274     public List<String> getAllowedCluLoRelationTypesForLuType(String luTypeKey, ContextInfo contextInfo)
275             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
276         // UNKNOWN
277         throw new OperationFailedException("getAllowedCluLoRelationTypesForLuType has not been implemented");
278     }
279 
280     @Override
281     public List<TypeInfo> getCluSetTypes(ContextInfo contextInfo)
282             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
283         // GET_TYPES
284         return new ArrayList<TypeInfo>(typeMap.values());
285     }
286 
287     @Override
288     public TypeInfo getCluSetType(String cluSetTypeKey, ContextInfo contextInfo)
289             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
290         // GET_TYPE
291         if (!this.typeMap.containsKey(cluSetTypeKey)) {
292             throw new OperationFailedException(cluSetTypeKey);
293         }
294         return this.typeMap.get(cluSetTypeKey);
295     }
296 
297     @Override
298     public CluInfo getClu(String cluId, ContextInfo contextInfo)
299             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
300         // GET_BY_ID
301         if (!this.cluMap.containsKey(cluId)) {
302             throw new OperationFailedException(cluId);
303         }
304         return new CluInfo(this.cluMap.get(cluId));
305     }
306 
307     @Override
308     public List<CluInfo> getClusByIds(List<String> cluIds, ContextInfo contextInfo)
309             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
310         // GET_BY_IDS
311         List<CluInfo> list = new ArrayList<CluInfo>();
312         for (String id : cluIds) {
313             list.add(this.getClu(id, contextInfo));
314         }
315         return list;
316     }
317 
318     @Override
319     public List<CluInfo> getClusByLuType(String luTypeKey, String luState, ContextInfo contextInfo)
320             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
321         // GET_INFOS_BY_OTHER
322         List<CluInfo> list = new ArrayList<CluInfo>();
323         for (CluInfo info : cluMap.values()) {
324             if (luTypeKey.equals(info.getTypeKey())) {
325                 if (luState.equals(info.getStateKey())) {
326                     list.add(new CluInfo(info));
327                 }
328             }
329         }
330         return list;
331     }
332 
333     @Override
334     public List<String> getCluIdsByLuType(String luTypeKey, String luState, ContextInfo contextInfo)
335             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
336         // GET_IDS_BY_OTHER
337         List<String> list = new ArrayList<String>();
338         for (CluInfo info : cluMap.values()) {
339             if (luTypeKey.equals(info.getTypeKey())) {
340                 if (luState.equals(info.getStateKey())) {
341                     list.add(info.getId());
342                 }
343             }
344         }
345         return list;
346     }
347 
348     @Override
349     public List<String> getAllowedCluCluRelationTypesByClu(String cluId, String relatedCluId, ContextInfo contextInfo)
350             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
351         List<String> list = new ArrayList<String>();
352         return list;
353     }
354 
355     @Override
356     public List<CluInfo> getClusByRelatedCluAndRelationType(String relatedCluId, String cluCLuRelationTypeKey, ContextInfo contextInfo)
357             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
358         // GET_INFOS_BY_OTHER
359         List<CluInfo> list = new ArrayList<CluInfo>();
360         for (String cluId : this.getCluIdsByRelatedCluAndRelationType(relatedCluId, cluCLuRelationTypeKey, contextInfo)) {
361             list.add(this.getClu(cluId, contextInfo));
362         }
363         return list;
364     }
365 
366     @Override
367     public List<String> getCluIdsByRelatedCluAndRelationType(String relatedCluId, String cluCluRelationTypeKey, ContextInfo contextInfo)
368             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
369         // GET_IDS_BY_OTHER
370         List<String> list = new ArrayList<String>();
371         for (CluCluRelationInfo info : cluCluRelationMap.values()) {
372             if (relatedCluId.equals(info.getRelatedCluId())) {
373                 if (cluCluRelationTypeKey.equals(info.getTypeKey())) {
374                     list.add(info.getCluId());
375                 }
376             }
377         }
378         return list;
379     }
380 
381     @Override
382     public List<CluInfo> getRelatedClusByCluAndRelationType(String cluId, String cluCluRelationTypeKey, ContextInfo contextInfo)
383             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
384         // GET_INFOS_BY_OTHER
385         List<CluInfo> list = new ArrayList<CluInfo>();
386         for (String relatedCluId : this.getRelatedCluIdsByCluAndRelationType(cluId, cluCluRelationTypeKey, contextInfo)) {
387             list.add(this.getClu(relatedCluId, contextInfo));
388         }
389         return list;
390     }
391 
392     @Override
393     public List<String> getRelatedCluIdsByCluAndRelationType(String cluId, String cluCluRelationTypeKey, ContextInfo contextInfo)
394             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
395         // GET_IDS_BY_OTHER
396         List<String> list = new ArrayList<String>();
397         for (CluCluRelationInfo info : cluCluRelationMap.values()) {
398             if (cluId.equals(info.getCluId())) {
399                 if (cluCluRelationTypeKey.equals(info.getTypeKey())) {
400                     list.add(info.getRelatedCluId());
401                 }
402             }
403         }
404         return list;
405     }
406 
407     @Override
408     public CluCluRelationInfo getCluCluRelation(String cluCluRelationId, ContextInfo contextInfo)
409             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
410         // GET_BY_ID
411         if (!this.cluCluRelationMap.containsKey(cluCluRelationId)) {
412             throw new OperationFailedException(cluCluRelationId);
413         }
414         return new CluCluRelationInfo(this.cluCluRelationMap.get(cluCluRelationId));
415     }
416 
417     @Override
418     public List<CluCluRelationInfo> getCluCluRelationsByClu(String cluId, ContextInfo contextInfo)
419             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
420         // GET_INFOS_BY_OTHER
421         List<CluCluRelationInfo> list = new ArrayList<CluCluRelationInfo>();
422         for (CluCluRelationInfo info : cluCluRelationMap.values()) {
423             if (cluId.equals(info.getCluId())) {
424                 list.add(new CluCluRelationInfo(info));
425             }
426         }
427         return list;
428     }
429 
430     @Override
431     public List<CluPublicationInfo> getCluPublicationsByClu(String cluId, ContextInfo contextInfo)
432             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
433         // GET_INFOS_BY_OTHER
434         List<CluPublicationInfo> list = new ArrayList<CluPublicationInfo>();
435         for (CluPublicationInfo info : cluPublicationMap.values()) {
436             if (cluId.equals(info.getCluId())) {
437                 list.add(new CluPublicationInfo(info));
438             }
439         }
440         return list;
441     }
442 
443     @Override
444     public List<CluPublicationInfo> getCluPublicationsByType(String luPublicationTypeKey, ContextInfo contextInfo)
445             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
446         // GET_IDS_BY_TYPE
447         List<CluPublicationInfo> list = new ArrayList<CluPublicationInfo>();
448         for (CluPublicationInfo info : cluPublicationMap.values()) {
449             if (luPublicationTypeKey.equals(info.getTypeKey())) {
450                 list.add(new CluPublicationInfo(info));
451             }
452         }
453         return list;
454     }
455 
456     @Override
457     public CluPublicationInfo getCluPublication(String cluPublicationId, ContextInfo contextInfo)
458             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
459         // GET_BY_ID
460         if (!this.cluPublicationMap.containsKey(cluPublicationId)) {
461             throw new OperationFailedException(cluPublicationId);
462         }
463         return new CluPublicationInfo(this.cluPublicationMap.get(cluPublicationId));
464     }
465 
466     @Override
467     public CluResultInfo getCluResult(String cluResultId, ContextInfo contextInfo)
468             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
469         // GET_BY_ID
470         if (!this.cluResultMap.containsKey(cluResultId)) {
471             throw new OperationFailedException(cluResultId);
472         }
473         return new CluResultInfo(this.cluResultMap.get(cluResultId));
474     }
475 
476     @Override
477     public List<CluResultInfo> getCluResultByClu(String cluId, ContextInfo contextInfo)
478             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
479         // GET_INFOS_BY_OTHER
480         List<CluResultInfo> list = new ArrayList<CluResultInfo>();
481         for (CluResultInfo info : cluResultMap.values()) {
482             if (cluId.equals(info.getCluId())) {
483                 list.add(new CluResultInfo(info));
484             }
485         }
486         return list;
487     }
488 
489     @Override
490     public List<CluResultInfo> getCluResultsByClus(List<String> cluIds, ContextInfo contextInfo)
491             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
492         // GET_INFOS_BY_OTHER
493         List<CluResultInfo> list = new ArrayList<CluResultInfo>();
494         for (CluResultInfo info : cluResultMap.values()) {
495             if (cluIds.contains(info.getCluId())) {
496                 list.add(new CluResultInfo(info));
497             }
498         }
499         return list;
500     }
501 
502     @Override
503     public List<String> getCluIdsByResultUsageType(String resultUsageTypeKey, ContextInfo contextInfo)
504             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
505         // GET_IDS_BY_OTHER
506         Set<String> set = new LinkedHashSet<String>();
507         for (CluResultInfo info : cluResultMap.values()) {
508             for (ResultOptionInfo optInfo : info.getResultOptions()) {
509                 if (resultUsageTypeKey.equals(optInfo.getResultUsageTypeKey())) {
510                     set.add(info.getCluId());
511                 }
512             }
513         }
514         return new ArrayList(set);
515     }
516 
517     @Override
518     public List<String> getCluIdsByResultComponent(String resultComponentId, ContextInfo contextInfo)
519             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
520         // GET_IDS_BY_OTHER
521         Set<String> set = new LinkedHashSet<String>();
522         for (CluResultInfo info : cluResultMap.values()) {
523             for (ResultOptionInfo optInfo : info.getResultOptions()) {
524                 if (resultComponentId.equals(optInfo.getResultComponentId())) {
525                     set.add(info.getCluId());
526                 }
527             }
528         }
529         return new ArrayList(set);
530     }
531 
532     @Override
533     public CluLoRelationInfo getCluLoRelation(String cluLoRelationId, ContextInfo contextInfo)
534             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
535         // GET_BY_ID
536         if (!this.cluLoRelationMap.containsKey(cluLoRelationId)) {
537             throw new OperationFailedException(cluLoRelationId);
538         }
539         return new CluLoRelationInfo(this.cluLoRelationMap.get(cluLoRelationId));
540     }
541 
542     @Override
543     public List<CluLoRelationInfo> getCluLoRelationsByClu(String cluId, ContextInfo contextInfo)
544             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
545         // GET_INFOS_BY_OTHER
546         List<CluLoRelationInfo> list = new ArrayList<CluLoRelationInfo>();
547         for (CluLoRelationInfo info : cluLoRelationMap.values()) {
548             if (cluId.equals(info.getCluId())) {
549                 list.add(new CluLoRelationInfo(info));
550             }
551         }
552         return list;
553     }
554 
555     @Override
556     public List<CluLoRelationInfo> getCluLoRelationsByLo(String loId, ContextInfo contextInfo)
557             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
558         // GET_INFOS_BY_OTHER
559         List<CluLoRelationInfo> list = new ArrayList<CluLoRelationInfo>();
560         for (CluLoRelationInfo info : cluLoRelationMap.values()) {
561             if (loId.equals(info.getLoId())) {
562                 list.add(new CluLoRelationInfo(info));
563             }
564         }
565         return list;
566     }
567 
568     @Override
569     public List<String> getResourceRequirementsForClu(String cluId, ContextInfo contextInfo)
570             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
571         // UNKNOWN
572         throw new OperationFailedException("getResourceRequirementsForClu has not been implemented");
573     }
574 
575     @Override
576     public CluSetInfo getCluSet(String cluSetId, ContextInfo contextInfo)
577             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
578         // GET_BY_ID
579         if (!this.cluSetMap.containsKey(cluSetId)) {
580             throw new OperationFailedException(cluSetId);
581         }
582         return new CluSetInfo(this.cluSetMap.get(cluSetId));
583     }
584 
585     @Override
586     public CluSetTreeViewInfo getCluSetTreeView(String cluSetId, ContextInfo contextInfo)
587             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
588         // GET_BY_ID
589         if (!this.cluSetTreeViewMap.containsKey(cluSetId)) {
590             throw new OperationFailedException(cluSetId);
591         }
592         return new CluSetTreeViewInfo(this.cluSetTreeViewMap.get(cluSetId));
593     }
594 
595     @Override
596     public List<CluSetInfo> getCluSetsByIds(List<String> cluSetIds, ContextInfo contextInfo)
597             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
598         // GET_BY_IDS
599         List<CluSetInfo> list = new ArrayList<CluSetInfo>();
600         for (String id : cluSetIds) {
601             list.add(this.getCluSet(id, contextInfo));
602         }
603         return list;
604     }
605 
606     @Override
607     public List<String> getCluSetIdsFromCluSet(String cluSetId, ContextInfo contextInfo)
608             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
609         // UNKNOWN
610         throw new OperationFailedException("getCluSetIdsFromCluSet has not been implemented");
611     }
612 
613     @Override
614     public Boolean isCluSetDynamic(String cluSetId, ContextInfo contextInfo)
615             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
616         // UNKNOWN
617         throw new OperationFailedException("isCluSetDynamic has not been implemented");
618     }
619 
620     @Override
621     public List<CluInfo> getClusFromCluSet(String cluSetId, ContextInfo contextInfo)
622             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
623         // UNKNOWN
624         throw new OperationFailedException("getClusFromCluSet has not been implemented");
625     }
626 
627     @Override
628     public List<String> getCluIdsFromCluSet(String cluSetId, ContextInfo contextInfo)
629             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
630         // UNKNOWN
631         throw new OperationFailedException("getCluIdsFromCluSet has not been implemented");
632     }
633 
634     @Override
635     public List<CluInfo> getAllClusInCluSet(String cluSetId, ContextInfo contextInfo)
636             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
637         // UNKNOWN
638         throw new OperationFailedException("getAllClusInCluSet has not been implemented");
639     }
640 
641     @Override
642     public List<String> getAllCluIdsInCluSet(String cluSetId, ContextInfo contextInfo)
643             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
644         // UNKNOWN
645         throw new OperationFailedException("getAllCluIdsInCluSet has not been implemented");
646     }
647 
648     @Override
649     public Boolean isCluInCluSet(String cluId, String cluSetId, ContextInfo contextInfo)
650             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
651         // UNKNOWN
652         throw new OperationFailedException("isCluInCluSet has not been implemented");
653     }
654 
655     @Override
656     public List<ValidationResultInfo> validateClu(String validationTypeKey, CluInfo cluInfo, ContextInfo contextInfo)
657             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
658         // VALIDATE
659         return new ArrayList<ValidationResultInfo>();
660     }
661 
662     @Override
663     public CluInfo createClu(String luTypeKey, CluInfo cluInfo, ContextInfo contextInfo)
664             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
665         // CREATE
666         if (!luTypeKey.equals(cluInfo.getTypeKey())) {
667             throw new InvalidParameterException("The type parameter does not match the type on the info object");
668         }
669         CluInfo copy = new CluInfo(cluInfo);
670         if (copy.getId() == null) {
671             copy.setId(UUIDHelper.genStringUUID());
672         }    
673         copy.setMeta(newMeta(contextInfo));
674         VersionInfo versionInfo = new VersionInfo ();
675         versionInfo.setVersionIndId(UUIDHelper.genStringUUID());
676         versionInfo.setVersionComment("Initial Create");
677         versionInfo.setCurrentVersionStart(contextInfo.getCurrentDate());
678         if (versionInfo.getCurrentVersionStart() == null) {
679             versionInfo.setCurrentVersionStart(new Date ());
680         }
681         versionInfo.setSequenceNumber(0l);
682         versionInfo.setVersionedFromId(copy.getId());
683         copy.setVersion(versionInfo);
684         cluMap.put(copy.getId(), copy);
685         return new CluInfo(copy);
686     }
687 
688     @Override
689     public CluInfo updateClu(String cluId, CluInfo cluInfo, ContextInfo contextInfo)
690             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
691         // UPDATE
692         if (!cluId.equals(cluInfo.getId())) {
693             throw new InvalidParameterException("The id parameter does not match the id on the info object");
694         }
695         CluInfo copy = new CluInfo(cluInfo);
696         CluInfo old = this.getClu(cluInfo.getId(), contextInfo);
697         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
698             throw new VersionMismatchException(old.getMeta().getVersionInd());
699         }
700         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
701         this.cluMap.put(cluInfo.getId(), copy);
702         return new CluInfo(copy);
703     }
704 
705     @Override
706     public StatusInfo deleteClu(String cluId, ContextInfo contextInfo)
707             throws DependentObjectsExistException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
708         // DELETE
709         if (this.cluMap.remove(cluId) == null) {
710             throw new OperationFailedException(cluId);
711         }
712         return newStatus();
713     }
714 
715     @Override
716     public CluInfo createNewCluVersion(String cluId, String versionComment, ContextInfo contextInfo)
717             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
718         // CREATE
719         throw new OperationFailedException("createNewCluVersion has not been implemented");
720     }
721 
722     @Override
723     public StatusInfo setCurrentCluVersion(String cluVersionId, Date currentVersionStart, ContextInfo contextInfo)
724             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, IllegalVersionSequencingException, OperationFailedException, PermissionDeniedException {
725         // UNKNOWN
726         throw new OperationFailedException("setCurrentCluVersion has not been implemented");
727     }
728 
729     @Override
730     public CluInfo updateCluState(String cluId, String luState, ContextInfo contextInfo)
731             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
732         // UPDATE
733         throw new OperationFailedException("updateCluState has not been implemented");
734     }
735 
736     @Override
737     public List<ValidationResultInfo> validateCluCluRelation(String validationTypeKey, String cluId, String relatedCluId, String cluCluRelationTypeKey, CluCluRelationInfo cluCluRelationInfo, ContextInfo contextInfo)
738             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
739         // VALIDATE
740         return new ArrayList<ValidationResultInfo>();
741     }
742 
743     @Override
744     public CluCluRelationInfo createCluCluRelation(String cluId, String relatedCluId, String cluCluRelationTypeKey, CluCluRelationInfo cluCluRelationInfo, ContextInfo contextInfo)
745             throws CircularRelationshipException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
746         // CREATE
747         if (!cluCluRelationTypeKey.equals(cluCluRelationInfo.getTypeKey())) {
748             throw new InvalidParameterException("The type parameter does not match the type on the info object");
749         }
750         // TODO: check the rest of the readonly fields that are specified on the create to make sure they match the info object
751         CluCluRelationInfo copy = new CluCluRelationInfo(cluCluRelationInfo);
752         if (copy.getId() == null) {
753             copy.setId(UUIDHelper.genStringUUID());
754         }
755         copy.setMeta(newMeta(contextInfo));
756         cluCluRelationMap.put(copy.getId(), copy);
757         return new CluCluRelationInfo(copy);
758     }
759 
760     @Override
761     public CluCluRelationInfo updateCluCluRelation(String cluCluRelationId, CluCluRelationInfo cluCluRelationInfo, ContextInfo contextInfo)
762             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
763         // UPDATE
764         if (!cluCluRelationId.equals(cluCluRelationInfo.getId())) {
765             throw new InvalidParameterException("The id parameter does not match the id on the info object");
766         }
767         CluCluRelationInfo copy = new CluCluRelationInfo(cluCluRelationInfo);
768         CluCluRelationInfo old = this.getCluCluRelation(cluCluRelationInfo.getId(), contextInfo);
769         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
770             throw new VersionMismatchException(old.getMeta().getVersionInd());
771         }
772         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
773         this.cluCluRelationMap.put(cluCluRelationInfo.getId(), copy);
774         return new CluCluRelationInfo(copy);
775     }
776 
777     @Override
778     public StatusInfo deleteCluCluRelation(String cluCluRelationId, ContextInfo contextInfo)
779             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
780         // DELETE
781         if (this.cluCluRelationMap.remove(cluCluRelationId) == null) {
782             throw new OperationFailedException(cluCluRelationId);
783         }
784         return newStatus();
785     }
786 
787     @Override
788     public List<ValidationResultInfo> validateCluPublication(String validationTypeKey, String cluId, String luPublicationTypeKey, CluPublicationInfo cluPublicationInfo, ContextInfo contextInfo)
789             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
790         // VALIDATE
791         return new ArrayList<ValidationResultInfo>();
792     }
793 
794     @Override
795     public CluPublicationInfo createCluPublication(String cluId, String luPublicationTypeKey, CluPublicationInfo cluPublicationInfo, ContextInfo contextInfo)
796             throws DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
797         // CREATE
798         if (!luPublicationTypeKey.equals(cluPublicationInfo.getTypeKey())) {
799             throw new InvalidParameterException("The type parameter does not match the type on the info object");
800         }
801         // TODO: check the rest of the readonly fields that are specified on the create to make sure they match the info object
802         CluPublicationInfo copy = new CluPublicationInfo(cluPublicationInfo);
803         if (copy.getId() == null) {
804             copy.setId(UUIDHelper.genStringUUID());
805         }
806         copy.setMeta(newMeta(contextInfo));
807         cluPublicationMap.put(copy.getId(), copy);
808         return new CluPublicationInfo(copy);
809     }
810 
811     @Override
812     public CluPublicationInfo updateCluPublication(String cluPublicationId, CluPublicationInfo cluPublicationInfo, ContextInfo contextInfo)
813             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
814         // UPDATE
815         if (!cluPublicationId.equals(cluPublicationInfo.getId())) {
816             throw new InvalidParameterException("The id parameter does not match the id on the info object");
817         }
818         CluPublicationInfo copy = new CluPublicationInfo(cluPublicationInfo);
819         CluPublicationInfo old = this.getCluPublication(cluPublicationInfo.getId(), contextInfo);
820         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
821             throw new VersionMismatchException(old.getMeta().getVersionInd());
822         }
823         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
824         this.cluPublicationMap.put(cluPublicationInfo.getId(), copy);
825         return new CluPublicationInfo(copy);
826     }
827 
828     @Override
829     public StatusInfo deleteCluPublication(String cluPublicationId, ContextInfo contextInfo)
830             throws DoesNotExistException, InvalidParameterException, MissingParameterException, DependentObjectsExistException, OperationFailedException, PermissionDeniedException {
831         // DELETE
832         if (this.cluPublicationMap.remove(cluPublicationId) == null) {
833             throw new OperationFailedException(cluPublicationId);
834         }
835         return newStatus();
836     }
837 
838     @Override
839     public List<ValidationResultInfo> validateCluResult(String validationTypeKey, String cluId, String cluResultTypeKey, CluResultInfo cluResultInfo, ContextInfo contextInfo)
840             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
841         // VALIDATE
842         return new ArrayList<ValidationResultInfo>();
843     }
844 
845     @Override
846     public CluResultInfo createCluResult(String cluId, String cluResultTypeKey, CluResultInfo cluResultInfo, ContextInfo contextInfo)
847             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
848         // CREATE
849         if (!cluResultTypeKey.equals(cluResultInfo.getTypeKey())) {
850             throw new InvalidParameterException("The type parameter does not match the type on the info object");
851         }
852         // TODO: check the rest of the readonly fields that are specified on the create to make sure they match the info object
853         CluResultInfo copy = new CluResultInfo(cluResultInfo);
854         if (copy.getId() == null) {
855             copy.setId(UUIDHelper.genStringUUID());
856         }
857         copy.setMeta(newMeta(contextInfo));
858         cluResultMap.put(copy.getId(), copy);
859         return new CluResultInfo(copy);
860     }
861 
862     @Override
863     public CluResultInfo updateCluResult(String cluResultId, CluResultInfo cluResultInfo, ContextInfo contextInfo)
864             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
865         // UPDATE
866         if (!cluResultId.equals(cluResultInfo.getId())) {
867             throw new InvalidParameterException("The id parameter does not match the id on the info object");
868         }
869         CluResultInfo copy = new CluResultInfo(cluResultInfo);
870         CluResultInfo old = this.getCluResult(cluResultInfo.getId(), contextInfo);
871         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
872             throw new VersionMismatchException(old.getMeta().getVersionInd());
873         }
874         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
875         this.cluResultMap.put(cluResultInfo.getId(), copy);
876         return new CluResultInfo(copy);
877     }
878 
879     @Override
880     public StatusInfo deleteCluResult(String cluResultId, ContextInfo contextInfo)
881             throws DoesNotExistException, InvalidParameterException, MissingParameterException, DependentObjectsExistException, OperationFailedException, PermissionDeniedException {
882         // DELETE
883         if (this.cluResultMap.remove(cluResultId) == null) {
884             throw new OperationFailedException(cluResultId);
885         }
886         return newStatus();
887     }
888 
889     @Override
890     public List<ValidationResultInfo> validateCluLoRelation(String validationTypeKey, String cluId, String loId, String cluLoRelationTypeKey, CluLoRelationInfo cluLoRelationInfo, ContextInfo contextInfo)
891             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
892         // VALIDATE
893         return new ArrayList<ValidationResultInfo>();
894     }
895 
896     @Override
897     public CluLoRelationInfo createCluLoRelation(String cluId, String loId, String cluLoRelationTypeKey, CluLoRelationInfo cluLoRelationInfo, ContextInfo contextInfo)
898             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
899         // CREATE
900         if (!cluLoRelationTypeKey.equals(cluLoRelationInfo.getTypeKey())) {
901             throw new InvalidParameterException("The type parameter does not match the type on the info object");
902         }
903         // TODO: check the rest of the readonly fields that are specified on the create to make sure they match the info object
904         CluLoRelationInfo copy = new CluLoRelationInfo(cluLoRelationInfo);
905         if (copy.getId() == null) {
906             copy.setId(UUIDHelper.genStringUUID());
907         }
908         copy.setMeta(newMeta(contextInfo));
909         cluLoRelationMap.put(copy.getId(), copy);
910         return new CluLoRelationInfo(copy);
911     }
912 
913     @Override
914     public CluLoRelationInfo updateCluLoRelation(String cluLoRelationId, CluLoRelationInfo cluLoRelationInfo, ContextInfo contextInfo)
915             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
916         // UPDATE
917         if (!cluLoRelationId.equals(cluLoRelationInfo.getId())) {
918             throw new InvalidParameterException("The id parameter does not match the id on the info object");
919         }
920         CluLoRelationInfo copy = new CluLoRelationInfo(cluLoRelationInfo);
921         CluLoRelationInfo old = this.getCluLoRelation(cluLoRelationInfo.getId(), contextInfo);
922         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
923             throw new VersionMismatchException(old.getMeta().getVersionInd());
924         }
925         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
926         this.cluLoRelationMap.put(cluLoRelationInfo.getId(), copy);
927         return new CluLoRelationInfo(copy);
928     }
929 
930     @Override
931     public StatusInfo deleteCluLoRelation(String cluLoRelationId, ContextInfo contextInfo)
932             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
933         // DELETE
934         if (this.cluLoRelationMap.remove(cluLoRelationId) == null) {
935             throw new OperationFailedException(cluLoRelationId);
936         }
937         return newStatus();
938     }
939 
940     @Override
941     public StatusInfo addCluResourceRequirement(String resourceTypeKey, String cluId, ContextInfo contextInfo)
942             throws AlreadyExistsException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
943         throw new OperationFailedException("addCluResourceRequirement has not been implemented");
944     }
945 
946     @Override
947     public StatusInfo removeCluResourceRequirement(String resourceTypeKey, String cluId, ContextInfo contextInfo)
948             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
949         throw new OperationFailedException("addCluResourceRequirement has not been implemented");
950     }
951 
952     @Override
953     public List<ValidationResultInfo> validateCluSet(String validationTypeKey, String cluSetTypeKey, CluSetInfo cluSetInfo, ContextInfo contextInfo)
954             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
955         // VALIDATE
956         return new ArrayList<ValidationResultInfo>();
957     }
958 
959     @Override
960     public CluSetInfo createCluSet(String cluSetTypeKey, CluSetInfo cluSetInfo, ContextInfo contextInfo)
961             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, UnsupportedActionException {
962         // CREATE
963         if (!cluSetTypeKey.equals(cluSetInfo.getTypeKey())) {
964             throw new InvalidParameterException("The type parameter does not match the type on the info object");
965         }
966         CluSetInfo copy = new CluSetInfo(cluSetInfo);
967         if (copy.getId() == null) {
968             copy.setId(UUIDHelper.genStringUUID());
969         }
970         copy.setMeta(newMeta(contextInfo));
971         cluSetMap.put(copy.getId(), copy);
972         return new CluSetInfo(copy);
973     }
974 
975     @Override
976     public CluSetInfo updateCluSet(String cluSetId, CluSetInfo cluSetInfo, ContextInfo contextInfo)
977             throws CircularRelationshipException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, UnsupportedActionException, VersionMismatchException {
978         // UPDATE
979         if (!cluSetId.equals(cluSetInfo.getId())) {
980             throw new InvalidParameterException("The id parameter does not match the id on the info object");
981         }
982         CluSetInfo copy = new CluSetInfo(cluSetInfo);
983         CluSetInfo old = this.getCluSet(cluSetInfo.getId(), contextInfo);
984         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
985             throw new VersionMismatchException(old.getMeta().getVersionInd());
986         }
987         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
988         this.cluSetMap.put(cluSetInfo.getId(), copy);
989         return new CluSetInfo(copy);
990     }
991 
992     @Override
993     public StatusInfo deleteCluSet(String cluSetId, ContextInfo contextInfo)
994             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
995         // DELETE
996         if (this.cluSetMap.remove(cluSetId) == null) {
997             throw new OperationFailedException(cluSetId);
998         }
999         return newStatus();
1000     }
1001 
1002     @Override
1003     public StatusInfo addCluSetToCluSet(String cluSetId, String addedCluSetId, ContextInfo contextInfo)
1004             throws CircularRelationshipException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException {
1005         throw new OperationFailedException("addCluSetToCluSet has not been implemented");
1006     }
1007 
1008     @Override
1009     public StatusInfo addCluSetsToCluSet(String cluSetId, List<String> addedCluSetIds, ContextInfo contextInfo)
1010             throws CircularRelationshipException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException {
1011                 throw new OperationFailedException("addCluSetsToCluSet has not been implemented");
1012     }
1013 
1014     @Override
1015     public StatusInfo removeCluSetFromCluSet(String cluSetId, String removedCluSetId, ContextInfo contextInfo)
1016             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException {
1017         throw new OperationFailedException("removeCluSetFromCluSet has not been implemented");
1018     }
1019 
1020     @Override
1021     public StatusInfo addCluToCluSet(String cluId, String cluSetId, ContextInfo contextInfo)
1022             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException {
1023         // ADD
1024         throw new OperationFailedException("addCluToCluSet has not been implemented");
1025     }
1026 
1027     @Override
1028     public StatusInfo addClusToCluSet(List<String> cluSetIds, String cluSetId, ContextInfo contextInfo)
1029             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException {
1030       throw new OperationFailedException("addClusToCluSet has not been implemented");
1031     }
1032 
1033     @Override
1034     public StatusInfo removeCluFromCluSet(String cluId, String cluSetId, ContextInfo contextInfo)
1035             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException {
1036         throw new OperationFailedException("removeCluFromCluSet has not been implemented");
1037     }
1038 
1039     @Override
1040     public List<CluInfo> searchForClus(QueryByCriteria criteria, ContextInfo contextInfo)
1041             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1042         // UNKNOWN
1043         throw new OperationFailedException("searchForClus has not been implemented");
1044     }
1045 
1046     @Override
1047     public List<String> searchForCluIds(QueryByCriteria criteria, ContextInfo contextInfo)
1048             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1049         // UNKNOWN
1050         throw new OperationFailedException("searchForCluIds has not been implemented");
1051     }
1052 
1053     @Override
1054     public List<CluCluRelationInfo> searchForCluCluRelations(QueryByCriteria criteria, ContextInfo contextInfo)
1055             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1056         // UNKNOWN
1057         throw new OperationFailedException("searchForCluCluRelations has not been implemented");
1058     }
1059 
1060     @Override
1061     public List<String> searchForCluCluRelationIds(QueryByCriteria criteria, ContextInfo contextInfo)
1062             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1063         // UNKNOWN
1064         throw new OperationFailedException("searchForCluCluRelationIds has not been implemented");
1065     }
1066 
1067     @Override
1068     public List<CluLoRelationInfo> searchForCluLoRelations(QueryByCriteria criteria, ContextInfo contextInfo)
1069             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1070         // UNKNOWN
1071         throw new OperationFailedException("searchForCluLoRelations has not been implemented");
1072     }
1073 
1074     @Override
1075     public List<String> searchForCluLoRelationIds(QueryByCriteria criteria, ContextInfo contextInfo)
1076             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1077         // UNKNOWN
1078         throw new OperationFailedException("searchForCluLoRelationIds has not been implemented");
1079     }
1080 
1081     @Override
1082     public List<CluPublicationInfo> searchForCluPublications(QueryByCriteria criteria, ContextInfo contextInfo)
1083             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1084         // UNKNOWN
1085         throw new OperationFailedException("searchForCluPublications has not been implemented");
1086     }
1087 
1088     @Override
1089     public List<String> searchForCluPublicationIds(QueryByCriteria criteria, ContextInfo contextInfo)
1090             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1091         // UNKNOWN
1092         throw new OperationFailedException("searchForCluPublicationIds has not been implemented");
1093     }
1094 
1095     @Override
1096     public List<CluResultInfo> searchForCluResults(QueryByCriteria criteria, ContextInfo contextInfo)
1097             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1098         // UNKNOWN
1099         throw new OperationFailedException("searchForCluResults has not been implemented");
1100     }
1101 
1102     @Override
1103     public List<String> searchForCluResultIds(QueryByCriteria criteria, ContextInfo contextInfo)
1104             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1105         // UNKNOWN
1106         throw new OperationFailedException("searchForCluResultIds has not been implemented");
1107     }
1108 
1109     @Override
1110     public List<VersionDisplayInfo> getVersions(String refObjectUri, String refObjectId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1111         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1112     }
1113 
1114     @Override
1115     public VersionDisplayInfo getFirstVersion(String refObjectUri, String refObjectId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1116         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1117     }
1118 
1119     @Override
1120     public VersionDisplayInfo getLatestVersion(String refObjectUri, String refObjectId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1121         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1122     }
1123 
1124     @Override
1125     public VersionDisplayInfo getCurrentVersion(String refObjectUri, String refObjectId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1126         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1127     }
1128 
1129     @Override
1130     public VersionDisplayInfo getVersionBySequenceNumber(String refObjectUri, String refObjectId, Long sequence, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1131         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1132     }
1133 
1134     @Override
1135     public VersionDisplayInfo getCurrentVersionOnDate(String refObjectUri, String refObjectId, Date date, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1136         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1137     }
1138 
1139     @Override
1140     public List<VersionDisplayInfo> getVersionsInDateRange(String refObjectUri, String refObjectId, Date from, Date to, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
1141         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1142     }
1143 
1144     @Override
1145     public List<TypeInfo> getSearchTypes(ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException {
1146         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1147     }
1148 
1149     @Override
1150     public TypeInfo getSearchType(String searchTypeKey, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
1151         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1152     }
1153 
1154     @Override
1155     public SearchResultInfo search(SearchRequestInfo searchRequestInfo, ContextInfo contextInfo) throws MissingParameterException, InvalidParameterException, OperationFailedException, PermissionDeniedException {
1156         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
1157     }
1158 
1159     
1160     
1161     
1162     private StatusInfo newStatus() {
1163         StatusInfo status = new StatusInfo();
1164         status.setSuccess(Boolean.TRUE);
1165         return status;
1166     }
1167 
1168     private MetaInfo newMeta(ContextInfo context) {
1169         MetaInfo meta = new MetaInfo();
1170         meta.setCreateId(context.getPrincipalId());
1171         meta.setCreateTime(new Date());
1172         meta.setUpdateId(context.getPrincipalId());
1173         meta.setUpdateTime(meta.getCreateTime());
1174         meta.setVersionInd("0");
1175         return meta;
1176     }
1177 
1178     private MetaInfo updateMeta(MetaInfo old, ContextInfo context) {
1179         MetaInfo meta = new MetaInfo(old);
1180         meta.setUpdateId(context.getPrincipalId());
1181         meta.setUpdateTime(new Date());
1182         meta.setVersionInd((Integer.parseInt(meta.getVersionInd()) + 1) + "");
1183         return meta;
1184     }
1185 }