예제 #1
0
  public Object onSuccessFromManageForm() throws BusinessException {
    logger.debug("onSuccessFromManageForm");

    logger.debug("Retrieve string of the table domain:" + tabPos);

    if (tabPos == null) {
      return Index.class;
    }

    String[] domainNames = tabPos.split(";");

    List<AbstractDomainVo> domainsVo = new ArrayList<AbstractDomainVo>();
    AbstractDomainVo abstractDomainVo;

    int i = 0;

    for (String domainName : domainNames) {
      if (!domainName.isEmpty()) {
        abstractDomainVo = new AbstractDomainVo();
        abstractDomainVo.setAuthShowOrder(new Long(i));
        abstractDomainVo.setIdentifier(domainName);
        domainsVo.add(abstractDomainVo);
      }
      ++i;
    }

    domainFacade.updateAllDomainForAuthShowOrder(loginUser, domainsVo);

    return Index.class;
  }
예제 #2
0
  public String[] getDomainNames() {
    List<String> domainNames = domainFacade.findAllDomainIdentifiers();

    logger.debug("Domain name identifers retrieve:" + domainNames.toString());

    return domainNames.toArray(new String[domainNames.size()]);
  }
  @SetupRender
  void setupRender() throws BusinessException {
    if (getDisplayWidget() && userVo != null && userVo.getDomainIdentifier() != null) {
      //			DomainVo domain = domainFacade.retrieveDomain(userVo.getDomainIdentifier());
      globalQuota = documentFacade.isGlobalQuotaActive(userVo);
      canUpload = userVo.isUpload();
      isGuest = userVo.isGuest();

      // the formater for the displayed date : we hide the timeline date, and add our date in the
      // description
      localisedDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);

      if (canUpload) {

        if (!globalQuota) {
          long userAvailableQuota = documentFacade.getUserAvailableQuota(userVo);
          long userTotalQuota = documentFacade.getUserTotalQuota(userVo);
          long userUsedQuota = userTotalQuota - userAvailableQuota;

          if (userUsedQuota < 0) userUsedQuota = 0;
          if (userTotalQuota < 1) {
            usedQuotaPercent = 0;
          } else {
            usedQuotaPercent = (int) (100 * userUsedQuota / userTotalQuota);
            if (usedQuotaPercent > 100) usedQuotaPercent = 100;
          }

          FileUtils.Unit preferedUnity = FileUtils.getAppropriateUnitSize(userTotalQuota);
          usedQuota = FileUtils.getFriendlySize(userUsedQuota, messages, preferedUnity);
          totalQuota = FileUtils.getFriendlySize(userTotalQuota, messages, preferedUnity);
        } else {
          Long usedQuotaB = domainFacade.getUsedSpace(userVo.getDomainIdentifier());

          Long globalQuotaB = documentFacade.getGlobalQuota(userVo);
          FileUtils.Unit preferedUnity = FileUtils.getAppropriateUnitSize(globalQuotaB);
          usedQuota = FileUtils.getFriendlySize(usedQuotaB, messages, preferedUnity);
          totalQuota = FileUtils.getFriendlySize(globalQuotaB, messages, preferedUnity);
          if (usedQuotaB < 1) {
            usedQuotaPercent = 0;
          } else {
            usedQuotaPercent = (int) (100 * usedQuotaB / globalQuotaB);
            if (usedQuotaPercent > 100) usedQuotaPercent = 100;
          }
        }
      }

      if (isGuest) {
        if (userVo.getExpirationDate() != null)
          expirationDate = localisedDateFormat.format(userVo.getExpirationDate());
        else {
          logger.error("userVo.getExpirationDate() is null !");
          expirationDate = "Null";
        }
      }
    }
  }