AccessionHeaderJson.java

/**
 * Copyright 2014 Global Crop Diversity Trust
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/

package org.genesys.server.api.model;

import java.text.MessageFormat;
import java.util.UUID;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.genesys.server.model.impl.AccessionIdentifier3;

public class AccessionHeaderJson implements AccessionIdentifier3 {
	@Pattern(regexp = "^10\\.[0-9]+(\\.[0-9]+)*/.+")
	public String doi;
	@NotBlank
	@Pattern(regexp = "[A-Z]{3}\\d{3,4}")
	public String instCode;
	@NotBlank
	@Size(min = 1, max = 200)
	public String acceNumb;
	public String genus;
	@Size(max = 200)
	public String dataProviderId;
	public UUID uuid;

	@Override
	public String getDoi() {
		return doi;
	}

	@Override
	public String getHoldingInstitute() {
		return instCode;
	}

	@Override
	public String getAccessionNumber() {
		return acceNumb;
	}

	@Override
	public String getGenus() {
		return genus;
	}

	@Override
	public String getDataProviderId() {
		return dataProviderId;
	}

	@Override
	public UUID getUuid() {
		return uuid;
	}
	
	@Override
	public String toString() {
		return MessageFormat.format("AID3 doi={0} instCode={1} acceNumb={2} genus={3} dataProviderId={4} uuid={5}", doi, instCode, acceNumb, genus, dataProviderId, uuid);
	}
}