Example #1
0
  public Domain saveDomain(Domain domain) {
    if (domain.getId() == null) {
      domain.setId((long) domains.size());
      domains.add(domain);
    }

    return domain;
  }
  /**
   * @param domainId
   * @return String
   */
  public Domain getDomain(String domainId) throws Exception {
    Domain valret = null;

    try {
      // Set the OrganizationSchema (if not already done)
      getOrganizationSchema();

      // Get the domain information
      DomainRow dr = getOrganization().domain.getDomain(idAsInt(domainId));
      if (dr == null) {
        throw new AdminException(
            "DomainDriverManager.getDomain",
            SilverpeasException.ERROR,
            "admin.EX_ERR_DOMAIN_NOT_FOUND",
            "domain Id: '" + domainId + "'");
      }

      valret = new Domain();
      valret.setId(Integer.toString(dr.id));
      valret.setName(dr.name);
      valret.setDescription(dr.description);
      valret.setDriverClassName(dr.className);
      valret.setPropFileName(dr.propFileName);
      valret.setAuthenticationServer(dr.authenticationServer);
      valret.setTheTimeStamp(dr.theTimeStamp);
      valret.setSilverpeasServerURL(dr.silverpeasServerURL);
    } catch (AdminPersistenceException e) {
      throw new AdminException(
          "DomainDriverManager.getDomain",
          SilverpeasException.ERROR,
          "admin.EX_ERR_GET_DOMAIN",
          "domain id: '" + domainId + "'",
          e);
    } finally {
      releaseOrganizationSchema();
    }
    return valret;
  }