/** Recursively save all child elements and then call ObjBase to save itself. */
  @Override
  public synchronized boolean save(ClothoConnection conn) {
    System.out.println("============ Starting plasmidSample save");
    if (!isChanged()) {
      System.out.println("plasmidSample didn't require saving");
      return true;
    }

    if (Collector.isLocal(_pSampleDatum._plasmidUUID)) {
      Plasmid plas = getPlasmid();
      if (!plas.isInDatabase()) {
        if (!plas.save(conn)) {
          return false;
        }
      }
    }

    if (Collector.isLocal(_pSampleDatum._sourceStrainUUID)) {
      Strain st = getSourceStrain();
      if (!st.isInDatabase()) {
        if (!st.save(conn)) {
          return false;
        }
      }
    }

    return super.save(conn);
  }
Exemple #2
0
  /** Recursively save all child elements and then call ObjBase to save itself. */
  @Override
  public synchronized boolean save(ClothoConnection conn) {
    System.out.println("============ Starting plate save of " + getUUID());
    if (!isChanged()) {
      System.out.println("Collection didn't require saving");
      return true;
    }

    if (Collector.isLocal(this._plateDatum._authorUUID)) {
      if (!getAuthor().saveDefault()) {
        return false;
      }
    }
    if (!Collector.getCurrentUser().getUUID().equals(this.getAuthor().getUUID())) {
      if (!Collector.getCurrentUser().isAdmin()) {
        System.out.println(
            "Current user "
                + this.getAuthor().getDisplayName()
                + " does not have permission to modify "
                + this.getName());
        return false;
      }
    }
    if (!super.save(conn)) {
      return false;
    }

    for (int row = 0; row < getNumRows(); row++) {
      for (int col = 0; col < getNumCols(); col++) {
        String containerref = this.getContainerRefAt(row, col);
        if (!Collector.isLocal(containerref)) {
          continue;
        }
        Container acon = Collector.getContainer(containerref);
        System.out.println("plate about to save " + acon.getName());

        System.out.println(acon.getUUID());
        System.out.println(acon.getName());
        System.out.println(acon.getDateCreated());
        System.out.println(acon.getLastModified());
        System.out.println(acon.getRowAsInt());
        System.out.println(acon.getCol());
        System.out.println(acon.getBarcode());
        System.out.println(acon.isFixed());
        System.out.println(acon.getPlateLink());

        if (!acon.save(conn)) {
          return false;
        }
      }
    }
    return true;
  }