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

Commit 5e0bd7a

Browse files
committed
2 parents 80c40d9 + 4ac5112 commit 5e0bd7a

File tree

11 files changed

+89
-646
lines changed

11 files changed

+89
-646
lines changed

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

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

25-
public static final String MANAGE = "/manage";
26-
public static final String MANAGE_CONFIGURATION = "/manage.config";
25+
public static final String DATA_CUSTODIAN_MANAGE = "/management";
26+
public static final String THIRD_PARTY_MANAGE = "/management";
2727

2828
public static final String DATA_CUSTODIAN_API_FEED = "/api/feed";
2929
public static final String DATA_CUSTODIAN_AUTHORIZATION = "/espi/1_1/resource/Authorization/{authorizationId}";
@@ -147,4 +147,3 @@ public static String getDataCustodianRESTSubscriptionGetURL(String subscriptionH
147147
return DATA_CUSTODIAN_REST_SUBSCRIPTION_GET.replace("{subscriptionHashedId}", subscriptionHashedId);
148148
}
149149
}
150-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,6 @@ public void unlink() {
190190
}
191191

192192
public boolean equals (Subscription s) {
193-
return (this.getId() == s.getId());
193+
return (this.getId().equals(s.getId()));
194194
}
195195
}

src/main/java/org/energyos/espi/common/models/atom/ContentType.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,8 @@ public void setResource(IdentifiedObject resource) {
471471
setAuthorization((Authorization) resource);
472472
} else if (resource instanceof Subscription) {
473473
setSubscription((Subscription) resource);
474+
} else if (resource instanceof RetailCustomer) {
475+
setRetailCustomer((RetailCustomer) resource);
474476
}
475477
}
476478

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

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,35 @@
1111

1212
public interface ApplicationInformationService {
1313

14+
/**
15+
* @param kind String indicating [ DATA_CUSTODIAN_ADMIN | THIRD_PARTY | UPLOAD_ADMIN ]
16+
* @return List of ApplicationInformation Resources
17+
*/
1418
public List<ApplicationInformation> findByKind(String kind);
1519

16-
// TODO: likely deprecated
17-
public String feedFor(List<ApplicationInformation> applicationInformations);
18-
19-
public String entryFor(ApplicationInformation applicationInformation);
20-
21-
public ApplicationInformation findById(Long id);
22-
20+
/**
21+
* Find an ApplicationInformation resource by using it's clientId.
22+
*
23+
* @param clientId String uniquely identifying a specific ApplicationInformation.clientI
24+
* @return an ApplicationInformation resource
25+
*/
2326
public ApplicationInformation findByClientId(String clientId);
2427

25-
// public ClientDetails loadClientByClientId(String clientId);
26-
28+
/**
29+
* Find an Application Information resource by using it's dataCustodianId.
30+
*
31+
* @param String dataCustodianClientId
32+
* @return an ApplicationInformation resource
33+
*/
2734
public ApplicationInformation findByDataCustodianClientId(
2835
String dataCustodianClientId);
2936

30-
public List<ApplicationInformation> findAll();
31-
32-
// persistence management services
33-
public void persist(ApplicationInformation applicationInformation);
34-
35-
public void merge(ApplicationInformation applicationInformation);
36-
37-
// accessor services
38-
public ApplicationInformation findByURI(String uri);
39-
40-
public EntryType findEntryType(Long applicationInformationId);
41-
42-
public EntryTypeIterator findEntryTypeIterator();
43-
44-
public void add(ApplicationInformation applicationInformation);
45-
46-
public void delete(ApplicationInformation applicationInformation);
47-
48-
// import-export services
37+
/**
38+
* Import and XML stream, unmarshalling into an ApplicationInformation resource
39+
*
40+
* @param stream
41+
* @return an ApplicationInformation resource
42+
*/
4943
public ApplicationInformation importResource(InputStream stream);
5044

51-
public ApplicationInformation findByUUID(UUID uuid);
52-
53-
public void setApplicationInformation(ApplicationInformation applicationInformation);
54-
55-
public String getDataCustodianResourceEndpoint();
56-
57-
public String getAuthorizationServerTokenEndpoint();
58-
59-
public String getThirdPartyNotifyURI();
60-
6145
}

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

Lines changed: 4 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
noRollbackFor = {javax.persistence.NoResultException.class, org.springframework.dao.EmptyResultDataAccessException.class })
3838

3939
public class ApplicationInformationServiceImpl implements ApplicationInformationService {
40-
41-
// the cached operational object for this service
42-
//
43-
private ApplicationInformation applicationInformation;
4440

4541
@Autowired
4642
private ApplicationInformationRepository applicationInformationRepository;
@@ -50,48 +46,11 @@ public class ApplicationInformationServiceImpl implements ApplicationInformation
5046

5147
@Autowired
5248
private ImportService importService;
53-
54-
@Override
55-
public String getDataCustodianResourceEndpoint() {
56-
if (this.applicationInformation == null) {
57-
// default it to the seed value
58-
this.setApplicationInformation(this.findById(1L));
59-
}
60-
return applicationInformation.getDataCustodianResourceEndpoint();
61-
// return "http://localhost:8080/DataCustodian/espi/1_1/resource";
62-
}
63-
64-
@Override
65-
public String getAuthorizationServerTokenEndpoint() {
66-
if (this.applicationInformation == null) {
67-
// default it to the seed value
68-
this.setApplicationInformation(this.findById(1L));
69-
}
70-
return applicationInformation.getAuthorizationServerTokenEndpoint();
71-
// return "http://localhost:8080/DataCustodian/oauth/token";
72-
}
73-
49+
7450
@Override
7551
public List<ApplicationInformation> findByKind(String kind) {
7652
return applicationInformationRepository.findByKind(kind);
7753
}
78-
79-
80-
@Override
81-
public List<ApplicationInformation> findAll() {
82-
return applicationInformationRepository.findAll();
83-
}
84-
85-
@Override
86-
public ApplicationInformation findById(Long id) {
87-
return applicationInformationRepository.findById(id);
88-
}
89-
90-
91-
@Override
92-
public void persist(ApplicationInformation applicationInformation) {
93-
applicationInformationRepository.persist(applicationInformation);
94-
}
9554

9655
@Override
9756
public ApplicationInformation findByClientId(String clientId) {
@@ -103,86 +62,6 @@ public ApplicationInformation findByDataCustodianClientId(String dataCustodianCl
10362
return applicationInformationRepository.findByDataCustodianClientId(dataCustodianClientId);
10463
}
10564

106-
@Override
107-
public ApplicationInformation findByUUID(UUID uuid) {
108-
return applicationInformationRepository.findByUUID(uuid);
109-
}
110-
111-
// @Override
112-
// public ClientDetails loadClientByClientId(String clientId) {
113-
// return findByClientId(clientId);
114-
// }
115-
116-
@Override
117-
public String feedFor(List<ApplicationInformation> applicationInformations) {
118-
// TODO Auto-generated method stub
119-
return null;
120-
}
121-
122-
@Override
123-
public String entryFor(ApplicationInformation applicationInformation) {
124-
// TODO Auto-generated method stub
125-
return null;
126-
}
127-
128-
@Override
129-
public void add(ApplicationInformation applicationInformation) {
130-
// TODO Auto-generated method stub
131-
132-
}
133-
134-
@Override
135-
public void delete(ApplicationInformation applicationInformation) {
136-
applicationInformationRepository.deleteById(applicationInformation.getId());
137-
138-
}
139-
140-
@Override
141-
public void merge(ApplicationInformation applicationInformation) {
142-
// TODO Auto-generated method stub
143-
144-
}
145-
146-
@Override
147-
public ApplicationInformation findByURI(String uri) {
148-
// TODO Auto-generated method stub
149-
return null;
150-
}
151-
152-
@Override
153-
public EntryType findEntryType(Long applicationInformationId) {
154-
EntryType result = null;
155-
try {
156-
// TODO - this is sub-optimal (but defers the need to understand creation of an EntryType
157-
List<Long> temp = new ArrayList<Long>();
158-
ApplicationInformation applicationInformation = applicationInformationRepository.findById(applicationInformationId);
159-
temp.add(applicationInformation.getId());
160-
result = (new EntryTypeIterator(resourceService, temp, ApplicationInformation.class)).nextEntry(ApplicationInformation.class);
161-
} catch (Exception e) {
162-
// TODO need a log file entry as we are going to return a null if
163-
// it's not found
164-
result = null;
165-
}
166-
return result; // TODO Auto-generated method stub
167-
168-
}
169-
170-
@Override
171-
public EntryTypeIterator findEntryTypeIterator() {
172-
EntryTypeIterator result = null;
173-
try {
174-
// TODO - this is sub-optimal (but defers the need to understand creation of an EntryType
175-
List<Long> temp = new ArrayList<Long>();
176-
temp = applicationInformationRepository.findAllIds();
177-
result = (new EntryTypeIterator(resourceService, temp, ApplicationInformation.class));
178-
} catch (Exception e) {
179-
// TODO need a log file entry as we are going to return a null if
180-
// it's not found
181-
result = null;
182-
}
183-
return result;
184-
}
185-
18665
@Override
18766
public ApplicationInformation importResource(InputStream stream) {
18867

@@ -196,21 +75,6 @@ public ApplicationInformation importResource(InputStream stream) {
19675
return applicationInformation;
19776
}
19877

199-
@Override
200-
public String getThirdPartyNotifyURI() {
201-
ApplicationInformation applicationInformation;
202-
// TODO note the assumption on the first (seed) entry
203-
applicationInformation = resourceService.findById(1L, ApplicationInformation.class);
204-
return applicationInformation.getThirdPartyNotifyUri();
205-
}
206-
207-
public void setApplicationInformation(ApplicationInformation applicationInformation) {
208-
this.applicationInformation = applicationInformation;
209-
}
210-
211-
public ApplicationInformation getApplicationInformation () {
212-
return this.applicationInformation;
213-
}
21478
public void setApplicationInformationRepository(ApplicationInformationRepository applicationInformationRepository) {
21579
this.applicationInformationRepository = applicationInformationRepository;
21680
}
@@ -223,8 +87,9 @@ public void setResourceService(ResourceService resourceService) {
22387
}
22488

22589
public ResourceService getResourceService () {
226-
return this.resourceService;
227-
}
90+
return this.resourceService;
91+
}
92+
22893
public void setImportService(ImportService importService) {
22994
this.importService = importService;
23095
}

0 commit comments

Comments
 (0)