You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/04/06 22:50:57 UTC
[9/9] incubator-usergrid git commit: Minor fix to app delete to
prevent unchecked cast warning.
Minor fix to app delete to prevent unchecked cast warning.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/6ff6d049
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6ff6d049
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6ff6d049
Branch: refs/heads/two-dot-o-dev
Commit: 6ff6d049db72b5fa36c15ba233ae9c98b2349c80
Parents: 2464c62
Author: Dave Johnson <dm...@apigee.com>
Authored: Mon Apr 6 16:50:25 2015 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Mon Apr 6 16:50:25 2015 -0400
----------------------------------------------------------------------
.../corepersistence/CpEntityManagerFactory.java | 22 ++++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6ff6d049/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index c157dc5..7e49231 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -74,6 +74,7 @@ import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import rx.Observable;
+import rx.observables.BlockingObservable;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -316,7 +317,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
managementAppId, edgeType, Long.MAX_VALUE,
SearchByEdgeType.Order.DESCENDING, null));
- appInfoEdges.flatMap(appInfoEdge -> {
+ final Observable<Edge> observable = appInfoEdges.flatMap(appInfoEdge -> {
try {
Entity appInfoToDelete = managementEm.get(appInfoEdge.getTargetNode().getUuid());
final Id deletedAppId = new SimpleId(appInfoToDelete.getUuid(), appInfoToDelete.getType());
@@ -324,6 +325,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
final ApplicationEntityIndex aei = entityIndexFactory.createApplicationEntityIndex(deletedAppScope);
// ensure that there is not already a deleted app with the same name
+
final EntityRef alias = managementEm.getAlias(
CpNamingUtils.DELETED_APPLICATION_INFO, appInfoToDelete.getName());
if (alias != null) {
@@ -334,6 +336,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
final Entity deletedApp = managementEm.create(
CpNamingUtils.DELETED_APPLICATION_INFO, appInfoToDelete.getProperties());
+
// copy its connections too
final Set<String> connectionTypes = managementEm.getConnectionTypes(appInfoToDelete);
@@ -358,17 +361,18 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
return Observable.concat(copyConnections, deleteNodeGraph, deleteAppFromIndex)
.doOnCompleted(() -> {
- try {
- managementEm.delete(appInfoToDelete);
- applicationIdCache.evictAppId(appInfoToDelete.getName());
- }catch (Exception e){
- throw new RuntimeException(e);
- }
- });
+ try {
+ managementEm.delete(appInfoToDelete);
+ applicationIdCache.evictAppId(appInfoToDelete.getName());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
} catch (Exception e) {
throw new RuntimeException(e);
}
- }).toBlocking().lastOrDefault(null);
+ });
+ observable.toBlocking().lastOrDefault(null);
}