Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit ced3630

Browse files
committed
javadoc start
1 parent 83078ef commit ced3630

File tree

3 files changed

+156
-5
lines changed

3 files changed

+156
-5
lines changed

src/main/java/org/energyos/espi/common/domain/Routes.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public class Routes {
2222
public static final String LOGIN = "/login";
2323
public static final String ROOT = "/";
2424

25-
public static final String DATA_CUSTODIAN_MANAGE = "/manage";
26-
public static final String THIRD_PARTY_MANAGE = "/manage";
25+
public static final String MANAGE = "/manage";
26+
public static final String MANAGE_CONFIGURATION = "/manage.config";
27+
2728
public static final String DATA_CUSTODIAN_API_FEED = "/api/feed";
2829
public static final String DATA_CUSTODIAN_AUTHORIZATION = "/espi/1_1/resource/Authorization/{AuthorizationID}";
2930
public static final String DATA_CUSTODIAN_HOME = "/custodian/home";

src/main/java/org/energyos/espi/common/service/ResourceService.java

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.energyos.espi.common.service;
1818

1919
import java.util.List;
20+
import java.util.Map;
2021
import java.util.UUID;
2122

2223
import org.energyos.espi.common.domain.IdentifiedObject;
@@ -34,7 +35,15 @@ public interface ResourceService {
3435
void persist(IdentifiedObject resource);
3536

3637
void flush();
37-
38+
39+
public void setConfigurations(Map<String, String> params);
40+
41+
public void setConfiguration(String key, String value);
42+
43+
public Map<String, String> getConfigurations();
44+
45+
public String getConfiguration(String key);
46+
3847
List<IdentifiedObject> findByAllParentsHref(String relatedHref,
3948
Linkable linkable);
4049

@@ -72,41 +81,152 @@ List<IdentifiedObject> findByAllParentsHref(String relatedHref,
7281
*/
7382
<T extends IdentifiedObject> List<Long> findAllIdsByUsagePointId(Long usagePointId, Class<T> clazz);
7483

84+
/**
85+
* One of the XPath navigators. Class1/mm/Class2/nn/Class3/pp where the input parameters
86+
* provide the obvious mappings to resources.
87+
*
88+
* @param clazz
89+
* @return
90+
*/
7591
<T extends IdentifiedObject> List<Long> findAllIdsByXPath(Class<T> clazz);
7692

93+
/**
94+
* One of the XPath navigators. Class1/mm/Class2/nn/Class3/pp where the input parameters
95+
* provide the obvious mappings to resources.
96+
*
97+
* @param id1 (is either a retail customerId or a subscriptionId or ... any resourceId
98+
* @param clazz
99+
* @return
100+
*/
77101
<T extends IdentifiedObject> List<Long> findAllIdsByXPath(Long id1, Class<T> clazz);
78102

103+
/**
104+
* One of the XPath navigators. Class1/mm/Class2/nn/Class3/pp where the input parameters
105+
* provide the obvious mappings to resources.
106+
*
107+
* @param id1
108+
* @param id2
109+
* @param clazz
110+
* @return a List of Long's == resourceIds of the resultant search
111+
*/
79112
<T extends IdentifiedObject> List<Long> findAllIdsByXPath(Long id1, Long id2, Class<T> clazz);
80113

114+
/**
115+
* One of the XPath navigators. Class1/mm/Class2/nn/Class3/pp where the input parameters
116+
* provide the obvious mappings to resources.
117+
*
118+
* @param id1
119+
* @param id2
120+
* @param id3
121+
* @param clazz
122+
* @return a List of Long's == resourceIds of the resultant search
123+
*/
81124
<T extends IdentifiedObject> List<Long> findAllIdsByXPath(Long id1, Long id2, Long id3, Class<T> clazz);
82125

126+
/**
127+
* @param id1
128+
* @param clazz
129+
* @return a List of Long's == resourceIds of the resultant search
130+
*/
83131
<T extends IdentifiedObject> Long findIdByXPath(Long id1, Class<T> clazz);
84132

133+
/**
134+
* @param id1
135+
* @param id2
136+
* @param clazz
137+
* @return a List of Long's == resourceIds of the resultant search
138+
*/
85139
<T extends IdentifiedObject> Long findIdByXPath(Long id1, Long id2, Class<T> clazz);
86140

141+
/**
142+
* @param id1
143+
* @param id2
144+
* @param id3
145+
* @param clazz
146+
* @return a List of Long's == resourceIds of the resultant search
147+
*/
87148
<T extends IdentifiedObject> Long findIdByXPath(Long id1, Long id2, Long id3, Class<T> clazz);
88149

150+
/**
151+
* @param id1
152+
* @param id2
153+
* @param id3
154+
* @param id4
155+
* @param clazz
156+
* @return a List of Long's == resourceIds of the resultant search
157+
*/
89158
<T extends IdentifiedObject> Long findIdByXPath(Long id1, Long id2, Long id3, Long id4, Class<T> clazz);
90159

160+
/**
161+
* @param clazz
162+
* @return an {@link EntryTypeIterator} that may be used to export the associated resource tree
163+
*
164+
*/
91165
<T extends IdentifiedObject> EntryTypeIterator findEntryTypeIterator(Class<T> clazz);
92166

167+
/**
168+
* @param ids
169+
* @param clazz
170+
* @return
171+
*/
93172
<T extends IdentifiedObject> EntryTypeIterator findEntryTypeIterator(List<Long> ids, Class<T> clazz);
94173

174+
/**
175+
* @param id1
176+
* @param clazz
177+
* @return
178+
*/
95179
<T extends IdentifiedObject> EntryType findEntryType(long id1, Class<T> clazz);
96180

97181
// currently used only finding the Authorization associated with a given resource URI
182+
/**
183+
* @param uri
184+
* @param clazz
185+
* @return
186+
*/
98187
<T extends IdentifiedObject> T findByResourceUri(String uri, Class<T> clazz);
99188

100189
// a collection of interfaces that delete resources (by both XPATH and ROOT form)
101190
//
191+
/**
192+
* @param id
193+
* @param clazz
194+
*/
102195
<T extends IdentifiedObject> void deleteById(Long id, Class<T> clazz);
103196

197+
/**
198+
* @param id1
199+
* @param id2
200+
* @param clazz
201+
*/
202+
/**
203+
* @param id1
204+
* @param id2
205+
* @param clazz
206+
*/
104207
<T extends IdentifiedObject> void deleteByXPathId(Long id1, Long id2,Class<T> clazz);
105208

209+
/**
210+
* @param id1
211+
* @param id2
212+
* @param id3
213+
* @param clazz
214+
*/
106215
<T extends IdentifiedObject> void deleteByXPathId(Long id1, Long id2, Long id3, Class<T> clazz);
107216

217+
/**
218+
* @param id1
219+
* @param id2
220+
* @param id3
221+
* @param id4
222+
* @param clazz
223+
*/
108224
<T extends IdentifiedObject> void deleteByXPathId(Long id1, Long id2, Long id3, Long id4, Class<T> clazz);
109225

226+
/**
227+
* @param existingResource
228+
* @return
229+
*/
110230
<T extends IdentifiedObject> T merge(IdentifiedObject existingResource);
111231

112232
}

src/main/java/org/energyos/espi/common/service/impl/ResourceServiceImpl.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.ArrayList;
2020
import java.util.List;
21+
import java.util.Map;
2122
import java.util.UUID;
2223

2324
import org.energyos.espi.common.domain.Authorization;
@@ -35,7 +36,6 @@
3536
import org.energyos.espi.common.repositories.ResourceRepository;
3637
import org.energyos.espi.common.service.ResourceService;
3738
import org.energyos.espi.common.utils.EntryTypeIterator;
38-
3939
import org.springframework.beans.factory.annotation.Autowired;
4040
import org.springframework.stereotype.Service;
4141
import org.springframework.transaction.annotation.Transactional;
@@ -45,6 +45,16 @@ public class ResourceServiceImpl implements ResourceService {
4545

4646
@Autowired
4747
private ResourceRepository repository;
48+
49+
/**
50+
* A private Map of Key:Value strings to hold the
51+
* dynamic configuration.
52+
*
53+
* SFTPCacheRoot: "./pendingdelivery/"
54+
* AutomaticNotificationPropogation: [true | false]
55+
*
56+
*/
57+
private Map<String, String> params;
4858

4959
@Override
5060
public void persist(IdentifiedObject resource) {
@@ -74,7 +84,7 @@ public List<IdentifiedObject> findAllRelated(Linkable linkable) {
7484

7585
/**
7686
* Returns an list of the resources contained in the primary children collection
77-
* of the a parent resource. The resources are returned within a transactional context
87+
* of the a parent resource. The resources are returned lazily within a transactional context
7888
* allowing for persistent mutation.
7989
*
8090
* @param Long parentResourceID used to retrieve the Resource
@@ -312,4 +322,24 @@ public ResourceRepository getResourceRepository () {
312322
return this.repository;
313323
}
314324

325+
@Override
326+
public void setConfigurations(Map<String, String> params) {
327+
this.params = params;
328+
}
329+
330+
@Override
331+
public String getConfiguration(String key) {
332+
return this.params.get(key);
333+
}
334+
335+
@Override
336+
public void setConfiguration(String key, String value) {
337+
this.params.put(key, value);
338+
}
339+
340+
@Override
341+
public Map<String, String> getConfigurations() {
342+
return this.params;
343+
}
344+
315345
}

0 commit comments

Comments
 (0)