diff options
Diffstat (limited to 'jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations')
15 files changed, 0 insertions, 994 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/AbstractRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/AbstractRelation.java deleted file mode 100644 index 1af1f3ec38..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/AbstractRelation.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import java.util.Hashtable; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -abstract public class AbstractRelation implements IRelation { - protected final static String SEPARATOR = ";"; //$NON-NLS-1$ - protected JavaPersistentType owner; - protected JavaPersistentType inverse; - protected JavaPersistentAttribute ownerAnnotatedAttribute; - protected JavaPersistentAttribute inverseAnnotatedAttribute; - - protected String ownerAttributeName; - protected String inverseAttributeName; - - - public final static Hashtable<RelType, String> relTypeToIdPart = new Hashtable<RelType, String>(); - public final static Hashtable<RelDir, String> relDirToIdPart = new Hashtable<RelDir, String>(); - - static { - relTypeToIdPart.put(RelType.ONE_TO_ONE, "1-1"); //$NON-NLS-1$ - relTypeToIdPart.put(RelType.ONE_TO_MANY, "1-N"); //$NON-NLS-1$ - relTypeToIdPart.put(RelType.MANY_TO_ONE, "N-1"); //$NON-NLS-1$ - relTypeToIdPart.put(RelType.MANY_TO_MANY, "N-N"); //$NON-NLS-1$ - - relDirToIdPart.put(RelDir.UNI, "->"); //$NON-NLS-1$ - relDirToIdPart.put(RelDir.BI, "<->"); //$NON-NLS-1$ - } - - public AbstractRelation(JavaPersistentType owner, JavaPersistentType inverse) { - this.owner = owner; - this.inverse = inverse; - } - - public String getId() { - return generateId(owner, inverse, getOwnerAttributeName(), getRelType(), getRelDir()); - } - - public JavaPersistentType getOwner() { - return owner; - } - - public JavaPersistentType getInverse() { - return inverse; - } - - public JavaPersistentAttribute getInverseAnnotatedAttribute() { - return inverseAnnotatedAttribute; - } - - public JavaPersistentAttribute getOwnerAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setOwnerAnnotatedAttribute( - JavaPersistentAttribute ownerAnnotatedAttribute) { - this.ownerAnnotatedAttribute = ownerAnnotatedAttribute; - } - - public void setInverseAnnotatedAttribute( - JavaPersistentAttribute inverseAnnotatedAttribute) { - this.inverseAnnotatedAttribute = inverseAnnotatedAttribute; - } - - public void setOwnerAttributeName(String ownerAttributeName) { - this.ownerAttributeName = ownerAttributeName; - } - - public String getOwnerAttributeName() { - if (this.ownerAnnotatedAttribute != null) - return ownerAnnotatedAttribute.getName(); - return ownerAttributeName; - } - - public void setInverseAttributeName(String inverseAttributeName) { - this.inverseAttributeName = inverseAttributeName; - } - - public String getInverseAttributeName() { - if (this.inverseAnnotatedAttribute != null) - return inverseAnnotatedAttribute.getName(); - return inverseAttributeName; - } - - public int hashCode() { - return getId().hashCode(); - } - - public boolean equals(Object otherRel) { - if (!IRelation.class.isInstance(otherRel)) - return false; - return getId().equals(((IRelation)otherRel).getId()); - } - - public abstract RelType getRelType(); - - public abstract RelDir getRelDir(); - - public static String generateId(JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - RelType relType, - RelDir relDir) { - String id = owner.getName() + "-" + inverse.getName() + SEPARATOR + //$NON-NLS-1$ - relTypeToIdPart.get(relType) + SEPARATOR + - relDirToIdPart.get(relDir) + SEPARATOR + ownerAttributeName; - return id; - } - -} diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java deleted file mode 100644 index 26fbc1f61a..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/BidirectionalRelation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; - -public interface BidirectionalRelation extends IRelation { - - public abstract JavaPersistentAttribute getOwnerAnnotatedAttribute(); - - public abstract JavaPersistentAttribute getInverseAnnotatedAttribute(); - - public abstract void setOwnerAnnotatedAttribute(JavaPersistentAttribute ownerAnnotatedAttribute); - - public abstract void setInverseAnnotatedAttribute(JavaPersistentAttribute inverseAnnotatedAttribute); - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IRelation.java deleted file mode 100644 index 0556846f29..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/IRelation.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Kiril Mitov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -public interface IRelation { - - public static enum RelType { - ONE_TO_ONE, ONE_TO_MANY, MANY_TO_ONE, MANY_TO_MANY - } - - public static enum RelDir { - UNI, BI - } - - public abstract String getId(); - - public abstract JavaPersistentType getOwner(); - - public abstract JavaPersistentType getInverse(); - - public void setOwnerAnnotatedAttribute(JavaPersistentAttribute ownerAnnotatedAttribute); - - public JavaPersistentAttribute getOwnerAnnotatedAttribute(); - - public void setInverseAnnotatedAttribute(JavaPersistentAttribute inverseAnnotatedAttribute); - - public void setOwnerAttributeName(String ownerAttributeName); - - public void setInverseAttributeName(String inverseAttributeName); - - public abstract JavaPersistentAttribute getInverseAnnotatedAttribute(); - - public abstract String getOwnerAttributeName(); - - public abstract String getInverseAttributeName(); - - public abstract RelType getRelType(); - - public abstract RelDir getRelDir(); - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java deleted file mode 100644 index 41d9e2c234..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyBiDirRelation.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class ManyToManyBiDirRelation extends ManyToManyRelation implements BidirectionalRelation { - - public ManyToManyBiDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - String inverseAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - this.inverseAttributeName = inverseAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - } - - - /* (non-Javadoc) - * @see org.eclipse.jpt.jpadiagrameditor.ui.relations.BidirectionalRelation#getOwnerAnnotatedAttribute() - */ - public JavaPersistentAttribute getOwnerAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setOwnerAnnotatedAttribute( - JavaPersistentAttribute ownerAnnotatedAttribute) { - this.ownerAnnotatedAttribute = ownerAnnotatedAttribute; - } - - /* (non-Javadoc) - * @see org.eclipse.jpt.jpadiagrameditor.ui.relations.BidirectionalRelation#getInverseAnnotatedAttribute() - */ - public JavaPersistentAttribute getInverseAnnotatedAttribute() { - return inverseAnnotatedAttribute; - } - - public void setInverseAnnotatedAttribute( - JavaPersistentAttribute inverseAnnotatedAttribute) { - this.inverseAnnotatedAttribute = inverseAnnotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, ICompilationUnit inverseCU) { - String inverseAttributeName = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actInverseAttributeName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(inverseAttributeName); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actInverseAttributeName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(inverseAttributeName); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actInverseAttributeName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - JPADiagramPropertyPage.isMapType(owner.getJpaProject().getProject()) ? JpaArtifactFactory.instance().getIdType(inverse) : null, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, - true, - ownerCU, - inverseCU); - - String ownerAttributeName = JPAEditorUtil.returnSimpleName(owner.getName()); - String actOwnerAttributeName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(owner)); - nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(ownerAttributeName); - actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actOwnerAttributeName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(inverse)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(ownerAttributeName); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actOwnerAttributeName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(inverse, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(inverse, actNameWithNonCapitalLetter); - boolean isMap = JPADiagramPropertyPage.isMapType(owner.getJpaProject().getProject()); - inverseAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, inverse, owner, - isMap ? JpaArtifactFactory.instance().getIdType(owner) : null, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, - true, - inverseCU, - ownerCU); - - JpaArtifactFactory.instance().addManyToManyBidirectionalRelation(fp, owner, ownerAnnotatedAttribute, inverse, inverseAnnotatedAttribute, isMap); - } - - public RelDir getRelDir() { - return RelDir.BI; - } - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyRelation.java deleted file mode 100644 index 16833b4f0c..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyRelation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -public abstract class ManyToManyRelation extends AbstractRelation { - - public ManyToManyRelation(JavaPersistentType owner, JavaPersistentType inverse) { - super(owner, inverse); - } - - public RelType getRelType() { - return RelType.MANY_TO_MANY; - } - -} diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyUniDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyUniDirRelation.java deleted file mode 100644 index 790c23c61f..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToManyUniDirRelation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class ManyToManyUniDirRelation extends ManyToManyRelation implements UnidirectionalRelation { - - public ManyToManyUniDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - } - - public JavaPersistentAttribute getAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setAnnotatedAttribute(JavaPersistentAttribute annotatedAttribute) { - this.ownerAnnotatedAttribute = annotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - String name = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - boolean isMap = JPADiagramPropertyPage.isMapType(owner.getJpaProject().getProject()); - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - isMap ? JpaArtifactFactory.instance().getIdType(inverse) : null, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, - true, - ownerCU, - inverseCU); - JpaArtifactFactory.instance().addManyToManyUnidirectionalRelation(fp, owner, ownerAnnotatedAttribute, isMap); - - } - - public RelDir getRelDir() { - return RelDir.UNI; - } - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java deleted file mode 100644 index 3442c507f8..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneBiDirRelation.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class ManyToOneBiDirRelation extends ManyToOneRelation implements BidirectionalRelation{ - - public ManyToOneBiDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - String inverseAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - this.inverseAttributeName = inverseAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - - } - - public JavaPersistentAttribute getOwnerAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setOwnerAnnotatedAttribute( JavaPersistentAttribute ownerAnnotatedAttribute) { - this.ownerAnnotatedAttribute = ownerAnnotatedAttribute; - } - - public JavaPersistentAttribute getInverseAnnotatedAttribute() { - return inverseAnnotatedAttribute; - } - - public void setInverseAnnotatedAttribute(JavaPersistentAttribute inverseAnnotatedAttribute) { - this.inverseAnnotatedAttribute = inverseAnnotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, ICompilationUnit inverseCU) { - String name = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, false, - ownerCU, - inverseCU); - - name = JPAEditorUtil.returnSimpleName(owner.getName()); - actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(owner)); - nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(inverse)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(inverse, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(inverse, actNameWithNonCapitalLetter); - boolean isMap = JPADiagramPropertyPage.isMapType(owner.getJpaProject().getProject()); - inverseAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, inverse, owner, - isMap ? JpaArtifactFactory.instance().getIdType(owner) : null, - nameWithNonCapitalLetter, actNameWithNonCapitalLetter, - true, - inverseCU, - ownerCU); - - JpaArtifactFactory.instance().addManyToOneBidirectionalRelation(fp, owner, ownerAnnotatedAttribute, inverse, inverseAnnotatedAttribute, isMap); - } - - public RelDir getRelDir() { - return RelDir.BI; - } - - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneRelation.java deleted file mode 100644 index f0df131185..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneRelation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -abstract public class ManyToOneRelation extends AbstractRelation{ - - public ManyToOneRelation(JavaPersistentType owner, JavaPersistentType inverse) { - super(owner, inverse); - } - - public RelType getRelType() { - return RelType.MANY_TO_ONE; - } - -} diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneUniDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneUniDirRelation.java deleted file mode 100644 index 099eb292bd..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/ManyToOneUniDirRelation.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class ManyToOneUniDirRelation extends ManyToOneRelation implements UnidirectionalRelation { - - public ManyToOneUniDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - } - - public JavaPersistentAttribute getAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setAnnotatedAttribute(JavaPersistentAttribute annotatedAttribute) { - this.ownerAnnotatedAttribute = annotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, ICompilationUnit inverseCU) { - String name = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - - //fp.addAddIgnore(owner, actNameWithNonCapitalLetter); - - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, false, - ownerCU, - inverseCU); - JpaArtifactFactory.instance().addManyToOneUnidirectionalRelation(fp, owner, ownerAnnotatedAttribute); - - } - - public RelDir getRelDir() { - return RelDir.UNI; - } - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToManyRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToManyRelation.java deleted file mode 100644 index d35e713acc..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToManyRelation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -public abstract class OneToManyRelation extends AbstractRelation { - - public OneToManyRelation(JavaPersistentType owner, JavaPersistentType inverse) { - super(owner, inverse); - } - - public RelType getRelType() { - return RelType.ONE_TO_MANY; - } - -} diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToManyUniDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToManyUniDirRelation.java deleted file mode 100644 index 7af06377c6..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToManyUniDirRelation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class OneToManyUniDirRelation extends OneToManyRelation implements UnidirectionalRelation { - - public OneToManyUniDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - } - - public JavaPersistentAttribute getAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setAnnotatedAttribute(JavaPersistentAttribute annotatedAttribute) { - this.ownerAnnotatedAttribute = annotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - String name = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - boolean isMap = JPADiagramPropertyPage.isMapType(owner.getJpaProject().getProject()); - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - isMap ? JpaArtifactFactory.instance().getIdType(inverse) : null, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, true, - ownerCU, - inverseCU); - JpaArtifactFactory.instance().addOneToManyUnidirectionalRelation(fp, owner, ownerAnnotatedAttribute, isMap); - } - - public RelDir getRelDir() { - return RelDir.UNI; - } - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java deleted file mode 100644 index eae7ccccc9..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneBiDirRelation.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class OneToOneBiDirRelation extends OneToOneRelation implements BidirectionalRelation{ - public OneToOneBiDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - String inverseAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - this.inverseAttributeName = inverseAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - } - - public JavaPersistentAttribute getOwnerAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setOwnerAnnotatedAttribute( - JavaPersistentAttribute ownerAnnotatedAttribute) { - this.ownerAnnotatedAttribute = ownerAnnotatedAttribute; - } - - public JavaPersistentAttribute getInverseAnnotatedAttribute() { - return inverseAnnotatedAttribute; - } - - public void setInverseAnnotatedAttribute( - JavaPersistentAttribute inverseAnnotatedAttribute) { - this.inverseAnnotatedAttribute = inverseAnnotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, ICompilationUnit inverseCU) { - String name = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, false, - ownerCU, - inverseCU); - - name = JPAEditorUtil.returnSimpleName(owner.getName()); - actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(owner)); - nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(inverse)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(inverse, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(inverse, actNameWithNonCapitalLetter); - inverseAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, inverse, owner, - nameWithNonCapitalLetter, actNameWithNonCapitalLetter, - false, - inverseCU, - ownerCU); - - JpaArtifactFactory.instance().addOneToOneBidirectionalRelation(fp, owner, ownerAnnotatedAttribute, inverse, inverseAnnotatedAttribute); - } - - public RelDir getRelDir() { - return RelDir.BI; - } - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneRelation.java deleted file mode 100644 index 12119f3008..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneRelation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -abstract public class OneToOneRelation extends AbstractRelation { - - public OneToOneRelation(JavaPersistentType owner, - JavaPersistentType inverse) { - super(owner, inverse); - } - - public RelType getRelType() { - return RelType.ONE_TO_ONE; - } - -} diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneUniDirRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneUniDirRelation.java deleted file mode 100644 index b429068394..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/OneToOneUniDirRelation.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; -import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; - - -public class OneToOneUniDirRelation extends OneToOneRelation implements UnidirectionalRelation { - - public OneToOneUniDirRelation(IJPAEditorFeatureProvider fp, JavaPersistentType owner, - JavaPersistentType inverse, - String ownerAttributeName, - boolean createAttribs, - ICompilationUnit ownerCU, - ICompilationUnit inverseCU) { - super(owner, inverse); - this.ownerAttributeName = ownerAttributeName; - if (createAttribs) - createRelation(fp, ownerCU, inverseCU); - } - - public JavaPersistentAttribute getAnnotatedAttribute() { - return ownerAnnotatedAttribute; - } - - public void setAnnotatedAttribute(JavaPersistentAttribute annotatedAttribute) { - this.ownerAnnotatedAttribute = annotatedAttribute; - } - - private void createRelation(IJPAEditorFeatureProvider fp, ICompilationUnit ownerCU, ICompilationUnit inverseCU) { - String name = JPAEditorUtil.returnSimpleName(inverse.getName()); - String actName = JPAEditorUtil.returnSimpleName(JpaArtifactFactory.instance().getEntityName(inverse)); - - String nameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(name); - String actNameWithNonCapitalLetter = JPAEditorUtil.decapitalizeFirstLetter(actName); - - if (JpaArtifactFactory.instance().isMethodAnnotated(owner)) { - nameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(name); - actNameWithNonCapitalLetter = JPAEditorUtil.produceValidAttributeName(actName); - } - nameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, nameWithNonCapitalLetter); - actNameWithNonCapitalLetter = JPAEditorUtil.produceUniqueAttributeName(owner, actNameWithNonCapitalLetter); - - ownerAnnotatedAttribute = JpaArtifactFactory.instance().addAttribute(fp, owner, inverse, - nameWithNonCapitalLetter, - actNameWithNonCapitalLetter, false, - ownerCU, - inverseCU); - JpaArtifactFactory.instance().addOneToOneUnidirectionalRelation(fp, owner, ownerAnnotatedAttribute); - - } - - public RelDir getRelDir() { - return RelDir.UNI; - } - -}
\ No newline at end of file diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/UnidirectionalRelation.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/UnidirectionalRelation.java deleted file mode 100644 index 7ffb85a51e..0000000000 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/relations/UnidirectionalRelation.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * <copyright> - * - * Copyright (c) 2005, 2010 SAP AG. - * 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: - * Stefan Dimov - initial API, implementation and documentation - * - * </copyright> - * - *******************************************************************************/ -package org.eclipse.jpt.jpadiagrameditor.ui.internal.relations; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; - -public interface UnidirectionalRelation extends IRelation { - - public abstract JavaPersistentAttribute getAnnotatedAttribute(); - - public abstract void setAnnotatedAttribute(JavaPersistentAttribute at); - -}
\ No newline at end of file |