예제 #1
0
  private static Entry infoToPlasmidForField(Entry entry, String value, EntryField field) {
    if (!entry.getRecordType().equalsIgnoreCase(EntryType.PLASMID.toString())) return entry;

    Plasmid plasmid = (Plasmid) entry;

    switch (field) {
      case BACKBONE:
        plasmid.setBackbone(value);
        return plasmid;

      case PROMOTERS:
        plasmid.setPromoters(value);
        return plasmid;

      case REPLICATES_IN:
        plasmid.setReplicatesIn(value);
        return plasmid;

      case CIRCULAR:
        plasmid.setCircular(
            "yes".equalsIgnoreCase(value)
                || "true".equalsIgnoreCase(value)
                || "circular".equalsIgnoreCase(value));
        return plasmid;

      case ORIGIN_OF_REPLICATION:
        plasmid.setOriginOfReplication(value);
        return plasmid;

      default:
        return plasmid;
    }
  }
예제 #2
0
  private static Entry infoToSeedForField(Entry entry, String value, EntryField field) {
    if (!entry.getRecordType().equalsIgnoreCase(EntryType.ARABIDOPSIS.toString())) return entry;

    ArabidopsisSeed seed = (ArabidopsisSeed) entry;

    switch (field) {
      case HOMOZYGOSITY:
        seed.setHomozygosity(value);
        return seed;

      case ECOTYPE:
        seed.setEcotype(value);
        return seed;

      case HARVEST_DATE:
        if (value != null && !value.isEmpty()) {
          try {
            Date date = SimpleDateFormat.getDateInstance(DateFormat.SHORT).parse(value);
            seed.setHarvestDate(date);
          } catch (ParseException ia) {
            Logger.error(ia);
          }
        }
        return seed;

      case GENERATION:
        seed.setGeneration(Generation.fromString(value));
        return seed;

      case SENT_TO_ABRC:
        seed.setSentToABRC("yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value));
        return seed;

      case PLANT_TYPE:
        seed.setPlantType(PlantType.fromString(value));
        return seed;

      case PARENTS:
        seed.setParents(value);
        return seed;

      default:
        return seed;
    }
  }
예제 #3
0
  private static Entry infoToStrainForField(Entry entry, String value, EntryField field) {
    if (!entry.getRecordType().equalsIgnoreCase(EntryType.STRAIN.toString())) return entry;

    Strain strain = (Strain) entry;

    switch (field) {
      case PARENTAL_STRAIN:
        strain.setHost(value);
        return strain;

      case GENOTYPE_OR_PHENOTYPE:
        strain.setGenotypePhenotype(value);
        return strain;

      case PLASMIDS:
        strain.setPlasmids(value);
        return strain;

      default:
        return strain;
    }
  }