/** * Creates a RenderablePersonMetadataGroup. * * @param metadataType metadata type editable by this metadata group * @param binding metadata group this group is showing in * @param container project of the process owning this metadata group * @param projectName whether the user is about to create the metadata group anew or edit a * previously existing one * @throws ConfigurationException if one of the sub-fields was configured to display a * multi-select metadatum */ public RenderablePersonMetadataGroup( MetadataType metadataType, MetadataGroup binding, RenderableMetadataGroup container, String projectName) throws ConfigurationException { super(metadataType, binding, container, getGroupTypeFor(metadataType), projectName); checkConfiguration(); getField(Field.NORMDATA_RECORD) .setValue(ConfigMain.getParameter(Parameters.AUTHORITY_DEFAULT, "")); if (binding != null) { for (Person person : binding.getPersonByType(metadataType.getName())) { addContent(person); } } }
/** * 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; }