usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [4/4] usergrid git commit: Added way for applications to be reconnected with organizations and organizations to be reconnected to applications.
Date Fri, 18 Dec 2015 19:35:18 GMT
Added way for applications to be reconnected with organizations and organizations to be reconnected
to applications.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/2627dbbf
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/2627dbbf
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/2627dbbf

Branch: refs/heads/unique_index_logging
Commit: 2627dbbfe7c74b26237f2b5f8b6dedb19347a6d2
Parents: 00c2d05
Author: George Reyes <grey@apache.org>
Authored: Fri Dec 18 11:35:12 2015 -0800
Committer: George Reyes <grey@apache.org>
Committed: Fri Dec 18 11:35:12 2015 -0800

----------------------------------------------------------------------
 .../apache/usergrid/tools/ApplicationAudit.java | 21 ++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/2627dbbf/stack/tools/src/main/java/org/apache/usergrid/tools/ApplicationAudit.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/ApplicationAudit.java b/stack/tools/src/main/java/org/apache/usergrid/tools/ApplicationAudit.java
index 037dc8f..cf702d4 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/ApplicationAudit.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/ApplicationAudit.java
@@ -39,6 +39,7 @@ import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
 import org.apache.usergrid.persistence.Entity;
 import org.apache.usergrid.persistence.EntityManager;
 import org.apache.usergrid.persistence.EntityRef;
+import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.SimpleEntityRef;
 import org.apache.usergrid.persistence.exceptions.EntityNotFoundException;
 import org.apache.usergrid.security.AuthPrincipalType;
@@ -293,12 +294,6 @@ public class ApplicationAudit extends ToolBase {
                         logger.error("Org name: {} and uuid: {}  with App uuid: {} and name:
{} repair has failed.",
                                 new Object[]{organizationInfo.getName(),organizationInfo.getUuid(),applicationUUID,uniqueValue});
                     }
-
-//                    ManagementServiceImpl managementServiceImpl = ( ManagementServiceImpl
) managementService;
-//                    managementServiceImpl.writeUserToken( MANAGEMENT_APPLICATION_ID, applicationEntity,
encryptionService
-//                            .plainTextCredentials( generateOAuthSecretKey( AuthPrincipalType.APPLICATION
), null,
-//                                    MANAGEMENT_APPLICATION_ID ) );
-//                    managementService.addApplicationToOrganization( organizationInfo.getUuid(),
applicationUUID);
                 }
 
 
@@ -320,7 +315,21 @@ public class ApplicationAudit extends ToolBase {
                         logger.error("Org name: {} and uuid: {} is no longer associated with
App uuid: {} and name: {}. Restablishing connection...",
                                 new Object[]{organizationInfo.getName(),organizationInfo.getUuid(),applicationUUID,applicationInfo.getName()});
 
+                        //add the application to organization, then add the organization
to application.
                         managementService.addApplicationToOrganization( organizationInfo.getUuid(),
applicationUUID);
+                        //need to turn this into entity_refs.
+                        em.createConnection(new SimpleEntityRef( "application_info", applicationUUID
) ,"owns",new SimpleEntityRef( "group",organizationInfo.getUuid() ) );
+
+                        organizationInfo = managementService.getOrganizationForApplication(
applicationUUID );
+
+                        if(organizationInfo!=null){
+                            logger.info("Org name: {} and uuid: {} with App uuid: {} and
name: {} connection has been re-established.",
+                                    new Object[]{organizationInfo.getName(),organizationInfo.getUuid(),applicationUUID,applicationInfo.getName()});
+                        }
+                        else{
+                            logger.error("Org name: {} and uuid: {} is no longer associated
with App uuid: {} and name: {}. Could not be re-estabished",
+                                    new Object[]{organizationInfo.getName(),organizationInfo.getUuid(),applicationUUID,applicationInfo.getName()});
+                        }
 
                     }
                 }


Mime
View raw message