Package com.alu.e3.prov.restapi.model

Examples of com.alu.e3.prov.restapi.model.Auth


    if (LOG.isDebugEnabled())
      LOG.debug("Update API ID: {}", apiId);

    // check API ID same in Pay-load/URL
    if (api == null || api.getId() == null)
      throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.API_ID_NOT_PROVIDED, "API ID missing in the body for Update operation"));

    if (!api.getId().equals(apiId))
      throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.API_ID_MISMATCH, "API ID not the same in URL vs Body for Update operation: +" + apiId + "/" + apiId));

    Action action = new Action() {
      protected Object doAction(Object... params) {
        try {
          apiService.update(api);
View Full Code Here


    Action action = new Action() {

      protected Object doAction(Object... params) {
        try {
          Api api = apiService.get(apiId);
          return new ApiResponse(ApiResponse.SUCCESS, api);

        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
View Full Code Here

    provisionData.setValidation(fromDataModel(api.getValidation()));
    provisionData.setHeaderTransEnabled(api.getHeaderTransEnabled());
    provisionData.setInternal(api.getInternal());
   
    ApiProxySettings proxySettings = null;
   
    if(api.isUseGlobalProxy()){
      proxySettings = new ApiProxySettings();
      proxySettings.setGlobalProxy(new ApiProxySettings.GlobalProxy());
    }else if(api.getForwardProxy() != null){
      proxySettings = new ApiProxySettings();
      proxySettings.setLocalProxy(fromDataModel(api.getForwardProxy()));
    }
    provisionData.setProxySettings(proxySettings);
   
    return provisionData;
  }
View Full Code Here

        try {
          apiService.create(api);
        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
        return new ApiResponse(ApiResponse.SUCCESS, api.getId());
      }
    };

    return execute(action, (Object) null);
   
View Full Code Here

    Action action = new Action() {
      protected Object doAction(Object... params) {
        try {
          apiService.update(api);
          return new ApiResponse(ApiResponse.SUCCESS, apiId);

        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
      }
View Full Code Here

        try {
          apiService.delete(apiId);
        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
        return new ApiResponse(ApiResponse.SUCCESS, apiId);
      }
    };
    return execute(action, (Object) null);

  }
View Full Code Here

    Action action = new Action() {

      protected Object doAction(Object... params) {
        try {
          Api api = apiService.get(apiId);
          return new ApiResponse(ApiResponse.SUCCESS, api);

        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
      }
View Full Code Here

    Action action = new Action() {

      protected Object doAction(Object... params) {
        try {
          List<String> apiIdsList = apiService.getAll();
          return new ApiResponse(ApiResponse.SUCCESS, apiIdsList);

        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
      }
View Full Code Here

  protected final Action newCreateAction() {
    return new  Action("create") {
      @Override
      protected Object doAction(Object... params) {

        Auth auth = (Auth) params[0];

        if ((auth.getId() == null) || (auth.getId().equals(""))) {
          auth.setId(UUID.randomUUID().toString());
        }

        com.alu.e3.prov.restapi.model.Error error = validate(auth);

        if(LOG.isDebugEnabled())
          LOG.debug("Creating Auth ID: {}", auth.getId());

        AuthResponse response = new AuthResponse(AuthResponse.SUCCESS);
        if(error == null){
          com.alu.e3.data.model.Auth authDataModel = BeanConverterUtil.toDataModel(auth);
          dataManager.addAuth(authDataModel);
          response.setId(auth.getId());
        }
        else{
          error.setErrorCode("400");
          response.setStatus(AuthResponse.FAILURE);
          response.setError(error);
View Full Code Here

  protected final Action newUpdateAction() {
    return new  Action("update") {
      @Override
      protected Object doAction(Object... params) {
        Auth auth = (Auth) params[0];
        String id = (String) params[1];

        if(LOG.isDebugEnabled())
          LOG.debug("Updating Auth ID: {}", id);

        com.alu.e3.prov.restapi.model.Error error = validate(auth);

        if(auth.getId() == null || auth.getId().equals(""))
          auth.setId(id);
        else if(auth.getId().equals(id) == false)
          throw new InvalidParameterException("Auth ID mismatch");

        AuthResponse response = new AuthResponse(AuthResponse.SUCCESS);

        if(error == null){
          com.alu.e3.data.model.Auth authDataModel = BeanConverterUtil.toDataModel(auth);
          dataManager.updateAuth(authDataModel);
          response.setId(auth.getId());
        }
        else{
          error.setErrorCode("400");
          response.setStatus(AuthResponse.FAILURE);
          response.setError(error);
View Full Code Here

TOP

Related Classes of com.alu.e3.prov.restapi.model.Auth

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.