/**
 * Copyright (C) 2013 – 2015 SLUB Dresden & Avantgarde Labs GmbH (<code@dswarm.org>)
 *
 * 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.dswarm.controller.eventbus;

import org.dswarm.persistence.model.resource.DataModel;

public class SchemaEvent extends DataModelEvent {

	public static enum SchemaType {
		CSV, XML, XSD;

		public static SchemaType fromString(final String type) {
			if ("schema".equals(type)) {
				return XSD;
			}
			if ("csv".equals(type)) {
				return CSV;
			}
			if ("xml".equals(type)) {
				return XSD;
			}
			if ("mabxml".equals(type)) {
				return XSD;
			}
			if ("marc21".equals(type)) {
				return XSD;
			}
			if ("pnx".equals(type)) {
				return XSD;
			}
			throw new IllegalArgumentException("No schema type for [" + type + "]");
		}
	}

	private final SchemaType	schemaType;

	public SchemaEvent(final DataModel dataModel, final SchemaType schemaType) {

		super(dataModel);

		this.schemaType = schemaType;
	}

	public SchemaType getSchemaType() {
		return schemaType;
	}
}

@@ -744,16 +744,89 @@
 taModel;
+%0Aimport org.dswarm.persistence.model.resource.utils.ConfigurationStatics;
 %0A%0Apublic
@@ -984,296 +984,654 @@
 ) %7B%0A
+%0A
 %09%09%09if (
-%22schema%22.equals(type)
+type == null
 ) %7B%0A
+%0A
 %09%09%09%09
-return XSD
+throw new IllegalArgumentException(%22couldn't determine schema type, because it is null%22)
 ;%0A%09%09%09%7D%0A
+%0A
 %09%09%09
-if (%22csv%22.equals
+switch 
 (type)
-)
  %7B%0A
+%0A
 %09%09%09%09
-return CSV;%0A%09%09%09%7D%0A%09%09%09if (%22xml%22.equals(type)) %7B%0A%09%09%09%09return XSD;%0A%09%09%09%7D%0A%09%09%09if (%22mabxml%22.equals(type)) %7B%0A%09%09%09%09return XSD;%0A%09%09%09%7D%0A%09%09%09if (%22marc21%22.equals(type)) %7B%0A%09%09%09%09return XSD;%0A%09%09%09%7D%0A%09%09%09if (%22pnx%22.equals(type)) %7B%0A
+case ConfigurationStatics.SCHEMA_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.XML_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.MABXML_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.MARCXML_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.PNX_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.OAI_PMH_DC_ELEMENTS_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.OAIPMH_DC_TERMS_STORAGE_TYPE:%0A%09%09%09%09case ConfigurationStatics.OAIPMH_MARCXML_STORAGE_TYPE:%0A%0A%09%09%09%09%09return XSD;%0A%09%09%09%09case ConfigurationStatics.CSV_STORAGE_TYPE:%0A%0A%09
 %09%09%09%09
@@ -1641,18 +1641,29 @@
 urn 
-XSD
+CSV
 ;%0A%09%09%09
-%7D%0A
+%09default:%0A%0A%09%09
 %09%09%09t
@@ -1734,16 +1734,21 @@
 + %22%5D%22);%0A
+%09%09%09%7D%0A
 %09%09%7D%0A%09%7D%0A%0A
@@ -1772,17 +1772,17 @@
 hemaType
-%09
+ 
 schemaTy

fix for SchemaEvent determination