Examples of ApiIds


Examples of com.alu.e3.data.model.sub.ApiIds

          }

          cachingTableContext.set(contextId, new ContextWrapper(ctx));
          // If this APIContext is the default one, adding it at index 0 ; this is the place where we're
          // looking for it in getMatchingPolicies
          ApiIds apiIds = new ApiIds(ctx.getId(), ctx.getContextId(), ctx.getBucketId(), ctx.getStatus()==StatusType.ACTIVE);
          if(ctx.isDefaultContext())
            api.getContextIds().add(0, apiIds);
          else
            api.getContextIds().add(apiIds);
View Full Code Here

Examples of com.alu.e3.data.model.sub.ApiIds

        if (api.getContextIds().isEmpty() == false) {
          if (result == null)
            result = new ArrayList<CallDescriptor>();

          // Looking for default context, placed at index 0 by addApi
          ApiIds ctx = api.getContextIds().get(0);
          if (ctx.isStatusActive()) {
            if (logger.isDebugEnabled()) {
              logger.debug("Adding CallDescriptor({}, {}, {})", new String[] {
                  null,
                  ""+ctx.getApiContextId(),
                  ""+ctx.getApiBucketId()
                  });
            }
            result.add(new CallDescriptor(null, ctx.getApiContextId(), ctx.getApiBucketId()));
          }
        }
      }
    } else {

      // We have an Auth and an API, check matching policies
      for (AuthIds authCtx : auth.getPolicyContexts()) {

        String policyIdInAuth = authCtx.getPolicyId();

        boolean policyAdded = false;

        // API may be null if Auth is for "Company"
        if (api != null) {
          for (String policyIdInApi : api.getPolicyIds()) {

            // Matching means that the policy is in Auth and API
            if (policyIdInApi.equals(policyIdInAuth)) {
              Policy policy = getPolicyById(policyIdInAuth);
              if (result == null)
                result = new ArrayList<CallDescriptor>();
              if (authCtx.isStatusActive()) {
                if (logger.isDebugEnabled()) {
                  logger.debug("Adding CallDescriptor({}, {}, {})", new String[] {
                      policy.getId(),
                      ""+authCtx.getPolicyContextId(),
                      ""+authCtx.getPolicyBucketId()
                      });
                }
                result.add(new CallDescriptor(policy, authCtx.getPolicyContextId(), authCtx.getPolicyBucketId()));
              }
              policyAdded = true;
            }
          }
        }

        // If the policy wasn't added...
        if (!policyAdded) {
          // Slow, but need to check if that policy has some API attached
          Policy policy = getPolicyById(policyIdInAuth, false);
          if ((policy.getApiIds() == null) || policy.getApiIds().isEmpty()) {
            if (result == null)
              result = new ArrayList<CallDescriptor>();
            if (authCtx.isStatusActive()) {
              result.add(new CallDescriptor(policy, authCtx.getPolicyContextId(), authCtx.getPolicyBucketId()));
            }
          }
        }
      }

      // Now check the apiContext on the auth which is in the list of API
      if (api != null) {
        for (ApiIds ctx : api.getContextIds()) {
          if (ctx.getApiContextName().equals(auth.getApiContext())) {
            if (result == null)
              result = new ArrayList<CallDescriptor>();
            if (ctx.isStatusActive()) {
              if (logger.isDebugEnabled()) {
                logger.debug("Adding CallDescriptor({}, {}, {})", new String[] {
                    null,
                    ""+ctx.getApiContextId(),
                    ""+ctx.getApiBucketId()
                    });
              }
              result.add(new CallDescriptor(null, ctx.getApiContextId(), ctx.getApiBucketId()));
            }
          }
        }
      }
    }
View Full Code Here

Examples of com.alu.e3.data.model.sub.ApiIds

      Random r = new Random();
     
      Integer id = new Integer(r.nextInt());
      context.setContextId(id);
      contexts.put(id, context);
      ApiIds ids = new ApiIds(context.getId(), context.getContextId(), 0, true);
      api.getContextIds().add(ids);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.