blob: daec42723d49f788589f14d2ac64998ef68be058 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0, which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
import org.eclipse.jpt.core.internal.resource.orm.Transient;
import org.eclipse.jpt.core.internal.resource.orm.TransientImpl;
import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
public class XmlTransientMapping extends XmlAttributeMapping<Transient> implements ITransientMapping
{
protected XmlTransientMapping(XmlPersistentAttribute parent) {
super(parent);
}
@Override
protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
newMapping.initializeFromXmlTransientMapping(this);
}
@Override
public int xmlSequence() {
return 8;
}
public String getKey() {
return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
}
@Override
public Transient addToResourceModel(TypeMapping typeMapping) {
TransientImpl transientResource = OrmFactory.eINSTANCE.createTransientImpl();
typeMapping.getAttributes().getTransients().add(transientResource);
return transientResource;
}
@Override
public void removeFromResourceModel(TypeMapping typeMapping) {
typeMapping.getAttributes().getTransients().remove(this.attributeMapping());
if (typeMapping.getAttributes().isAllFeaturesUnset()) {
typeMapping.setAttributes(null);
}
}
@Override
public void initialize(Transient transientResource) {
super.initialize(transientResource);
}
@Override
public void update(Transient transientResource) {
super.update(transientResource);
}
}