Ejemplo n.º 1
0
 public void list() {
   if (input.parameterNumber() == 0) {
     try {
       realmResultManager.printRealms(realmSyncopeOperations.list());
     } catch (final SyncopeClientException ex) {
       LOG.error("Error listing realm", ex);
       realmResultManager.genericError(ex.getMessage());
     }
   } else {
     realmResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
   }
 }
Ejemplo n.º 2
0
 public void get() {
   if (input.getParameters().length == 1) {
     try {
       final String username = userSyncopeOperations.getUsernameFromId(input.firstParameter());
       userResultManager.genericMessage(input.firstParameter() + " username is " + username);
     } catch (final SyncopeClientException ex) {
       LOG.error("Error getting user", ex);
       userResultManager.genericError(ex.getMessage());
     }
   } else {
     userResultManager.commandOptionError(GET_HELP_MESSAGE);
   }
 }
Ejemplo n.º 3
0
 public void read() {
   if (input.getParameters().length >= 1) {
     for (final String parameter : input.getParameters()) {
       try {
         connectorResultManager.printConnector(connectorSyncopeOperations.read(parameter));
       } catch (final NumberFormatException ex) {
         connectorResultManager.numberFormatException("connector", parameter);
       } catch (final SyncopeClientException | WebServiceException ex) {
         if (ex.getMessage().startsWith("NotFound")) {
           connectorResultManager.notFoundError("Connector", parameter);
         } else {
           connectorResultManager.genericError(ex.getMessage());
         }
       }
     }
   } else {
     connectorResultManager.commandOptionError(READ_HELP_MESSAGE);
   }
 }
Ejemplo n.º 4
0
 public void delete() {
   if (input.parameterNumber() >= 1) {
     for (final String parameter : input.getParameters()) {
       try {
         notificationSyncopeOperations.delete(parameter);
         notificationResultManager.deletedMessage("Notification", parameter);
       } catch (final WebServiceException | SyncopeClientException ex) {
         LOG.error("Error deleting notification", ex);
         if (ex.getMessage().startsWith("NotFound")) {
           notificationResultManager.notFoundError("Notification", parameter);
         } else {
           notificationResultManager.genericError(ex.getMessage());
         }
       } catch (final NumberFormatException ex) {
         notificationResultManager.notBooleanDeletedError("notification", parameter);
       }
     }
   } else {
     notificationResultManager.commandOptionError(DELETE_HELP_MESSAGE);
   }
 }
Ejemplo n.º 5
0
 public void read() {
   if (input.getParameters().length >= 1) {
     final List<RoleTO> roleTOs = new ArrayList<>();
     for (final String parameter : input.getParameters()) {
       try {
         roleTOs.add(roleSyncopeOperations.read(parameter));
       } catch (final SyncopeClientException | WebServiceException ex) {
         LOG.error("Error reading role", ex);
         if (ex.getMessage().startsWith("NotFound")) {
           roleResultManager.notFoundError("Role", parameter);
         } else {
           roleResultManager.genericError(ex.getMessage());
         }
         break;
       } catch (final NumberFormatException ex) {
         LOG.error("Error reading role", ex);
         roleResultManager.numberFormatException("user", parameter);
       }
     }
     roleResultManager.printRoles(roleTOs);
   } else {
     roleResultManager.commandOptionError(READ_HELP_MESSAGE);
   }
 }