Ejemplo n.º 1
0
  /**
   * get a IQuotaSingleInstance list and an string with the instance and return all quotas about
   * belong to this instance.
   *
   * @return
   */
  private List<IQuotaSingleInstance> findQuotasByInstance(
      List<IQuotaSingleInstance> aQuotas, String aInstance) {

    List<IQuotaSingleInstance> lQResult = new FastList<IQuotaSingleInstance>();

    if (aQuotas.size() > 0) {
      IQuotaSingleInstance lQtmp = null;
      for (Iterator<IQuotaSingleInstance> it = aQuotas.iterator(); it.hasNext(); ) {
        IQuotaSingleInstance lQuotaSingle = it.next();
        QuotaChildSI lChild;
        lChild = lQuotaSingle.getChildQuota(aInstance);
        if (null != lChild) {
          if (lQuotaSingle.getInstanceType().equals("Group")) {

            lQtmp =
                QuotaHelper.factorySingleInstance(
                    lChild.getValue(),
                    lChild.getInstance(),
                    lChild.getUuid(),
                    lQuotaSingle.getNamespace(),
                    lQuotaSingle.getQuotaType(),
                    lQuotaSingle.getQuotaIdentifier(),
                    lChild.getInstanceType(),
                    lQuotaSingle.getActions());
          }

          if (lQuotaSingle.getInstanceType().equals("User")) {

            lQtmp =
                QuotaHelper.factorySingleInstance(
                    lQuotaSingle.getvalue(),
                    lChild.getInstance(),
                    lChild.getUuid(),
                    lQuotaSingle.getNamespace(),
                    lQuotaSingle.getQuotaType(),
                    lQuotaSingle.getQuotaIdentifier(),
                    lChild.getInstanceType(),
                    lQuotaSingle.getActions());
          }

          if (lQtmp != null) {
            lQResult.add(lQtmp);
          }
        }
      }
    }
    return lQResult;
  }
Ejemplo n.º 2
0
  /**
   * get a IQuotaSingleInstance list and an string with the instanceType and return the
   * IQuotaSingleInstance.
   *
   * @return
   */
  private IQuotaSingleInstance findQuotaByInstance(
      List<IQuotaSingleInstance> aQuotas, String aInstance, String aActions) {

    IQuotaSingleInstance lQResult = null;

    for (Iterator<IQuotaSingleInstance> it = aQuotas.iterator(); it.hasNext(); ) {
      IQuotaSingleInstance lQuotaSingle = it.next();
      QuotaChildSI lChild;
      lChild = lQuotaSingle.getChildQuota(aInstance);
      if (null != lChild) {
        if (!lQuotaSingle.getActions().equals(aActions)) {
          continue;
        }
        if (lQuotaSingle.getInstanceType().equals("Group")) {

          lQResult =
              QuotaHelper.factorySingleInstance(
                  lChild.getValue(),
                  lChild.getInstance(),
                  lChild.getUuid(),
                  lQuotaSingle.getNamespace(),
                  lQuotaSingle.getQuotaType(),
                  lQuotaSingle.getQuotaIdentifier(),
                  lChild.getInstanceType(),
                  lQuotaSingle.getActions());
        }

        if (lQuotaSingle.getInstanceType().equals("User")) {

          lQResult =
              QuotaHelper.factorySingleInstance(
                  lQuotaSingle.getvalue(),
                  lChild.getInstance(),
                  lChild.getUuid(),
                  lQuotaSingle.getNamespace(),
                  lQuotaSingle.getQuotaType(),
                  lQuotaSingle.getQuotaIdentifier(),
                  lChild.getInstanceType(),
                  lQuotaSingle.getActions());
        }

        return lQResult;
      }
    }
    return null;
  }