コード例 #1
0
 /**
  * Returns the value of this person as metadata element
  *
  * @return a list with one person element with the value of this component
  * @see de.sub.goobi.metadaten.RenderableGroupableMetadatum#toMetadata()
  */
 @Override
 public List<Person> toMetadata() {
   List<Person> result = new ArrayList<Person>(1);
   Person person;
   try {
     person = new Person(metadataType);
   } catch (MetadataTypeNotAllowedException e) {
     throw new NullPointerException(e.getMessage());
   }
   String normdataRecord = getField(Field.NORMDATA_RECORD).getValue();
   if (normdataRecord != null
       && normdataRecord.length() > 0
       && !normdataRecord.equals(ConfigMain.getParameter(Parameters.AUTHORITY_DEFAULT, ""))) {
     String[] authorityFile = Metadaten.parseAuthorityFileArgs(normdataRecord);
     person.setAutorityFile(authorityFile[0], authorityFile[1], authorityFile[2]);
   }
   person.setFirstname(getField(Field.FIRSTNAME).getValue());
   person.setLastname(getField(Field.LASTNAME).getValue());
   result.add(person);
   return result;
 }
コード例 #2
0
 /**
  * Add the data passed from the metadata element as content to the person record.
  *
  * @param data data to add
  * @see de.sub.goobi.metadaten.RenderableGroupableMetadatum#addContent(ugh.dl.Metadata)
  */
 @Override
 public void addContent(Metadata data) {
   if (data instanceof Person) {
     Person personData = (Person) data;
     if (personData.getLastname() != null) {
       getField(Field.LASTNAME).setValue(personData.getLastname());
     }
     if (personData.getFirstname() != null) {
       getField(Field.FIRSTNAME).setValue(personData.getFirstname());
     }
     if (personData.getAuthorityURI() != null) {
       getField(Field.NORMDATA_RECORD).setValue(personData.getAuthorityValue());
     }
   } else {
     String[] lastNameFirstName = data.getValue().split(", ", 2);
     getField(Field.LASTNAME).setValue(lastNameFirstName[0]);
     if (lastNameFirstName.length > 1) {
       getField(Field.FIRSTNAME).setValue(lastNameFirstName[1]);
     }
   }
 }
コード例 #3
0
  /**
   * @throws MetadataTypeNotAllowedException
   * @throws WrongImportFileException
   * @throws IOException
   * @throws WrongImportFileException
   * @throws TypeNotAllowedForParentException
   */
  private void ParsenArtikel(
      DocStruct inStruct, String myLeft, String myRight, boolean istErsterTitel)
      throws MetadataTypeNotAllowedException, WrongImportFileException {
    // myLogger.debug(myLeft);
    // myLogger.debug(myRight);
    // myLogger.debug("---");
    Metadata md;
    MetadataType mdt;

    // J: Zeitschrift
    // V: Band
    // I: Heft
    // Y: Jahrgang
    // SO: Quelle (fuer uns intern)
    // AR: Author (Referenz)
    // BR: Biographische Referenz
    // AB: Abstract-Review
    // DE: Vorlaeufige AN-Nummer (eher fuer uns intern)
    // SI: Quellenangabe für Rezension im Zentralblatt
    //

    /*
     * -------------------------------- erledigt
     *
     * TI: Titel AU: Autor LA: Sprache NH: Namensvariationen CC: MSC 2000 KW: Keywords AN: Zbl und/oder JFM Nummer P: Seiten
     *
     * --------------------------------
     */

    /*
     * -------------------------------- Titel --------------------------------
     */
    if (myLeft.equals("TI")) {
      if (istErsterTitel) {
        mdt = this.myPrefs.getMetadataTypeByName("TitleDocMain");
      } else {
        mdt = this.myPrefs.getMetadataTypeByName("MainTitleTranslated");
      }
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- Sprache --------------------------------
     */
    if (myLeft.equals("LA")) {
      mdt = this.myPrefs.getMetadataTypeByName("DocLanguage");
      md = new Metadata(mdt);
      md.setValue(myRight.toLowerCase());
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLIdentifier --------------------------------
     */
    if (myLeft.equals("AN")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLIdentifier");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLPageNumber --------------------------------
     */
    if (myLeft.equals("P")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLPageNumber");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLSource --------------------------------
     */
    if (myLeft.equals("SO")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLSource");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLAbstract --------------------------------
     */
    if (myLeft.equals("AB")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLAbstract");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLReviewAuthor --------------------------------
     */
    if (myLeft.equals("RV")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLReviewAuthor");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLCita --------------------------------
     */
    if (myLeft.equals("CI")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLCita");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLTempID --------------------------------
     */
    if (myLeft.equals("DE")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLTempID");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLReviewLink --------------------------------
     */
    if (myLeft.equals("SI")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLReviewLink");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- ZBLIntern --------------------------------
     */
    if (myLeft.equals("XX")) {
      mdt = this.myPrefs.getMetadataTypeByName("ZBLIntern");
      md = new Metadata(mdt);
      md.setValue(myRight);
      inStruct.addMetadata(md);
      return;
    }

    /*
     * -------------------------------- Keywords --------------------------------
     */
    if (myLeft.equals("KW")) {
      StringTokenizer tokenizer = new StringTokenizer(myRight, ";");
      while (tokenizer.hasMoreTokens()) {
        md = new Metadata(this.myPrefs.getMetadataTypeByName("Keyword"));
        String myTok = tokenizer.nextToken();
        md.setValue(myTok.trim());
        inStruct.addMetadata(md);
      }
      return;
    }

    /*
     * -------------------------------- Autoren als Personen --------------------------------
     */
    if (myLeft.equals("AU")) {
      StringTokenizer tokenizer = new StringTokenizer(myRight, ";");
      while (tokenizer.hasMoreTokens()) {
        Person p = new Person(this.myPrefs.getMetadataTypeByName("ZBLAuthor"));
        String myTok = tokenizer.nextToken();

        if (myTok.indexOf(",") == -1) {
          throw new WrongImportFileException(
              "Parsingfehler: Vorname nicht mit Komma vom Nachnamen getrennt ('" + myTok + "')");
        }

        p.setLastname(myTok.substring(0, myTok.indexOf(",")).trim());
        p.setFirstname(myTok.substring(myTok.indexOf(",") + 1, myTok.length()).trim());
        p.setRole("ZBLAuthor");
        inStruct.addPerson(p);
      }
      return;
    }

    /*
     * -------------------------------- AutorVariationen als Personen --------------------------------
     */
    if (myLeft.equals("NH")) {
      StringTokenizer tokenizer = new StringTokenizer(myRight, ";");
      while (tokenizer.hasMoreTokens()) {
        Person p = new Person(this.myPrefs.getMetadataTypeByName("AuthorVariation"));
        String myTok = tokenizer.nextToken();

        if (myTok.indexOf(",") == -1) {
          throw new WrongImportFileException(
              "Parsingfehler: Vorname nicht mit Komma vom Nachnamen getrennt ('" + myTok + "')");
        }

        p.setLastname(myTok.substring(0, myTok.indexOf(",")).trim());
        p.setFirstname(myTok.substring(myTok.indexOf(",") + 1, myTok.length()).trim());
        p.setRole("AuthorVariation");
        inStruct.addPerson(p);
      }
      return;
    }

    /*
     * -------------------------------- MSC 2000 - ClassificationMSC --------------------------------
     */
    if (myLeft.equals("CC")) {
      StringTokenizer tokenizer = new StringTokenizer(myRight);
      while (tokenizer.hasMoreTokens()) {
        md = new Metadata(this.myPrefs.getMetadataTypeByName("ClassificationMSC"));
        String myTok = tokenizer.nextToken();
        md.setValue(myTok.trim());
        inStruct.addMetadata(md);
      }
      return;
    }
  }