1 13 14 package org.ejbca.ui.cli; 15 16 import java.util.Collection ; 17 import java.util.Iterator ; 18 19 import org.ejbca.core.model.ra.UserDataVO; 20 21 22 23 24 25 32 public class RaListUsersCommand extends BaseRaAdminCommand { 33 38 public RaListUsersCommand(String [] args) { 39 super(args); 40 } 41 42 48 public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException { 49 try { 50 if (args.length < 2) { 51 getOutputStream().println("Usage: RA listusers <status>"); 52 getOutputStream().println( 53 "Status: NEW=10; FAILED=11; INITIALIZED=20; INPROCESS=30; GENERATED=40; HISTORICAL=50"); 54 55 return; 56 } 57 58 int status = Integer.parseInt(args[1]); 59 Collection coll = getAdminSession().findAllUsersByStatus(administrator, status); 60 Iterator iter = coll.iterator(); 61 62 while (iter.hasNext()) { 63 UserDataVO data = (UserDataVO) iter.next(); 64 getOutputStream().println("User: " + data.getUsername() + ", \"" + data.getDN() + 65 "\", \"" + data.getSubjectAltName() + "\", " + data.getEmail() + ", " + 66 data.getStatus() + ", " + data.getType() + ", " + data.getTokenType() + ", " + data.getHardTokenIssuerId()); 67 } 68 } catch (Exception e) { 69 throw new ErrorAdminCommandException(e); 70 } 71 } 72 73 } 75 | Popular Tags |