public String updateDomain(Domain theDomain) throws Exception {
    try {
      startTransaction(false);

      DomainRow dr = new DomainRow();
      dr.id = idAsInt(theDomain.getId());
      dr.name = theDomain.getName();
      dr.description = theDomain.getDescription();
      dr.className = theDomain.getDriverClassName();
      dr.propFileName = theDomain.getPropFileName();
      dr.authenticationServer = theDomain.getAuthenticationServer();
      dr.theTimeStamp = theDomain.getTheTimeStamp();
      dr.silverpeasServerURL = theDomain.getSilverpeasServerURL();

      // Create domain
      getOrganization().domain.updateDomain(dr);
      if (domainDriverInstances.get(theDomain.getId()) != null) {
        domainDriverInstances.remove(theDomain.getId());
      }
      this.commit();
      LoginPasswordAuthentication.initDomains();

      return theDomain.getId();
    } catch (AdminException e) {
      try {
        this.rollback();
      } catch (Exception e1) {
        SilverTrace.error("admin", "DomainDriverManager.updateDomain", "root.EX_ERR_ROLLBACK", e1);
      }
      throw new AdminException(
          "DomainDriverManager.updateDomain",
          SilverpeasException.ERROR,
          "admin.EX_ERR_ADD_DOMAIN",
          "domain name: '" + theDomain.getName() + "'",
          e);
    } finally {
      releaseOrganizationSchema();
    }
  }
Ejemplo n.º 2
0
  private void loadGroup(DomainFile domainFile, String gene, DomainAcc acc, Polypeptide polypeptide)
      throws IOException {
    logger.debug("In loadGroup()");
    DbXRef interProDbxref = null;
    if (acc != DomainAcc.NULL && analysis.getProgram().equals("iprscan")) {
      logger.debug(
          String.format(
              "Creating InterPro dbxref for '%s' with description '%s'",
              acc.getId(), acc.getDescription()));
      interProDbxref = objectManager.getDbXRef("InterPro", acc.getId(), acc.getDescription());
    }

    int n = -1;
    for (DomainRow row : domainFile.rows(gene, acc)) {
      n++;
      logger.debug(row);

      // Insert polypeptide_domain
      DbXRef dbxref = objectManager.getDbXRef(row.db(), row.nativeAcc(), row.nativeDesc());
      if (dbxref == null) {
        throw new RuntimeException(
            String.format("Could not find database '%s' on line %d", row.db(), row.lineNumber()));
      }

      String domainUniqueName;
      String accessionNumber = acc.getId();
      if (accessionNumber == null) {
        accessionNumber = row.nativeAcc();
      }
      if (n == 0) {
        domainUniqueName =
            String.format("%s:%s:%s", polypeptide.getUniqueName(), row.db(), accessionNumber);
      } else {
        domainUniqueName =
            String.format("%s:%s:%s:%d", polypeptide.getUniqueName(), row.db(), accessionNumber, n);
      }

      PolypeptideDomain polypeptideDomain =
          sequenceDao.createPolypeptideDomain(
              domainUniqueName,
              polypeptide,
              row.score(),
              row.acc().getDescription(),
              row.fmin(),
              row.fmax(),
              dbxref,
              row.evalue(),
              analysis);

      // add GO terms
      addGoTerms(row.getGoTerms(), polypeptide, polypeptideDomain, row.getGoTermComment());

      // link to InterPro dbxref if applicable
      if (interProDbxref != null && analysis.getProgram().equals("iprscan")) {
        FeatureDbXRef featureDbXRef = new FeatureDbXRef(interProDbxref, polypeptideDomain, true);
        sequenceDao.persist(featureDbXRef);
        polypeptideDomain.addFeatureDbXRef(featureDbXRef);
      }
    }
  }