All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jvnet.hyperjaxb3.ejb.strategy.mapping.Mapping Maven / Gradle / Ivy

package org.jvnet.hyperjaxb3.ejb.strategy.mapping;

import org.jvnet.hyperjaxb3.ejb.strategy.customizing.Customizing;
import org.jvnet.hyperjaxb3.ejb.strategy.ignoring.Ignoring;
import org.jvnet.hyperjaxb3.ejb.strategy.model.GetTypes;
import org.jvnet.hyperjaxb3.ejb.strategy.naming.Naming;
import org.springframework.beans.factory.annotation.Required;

import jakarta.xml.ns.persistence.orm.Attributes;
import jakarta.xml.ns.persistence.orm.Basic;
import jakarta.xml.ns.persistence.orm.ElementCollection;
import jakarta.xml.ns.persistence.orm.Embeddable;
import jakarta.xml.ns.persistence.orm.EmbeddableAttributes;
import jakarta.xml.ns.persistence.orm.Embedded;
import jakarta.xml.ns.persistence.orm.EmbeddedId;
import jakarta.xml.ns.persistence.orm.Entity;
import jakarta.xml.ns.persistence.orm.Id;
import jakarta.xml.ns.persistence.orm.ManyToMany;
import jakarta.xml.ns.persistence.orm.ManyToOne;
import jakarta.xml.ns.persistence.orm.MappedSuperclass;
import jakarta.xml.ns.persistence.orm.OneToMany;
import jakarta.xml.ns.persistence.orm.OneToOne;
import jakarta.xml.ns.persistence.orm.Transient;
import jakarta.xml.ns.persistence.orm.Version;
import com.sun.tools.xjc.outline.FieldOutline;

public class Mapping implements Cloneable {

	@Override
	public Mapping clone() {
		try {
			return (Mapping) super.clone();
		} catch (CloneNotSupportedException cnsex) {
			throw new UnsupportedOperationException(cnsex);
		}
	}

	private GetTypes getTypes;

	public GetTypes getGetTypes() {
		return getTypes;
	}

	@Required
	public void setGetTypes(GetTypes getTypes) {
		this.getTypes = getTypes;
	}

	private ClassOutlineMapping entityOrMappedSuperclassOrEmbeddableMapping = new EntityOrMappedSuperclassOrEmbeddableMapping();

	public ClassOutlineMapping getEntityOrMappedSuperclassOrEmbeddableMapping() {
		return entityOrMappedSuperclassOrEmbeddableMapping;
	}

	public void setEntityOrMappedSuperclassOrEmbeddableMapping(
			ClassOutlineMapping entityOrMappedSuperclassMapping) {
		this.entityOrMappedSuperclassOrEmbeddableMapping = entityOrMappedSuperclassMapping;
	}

	private ClassOutlineMapping entityMapping = new EntityMapping();

	public ClassOutlineMapping getEntityMapping() {
		return entityMapping;
	}

	public void setEntityMapping(ClassOutlineMapping entityMapping) {
		this.entityMapping = entityMapping;
	}

	private ClassOutlineMapping mappedSuperclassMapping = new MappedSuperclassMapping();

	public ClassOutlineMapping getMappedSuperclassMapping() {
		return mappedSuperclassMapping;
	}

	public void setMappedSuperclassMapping(
			ClassOutlineMapping mappedSuperclassMapping) {
		this.mappedSuperclassMapping = mappedSuperclassMapping;
	}

	private ClassOutlineMapping embeddableMapping = new EmbeddableMapping();

	public ClassOutlineMapping getEmbeddableMapping() {
		return embeddableMapping;
	}

	public void setEmbeddableMapping(
			ClassOutlineMapping embeddableMapping) {
		this.embeddableMapping = embeddableMapping;
	}

	private ClassOutlineMapping attributesMapping = new AttributesMapping();

	public ClassOutlineMapping getAttributesMapping() {
		return attributesMapping;
	}

	public void setAttributesMapping(
			ClassOutlineMapping attributesMapping) {
		this.attributesMapping = attributesMapping;
	}

	private ClassOutlineMapping embeddableAttributesMapping;// =
																					// new
																					// EmbeddableAttributesMapping();

	public ClassOutlineMapping getEmbeddableAttributesMapping() {
		return embeddableAttributesMapping;
	}

	@Required
	public void setEmbeddableAttributesMapping(
			ClassOutlineMapping embeddableAttributesMapping) {
		this.embeddableAttributesMapping = embeddableAttributesMapping;
	}

	private FieldOutlineMapping idMapping = new IdMapping();

	public FieldOutlineMapping getIdMapping() {
		return idMapping;
	}

	public void setIdMapping(FieldOutlineMapping idMapping) {
		this.idMapping = idMapping;
	}

	private FieldOutlineMapping embeddedIdMapping = new EmbeddedIdMapping();

	public FieldOutlineMapping getEmbeddedIdMapping() {
		return embeddedIdMapping;
	}

	public void setEmbeddedIdMapping(
			FieldOutlineMapping embeddedIdMapping) {
		this.embeddedIdMapping = embeddedIdMapping;
	}

	private FieldOutlineMapping basicMapping = new BasicMapping();

	public FieldOutlineMapping getBasicMapping() {
		return basicMapping;
	}

	public void setBasicMapping(FieldOutlineMapping basicMapping) {
		this.basicMapping = basicMapping;
	}

	private FieldOutlineMapping versionMapping = new VersionMapping();

	public FieldOutlineMapping getVersionMapping() {
		return versionMapping;
	}

	public void setVersionMapping(FieldOutlineMapping versionMapping) {
		this.versionMapping = versionMapping;
	}

	/*
	 * private FieldOutlineMapping embeddedIdMaping;// = new //
	 * EmbeddedIdMapping();
	 *
	 * public FieldOutlineMapping getEmbeddedIdMapping() { throw new
	 * UnsupportedOperationException(); // return embeddedIdMaping; }
	 *
	 * public void setEmbeddedIdMaping( FieldOutlineMapping
	 * embeddedIdMaping) { this.embeddedIdMaping = embeddedIdMaping; }
	 */

	private FieldOutlineMapping embeddedMapping = new EmbeddedMapping();

	public FieldOutlineMapping getEmbeddedMapping() {
		return embeddedMapping;
	}

	public void setEmbeddedMapping(FieldOutlineMapping embeddedMapping) {
		this.embeddedMapping = embeddedMapping;
	}

	private FieldOutlineMapping toOneMapping = new ToOneMapping();

	public FieldOutlineMapping getToOneMapping() {
		return toOneMapping;
	}

	public void setToOneMapping(FieldOutlineMapping toOneMapping) {
		this.toOneMapping = toOneMapping;
	}

	private FieldOutlineMapping elementCollectionMapping = new ElementCollectionMapping();

	public FieldOutlineMapping getElementCollectionMapping() {
		return elementCollectionMapping;
	}

	public void setElementCollectionMapping(
			FieldOutlineMapping elementCollectionMapping) {
		this.elementCollectionMapping = elementCollectionMapping;
	}

	private FieldOutlineMapping manyToOneMapping = new ManyToOneMapping();

	public FieldOutlineMapping getManyToOneMapping() {
		return manyToOneMapping;
	}

	public void setManyToOneMapping(
			FieldOutlineMapping manyToOneMapping) {
		this.manyToOneMapping = manyToOneMapping;
	}

	private FieldOutlineMapping oneToOneMapping = new OneToOneMapping();

	public FieldOutlineMapping getOneToOneMapping() {
		return oneToOneMapping;
	}

	public void setOneToOneMapping(FieldOutlineMapping oneToOneMapping) {
		this.oneToOneMapping = oneToOneMapping;
	}

	private FieldOutlineMapping toManyMapping = new ToManyMapping();

	public FieldOutlineMapping getToManyMapping() {
		return toManyMapping;
	}

	public void setToManyMapping(FieldOutlineMapping toManyMapping) {
		this.toManyMapping = toManyMapping;
	}

	private FieldOutlineMapping oneToManyMapping = new OneToManyMapping();

	public FieldOutlineMapping getOneToManyMapping() {
		return oneToManyMapping;
	}

	public void setOneToManyMapping(
			FieldOutlineMapping oneToManyMapping) {
		this.oneToManyMapping = oneToManyMapping;
	}

	private FieldOutlineMapping manyToManyMapping = new ManyToManyMapping();

	public FieldOutlineMapping getManyToManyMapping() {
		return manyToManyMapping;
	}

	public void setManyToManyMapping(
			FieldOutlineMapping manyToManyMapping) {
		this.manyToManyMapping = manyToManyMapping;
	}

	private FieldOutlineMapping transientMapping = new TransientMapping();

	public FieldOutlineMapping getTransientMapping() {
		return transientMapping;
	}

	public void setTransientMapping(
			FieldOutlineMapping transientMapping) {
		this.transientMapping = transientMapping;
	}

	private Customizing customizing;

	public Customizing getCustomizing() {
		return customizing;
	}

	@Required
	public void setCustomizing(Customizing modelCustomizations) {
		this.customizing = modelCustomizations;
	}

	private Naming naming;

	public Naming getNaming() {
		return naming;
	}

	@Required
	public void setNaming(Naming naming) {
		this.naming = naming;
	}

	private Ignoring ignoring;

	public Ignoring getIgnoring() {
		return ignoring;
	}

	@Required
	public void setIgnoring(Ignoring ignoring) {
		this.ignoring = ignoring;
	}

	public Mapping createEmbeddedMapping(Mapping context, FieldOutline fieldOutline) {
		// TODO Rework with wrappers
		final Mapping embeddedMapping = clone();
		embeddedMapping.setNaming(getNaming()
				.createEmbeddedNaming(context, fieldOutline));
		embeddedMapping.setAssociationMapping(getAssociationMapping()
				.createEmbeddedAssociationMapping(fieldOutline));
		return embeddedMapping;

	}

	private AssociationMapping associationMapping = new DefaultAssociationMapping();

	public AssociationMapping getAssociationMapping() {
		return associationMapping;
	}

	public void setAssociationMapping(AssociationMapping associationMapping) {
		this.associationMapping = associationMapping;
	}

	private AttributeMapping defaultAttributeMapping = new DefaultAttributeMapping();

	public AttributeMapping getAttributeMapping() {
		return defaultAttributeMapping;
	}

	public void setAttributeMapping(AttributeMapping defaultAttributeMapping) {
		this.defaultAttributeMapping = defaultAttributeMapping;
	}

}