Package com.alu.e3.common

Examples of com.alu.e3.common.InvalidIDException


          LOG.debug("Getting Policy:", policyId);
        }

        com.alu.e3.data.model.Policy policyDataModel = dataManager.getPolicyById(policyId);
        if(policyDataModel == null)
          throw new InvalidIDException("A Policy with that ID does not exist");

        Policy policy = BeanConverterUtil.fromDataModel(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setPolicy(policy);
View Full Code Here


  }

  private boolean checkUpdate(Api api) {
    // check api ID already exist
    if (api.getId() == null || !dataManager.isApiExist(api.getId())) {
      throw new InvalidIDException("An API with that ID does not exist");
    }
   
    //call checkCreateUpdate to perform the common checks
    boolean canCreateJarFile = checkCreateUpdate(api);
View Full Code Here

  @Override
  public void updateApi(Api api) throws InvalidIDException {

    Api oldApi = cachingTableApi.get(api.getId());
    if (oldApi == null)
      throw new InvalidIDException("An API with that ID [" + api.getId() + "] doesn't exist");

    // Remove all contexts and bucket ids
    for (ApiIds apiIds : oldApi.getContextIds()) {
      cachingTableContext.remove(Integer.valueOf(apiIds.getApiContextId()));
      usedBucketIds.remove(Integer.valueOf(apiIds.getApiBucketId()));
View Full Code Here

    Api api = cachingTableApi.remove(id);

    ApiDetail detail = cachingTableApiDetails.remove(id);

    if (api == null) {
      throw new InvalidIDException("An API with that ID [" + id + "] doesn't exist");
    }

    // Find the policies associated, and remove this API
    for (String policyId : api.getPolicyIds()) {
      Policy policy = getPolicyById(policyId);
View Full Code Here

  public Api getApiById(String id, boolean getFullDetails) throws InvalidIDException {

    Api api = cachingTableApi.get(id);

    if (api == null) {
      throw new InvalidIDException("An API with that ID [" + id + "] doesn't exist");
    }

    if (getFullDetails) {

      ApiDetail details = cachingTableApiDetails.get(id);
View Full Code Here

  public void updateAuth(Auth auth) throws InvalidIDException {

    // Get old Auth
    String oldAuthToken = cachingTableAuthIdToAuthToken.get(auth.getId());
    if (oldAuthToken == null)
      throw new InvalidIDException("An authorization with that ID [" + auth.getId() + "] doesn't exist");

    // For each IP address, check if the IP already exist
    if (auth.getAuthDetail() != null)  {

      if (auth.getAuthDetail().getType() == NBAuthType.IP_WHITE_LIST) {
View Full Code Here

  @Override
  public void removeAuth(String id) throws InvalidIDException {
    String authToken = cachingTableAuthIdToAuthToken.get(id);
    if (authToken == null)
      throw new InvalidIDException("An Authorization with that ID [" + id + "] doesn't exist");

    cachingTableAuthIdToAuthToken.remove(id);
    Auth auth = cachingTableAuth.remove(authToken);
    AuthDetail authDetail = cachingTableAuthDetails.remove(authToken);

    if (auth == null) {
      throw new InvalidIDException("An Authorization with that token doesn't exist");
    }

    if (authDetail != null) {
      if (authDetail.getType() == NBAuthType.IP_WHITE_LIST) {
        for (String ip : authDetail.getWhiteListedIps()) {
View Full Code Here

  @Override
  public Auth getAuthById(String id, boolean getFullDetails) throws InvalidIDException {

    String authToken = cachingTableAuthIdToAuthToken.get(id);
    if (authToken == null)
      throw new InvalidIDException("An Authorization with that ID [" + id + "] doesn't exist");

    return getAuthByToken(authToken, getFullDetails);
  }
View Full Code Here

  private void updatePolicy(Policy policy, boolean update) throws InvalidIDException {

    // First, check that the apis exist
    for (String apiId : policy.getApiIds()) {
      if (! isApiExist(apiId)) {
        throw new InvalidIDException("An API with that ID [" + apiId + "] doesn't exist");
      }
    }

    // Then, check that the auths exist
    for (QuotaRLBucket bucket : policy.getAuthIds()) {
View Full Code Here

  @Override
  public void removePolicy(String id) throws InvalidIDException {

    Policy policy = cachingTablePolicy.remove(id);
    if (policy == null)
      throw new InvalidIDException("A Policy with that ID [" + id + "] doesn't exist");

    // Now, iterate through all APIs and Auth in this policy and update them
    for (String apiId : policy.getApiIds()) {
      Api api = getApiById(apiId);
      if (api != null) {
View Full Code Here

TOP

Related Classes of com.alu.e3.common.InvalidIDException

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.