2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.remote
.editor
;
11 import java
.beans
.PropertyEditorSupport
;
13 import eu
.etaxonomy
.cdm
.remote
.dto
.oaipmh
.MetadataPrefix
;
14 import eu
.etaxonomy
.cdm
.remote
.exception
.CannotDisseminateFormatException
;
16 public class MetadataPrefixEditor
extends PropertyEditorSupport
{
19 public void setAsText(String text
) {
21 throw new IllegalArgumentException("null is not an acceptable metadata format");
23 MetadataPrefix metadatPrefix
= MetadataPrefix
.value(text
);
24 if(metadatPrefix
!= null){
25 setValue(metadatPrefix
);
27 // if(text.equals("rdf")) {
28 // setValue(MetadataPrefix.RDF);
29 // } else if(text.equals("oai_dc")) {
30 // setValue(MetadataPrefix.OAI_DC);
32 throw new CannotDisseminateFormatException(text
+ " is not an acceptable metadata format");
38 public String
getAsText() {
39 if(getValue() == null) {
42 return ((MetadataPrefix
)getValue()).name();