Code Review
/
nonrtric
/
plt
/
rappmanager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Pass rAppInstanceId to k8s participant and create the invoker with the instance Id
[nonrtric/plt/rappmanager.git]
/
rapp-manager-models
/
src
/
main
/
java
/
com
/
oransc
/
rappmanager
/
models
/
cache
/
RappCacheService.java
diff --git
a/rapp-manager-models/src/main/java/com/oransc/rappmanager/models/cache/RappCacheService.java
b/rapp-manager-models/src/main/java/com/oransc/rappmanager/models/cache/RappCacheService.java
index
d2b273c
..
cdc42c6
100755
(executable)
--- a/
rapp-manager-models/src/main/java/com/oransc/rappmanager/models/cache/RappCacheService.java
+++ b/
rapp-manager-models/src/main/java/com/oransc/rappmanager/models/cache/RappCacheService.java
@@
-18,8
+18,10
@@
package com.oransc.rappmanager.models.cache;
package com.oransc.rappmanager.models.cache;
-import com.oransc.rappmanager.models.Rapp;
-import com.oransc.rappmanager.models.statemachine.RappStateMachine;
+import com.oransc.rappmanager.models.rapp.Rapp;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
@@
-30,19
+32,20
@@
import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class RappCacheService {
@RequiredArgsConstructor
public class RappCacheService {
- private final String RAPP_CACHE = "rapp-cache";
+ private
static
final String RAPP_CACHE = "rapp-cache";
private final CacheManager cacheManager;
private final CacheManager cacheManager;
- private final RappStateMachine rappStateMachine;
- public Cache getAllRapp() {
- return cacheManager.getCache(RAPP_CACHE);
+ public Collection<Rapp> getAllRapp() {
+ Cache cache = cacheManager.getCache(RAPP_CACHE);
+ if(cache != null) {
+ Map<String, Rapp> nativeCache = (Map<String, Rapp>) cache.getNativeCache();
+ return nativeCache.values();
+ }
+ return List.of();
}
public Optional<Rapp> getRapp(String rappId) {
}
public Optional<Rapp> getRapp(String rappId) {
- final Cache cache = cacheManager.getCache(RAPP_CACHE);
- Optional<Rapp> rappOptional = Optional.ofNullable(cache.get(rappId, Rapp.class));
- rappOptional.ifPresent(rapp -> rapp.setState(rappStateMachine.getRappState(rapp.getRappId())));
- return rappOptional;
+ return Optional.ofNullable(cacheManager.getCache(RAPP_CACHE)).map(cache -> cache.get(rappId, Rapp.class));
}
public void putRapp(Rapp rapp) {
}
public void putRapp(Rapp rapp) {