Package com.baasbox.commands.exceptions

Examples of com.baasbox.commands.exceptions.CommandExecutionException


                role = roleNode.asText();
            } else {
                throw new CommandParsingException(command,"role parameter is not valid");
            }
            if (!RoleService.exists(role)){
                throw new CommandExecutionException(command,"required role does not exists: "+role);
            }
            JsonNode userVisible = params.get(UserDao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER);
            JsonNode friendsVisible = params.get(UserDao.ATTRIBUTES_VISIBLE_BY_FRIENDS_USER);
            JsonNode registeredVisible = params.get(UserDao.ATTRIBUTES_VISIBLE_BY_REGISTERED_USER);
            JsonNode anonymousVisible = params.get(UserDao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER);

            ODocument user = UserService.signUp(username, password.asText(),
                                                new Date(), role,
                                                anonymousVisible,userVisible,friendsVisible, registeredVisible, false);
            String userNode = JSONFormats.prepareDocToJson(user, JSONFormats.Formats.USER);
            return Json.mapper().readTree(userNode);
        } catch (InvalidJsonException | IOException e) {
            throw new CommandExecutionException(command,"invalid json",e);
        } catch (UserAlreadyExistsException e) {
            return NullNode.getInstance();
        }
    }
View Full Code Here


        try {
            List<ODocument> users = UserService.getUsers(qp, true);
            String response = JSONFormats.prepareDocToJson(users, JSONFormats.Formats.USER);
            return Json.mapper().readTree(response);
        } catch (SqlInjectionException e) {
            throw new CommandExecutionException(command, "error executing command: " + e.getMessage());
        } catch (IOException e) {
            throw new CommandExecutionException(command, "error parsing response: " + e.getMessage());
        }
    }
View Full Code Here

                return NullNode.getInstance();
            }
            String resp = JSONFormats.prepareDocToJson(doc,JSONFormats.Formats.USER);
            return Json.mapper().readTree(resp);
        } catch (SqlInjectionException e) {
            throw new CommandExecutionException(command,"error executing command: "+e.getMessage());
        } catch (IOException e) {
            throw new CommandExecutionException(command,"error parsing response: "+e.getMessage());
        }
    }
View Full Code Here

                return IntNode.valueOf(2);
            } else {
                return IntNode.valueOf(0);
            }
        } catch (Exception e) {
            throw new CommandExecutionException(command,e.getMessage(),e);
        }
    }
View Full Code Here

TOP

Related Classes of com.baasbox.commands.exceptions.CommandExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.