Package org.apache.cloudstack.api.response

Examples of org.apache.cloudstack.api.response.UserResponse




    @Override
    public UserResponse newUserResponse(UserAccountJoinVO usr) {
        UserResponse userResponse = new UserResponse();
        userResponse.setAccountId(usr.getAccountUuid());
        userResponse.setAccountName(usr.getAccountName());
        userResponse.setAccountType(usr.getAccountType());
        userResponse.setCreated(usr.getCreated());
        userResponse.setDomainId(usr.getDomainUuid());
        userResponse.setDomainName(usr.getDomainName());
        userResponse.setEmail(usr.getEmail());
        userResponse.setFirstname(usr.getFirstname());
        userResponse.setId(usr.getUuid());
        userResponse.setLastname(usr.getLastname());
        userResponse.setState(usr.getState().toString());
        userResponse.setTimezone(usr.getTimezone());
        userResponse.setUsername(usr.getUsername());
        userResponse.setApiKey(usr.getApiKey());
        userResponse.setSecretKey(usr.getSecretKey());
        userResponse.setIsDefault(usr.isDefault());

        // set async job
        if (usr.getJobId() != null) {
            userResponse.setJobId(usr.getJobUuid());
            userResponse.setJobStatus(usr.getJobStatus());
        }

        userResponse.setObjectName("user");

        return userResponse;
    }
View Full Code Here


    @Override
    public void execute(){
        UserAccount user = _accountService.lockUser(getId());
        if (user != null){
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock user");
        }
    }
View Full Code Here

    public void execute(){
        UserContext.current().setEventDetails("UserId: "+getId());
        UserAccount user = _regionService.enableUser(this);

        if (user != null){
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable user");
        }
    }
View Full Code Here

    @Override
    public void execute(){
        UserAccount result = _accountService.getUserByApiKey(getApiKey());
        if(result != null){
            UserResponse response = _responseGenerator.createUserResponse(result);
            response.setResponseName(getCommandName());
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new InvalidParameterValueException("User with specified API key does not exist");
        }
    }
View Full Code Here

    public void execute(){
        UserContext.current().setEventDetails("UserId: "+getId());
        UserAccount user = _regionService.disableUser(this);

        if (user != null){
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable user");
        }
    }
View Full Code Here

    public void execute(){
        UserContext.current().setEventDetails("UserId: "+getId());
        UserAccount user = _regionService.updateUser(this);

        if (user != null){
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update user");
        }
    }
View Full Code Here

    @Override
    public void execute(){
        UserContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName());
        User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID());
        if (user != null) {
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user");
        }
    }
View Full Code Here

    public void execute() {
        CallContext.current().setEventDetails("UserId: " + getId());
        UserAccount user = _regionService.enableUser(this);

        if (user != null) {
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable user");
        }
    }
View Full Code Here

    @Override
    public void execute() {
        UserAccount result = _accountService.getUserByApiKey(getApiKey());
        if (result != null) {
            UserResponse response = _responseGenerator.createUserResponse(result);
            response.setResponseName(getCommandName());
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new InvalidParameterValueException("User with specified API key does not exist");
        }
    }
View Full Code Here

    public void execute() {
        CallContext.current().setEventDetails("UserId: " + getId());
        UserAccount user = _regionService.disableUser(this);

        if (user != null) {
            UserResponse response = _responseGenerator.createUserResponse(user);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable user");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.api.response.UserResponse

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.