1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package spcp7.imagegallery.impl.alfresco.utils;
21
22 import java.util.Map;
23
24 import spcp7.imagegallery.abstractionlayer.enums.DefaultProperties;
25 import spcp7.imagegallery.abstractionlayer.exception.PropertyValidationException;
26 import spcp7.imagegallery.abstractionlayer.face.persistence.PropertyModelFace;
27 import spcp7.imagegallery.impl.alfresco.AlfrescoContentRetrievalImpl;
28
29
30
31
32
33
34
35 public class AlfrescoValidation {
36
37 public AlfrescoValidation() {
38
39 }
40
41
42
43
44
45
46
47
48
49
50
51 public void validateAlfrescoQueryProperties(
52 Map<String, PropertyModelFace> properties)
53 throws PropertyValidationException {
54 if (properties != null) {
55 if (!properties
56 .containsKey(DefaultProperties.SPCP7_CURRENT_PATH
57 .toString())) {
58 throw new PropertyValidationException("Property "
59 + DefaultProperties.SPCP7_CURRENT_PATH.toString()
60 + " not found",
61 DefaultProperties.SPCP7_CURRENT_PATH.toString(),
62 "not set");
63
64 }
65 if (!properties
66 .containsKey(AlfrescoDefaultProperties.ALFRESCO_WORKSPACE_STORE
67 .toString())) {
68 throw new PropertyValidationException("Property "
69 + AlfrescoDefaultProperties.ALFRESCO_WORKSPACE_STORE
70 .toString() + " not found",
71 AlfrescoDefaultProperties.ALFRESCO_WORKSPACE_STORE
72 .toString(), "not set");
73
74 }
75 if (!properties
76 .containsKey(AlfrescoDefaultProperties.ALFRESCO_SPACES_STORE
77 .toString())) {
78 throw new PropertyValidationException("Property "
79 + AlfrescoDefaultProperties.ALFRESCO_SPACES_STORE
80 .toString() + " not found",
81 AlfrescoDefaultProperties.ALFRESCO_SPACES_STORE
82 .toString(), "not set");
83
84 }
85 if (!properties
86 .containsKey(AlfrescoDefaultProperties.ALFRESCO_MAX_RESULT_ROWS
87 .toString())) {
88 throw new PropertyValidationException("Property "
89 + AlfrescoDefaultProperties.ALFRESCO_MAX_RESULT_ROWS
90 .toString() + " not found",
91 AlfrescoDefaultProperties.ALFRESCO_MAX_RESULT_ROWS
92 .toString(), "not set");
93
94 }
95 if (!properties
96 .containsKey(AlfrescoDefaultProperties.ALFRESCO_BASE_URL
97 .toString())) {
98 throw new PropertyValidationException("Property "
99 + AlfrescoDefaultProperties.ALFRESCO_BASE_URL
100 .toString() + " not found",
101 AlfrescoDefaultProperties.ALFRESCO_BASE_URL.toString(),
102 "not set");
103
104 }
105 } else {
106 throw new PropertyValidationException(
107 "Property map for validation was null!",
108 "Property map for validation was null!",
109 "Property map for validation was null!");
110 }
111 }
112 }