usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [4/5] incubator-usergrid git commit: Print out additional user information: orgs and dictionaries.
Date Mon, 06 Jul 2015 23:46:28 GMT
Print out additional user information: orgs and dictionaries.


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

Branch: refs/heads/master
Commit: 7a951094afdcea4180f7a6e4a96677ef2cf11689
Parents: 59ea6e5
Author: Dave Johnson <snoopdave@apache.org>
Authored: Mon Jul 6 19:20:15 2015 -0400
Committer: Dave Johnson <snoopdave@apache.org>
Committed: Mon Jul 6 19:20:15 2015 -0400

----------------------------------------------------------------------
 .../org/apache/usergrid/tools/UserManager.java  | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7a951094/stack/tools/src/main/java/org/apache/usergrid/tools/UserManager.java
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/java/org/apache/usergrid/tools/UserManager.java b/stack/tools/src/main/java/org/apache/usergrid/tools/UserManager.java
index 0194037..3b5383d 100644
--- a/stack/tools/src/main/java/org/apache/usergrid/tools/UserManager.java
+++ b/stack/tools/src/main/java/org/apache/usergrid/tools/UserManager.java
@@ -17,10 +17,19 @@
 package org.apache.usergrid.tools;
 
 
+import com.google.common.collect.BiMap;
 import org.apache.usergrid.management.UserInfo;
 
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Options;
+import org.apache.usergrid.persistence.EntityManager;
+import org.apache.usergrid.persistence.cassandra.CassandraService;
+import org.apache.usergrid.persistence.entities.User;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
 
 import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString;
 
@@ -48,8 +57,21 @@ public class UserManager extends ToolBase {
             return;
         }
 
+        logger.info("--- User information:");
         logger.info( mapToFormattedJsonString( userInfo ) );
 
+        logger.info("--- User organizations:");
+        final BiMap<UUID, String> orgs = managementService.getOrganizationsForAdminUser(
userInfo.getUuid() );
+        logger.info( mapToFormattedJsonString( orgs ) );
+
+        logger.info("--- User dictionaries:");
+        EntityManager em = emf.getEntityManager( CassandraService.MANAGEMENT_APPLICATION_ID
);
+        User user = em.get( userInfo.getUuid(), User.class );
+        Set<String> dictionaries = em.getDictionaries( user );
+        for (String dictionary : dictionaries) {
+            Map<Object, Object> dict = em.getDictionaryAsMap( user, dictionary );
+            logger.info( dictionary + " : " + mapToFormattedJsonString( dict ) );
+        }
 
         if ( line.hasOption( "p" ) ) {
             String password = line.getOptionValue( "p" );


Mime
View raw message