Author: vyemialyanchyk
Date: 2010-06-10 12:11:40 -0400 (Thu, 10 Jun 2010)
New Revision: 22727
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Employee.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/EmployeeStatus.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/SalaryRate.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Employee.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/EmployeeStatus.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/SalaryRate.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Employee.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/EmployeeStatus.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/SalaryRate.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Employee.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/EmployeeStatus.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/SalaryRate.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapMockTests.java
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6058 - fixed
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/AllEntitiesInfoCollector.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -609,6 +609,7 @@
boolean isOne2Many = false;
boolean isMany2One = false;
boolean isMany2Many = false;
+ boolean isEnumerated = false;
for ( ; referencesIt.hasNext(); ) {
Map.Entry<String, RefEntityInfo> entry2 = referencesIt.next();
RefEntityInfo refEntityInfo = entry2.getValue();
@@ -625,6 +626,9 @@
else if (refEntityInfo.refType == RefType.MANY2MANY &&
!refEntityInfo.resolvedAnnotationName) {
isMany2Many = true;
}
+ else if (refEntityInfo.refType == RefType.ENUMERATED &&
!refEntityInfo.resolvedAnnotationName) {
+ isEnumerated = true;
+ }
}
}
if (isOne2One) {
@@ -639,6 +643,9 @@
if (isMany2Many) {
entryInfo.addRequiredImport(JPAConst.IMPORT_MANY2MANY);
}
+ if (isEnumerated) {
+ entryInfo.addRequiredImport(JPAConst.IMPORT_ENUMERATED);
+ }
}
// re-generate RefFieldInfoMap (for simple process)
it = mapCUs_Info.entrySet().iterator();
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/collect/CollectEntityInfo.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -173,6 +173,10 @@
updateAnnotationRelInfo(node, mappedBy, fullyQualifiedName,
RefType.MANY2MANY, JPAConst.ANNOTATION_MANY2MANY, JPAConst.IMPORT_MANY2MANY);
}
+ else if (JPAConst.isAnnotationEnumerated(fullyQualifiedName)) {
+ updateAnnotationRelInfo(node, mappedBy, fullyQualifiedName,
+ RefType.ENUMERATED, JPAConst.ANNOTATION_ENUMERATED, JPAConst.IMPORT_ENUMERATED);
+ }
else if (JPAConst.isAnnotationMappedSuperclass(fullyQualifiedName)) {
ITypeBinding tb = node.resolveTypeBinding();
CompilationUnit cu = getCUFromTypeDeclaration(node);
@@ -477,10 +481,11 @@
SourceType sourceT = (SourceType)tb.getJavaElement();
entityFullyQualifiedName = sourceT.getFullyQualifiedName();
entityInfo.addDependency(entityFullyQualifiedName);
+ RefType refType2Use = tb.isEnum() ? RefType.ENUMERATED : RefType.MANY2ONE;
Iterator<String> itVarNames = list.iterator();
while (itVarNames.hasNext()) {
String name = itVarNames.next();
- entityInfo.addReference(name, entityFullyQualifiedName, RefType.MANY2ONE);
+ entityInfo.addReference(name, entityFullyQualifiedName, refType2Use);
}
}
else if (tb.getJavaElement() instanceof BinaryType) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/JPAConst.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -19,6 +19,7 @@
public static final String IMPORT_ONE2MANY = "javax.persistence.OneToMany";
//$NON-NLS-1$
public static final String IMPORT_MANY2ONE = "javax.persistence.ManyToOne";
//$NON-NLS-1$
public static final String IMPORT_MANY2MANY = "javax.persistence.ManyToMany";
//$NON-NLS-1$
+ public static final String IMPORT_ENUMERATED = "javax.persistence.Enumerated";
//$NON-NLS-1$
public static final String IMPORT_MAPPEDSUPERCLASS =
"javax.persistence.MappedSuperclass"; //$NON-NLS-1$
public static final String IMPORT_VERSION = "javax.persistence.Version";
//$NON-NLS-1$
public static final String IMPORT_COLUMN = "javax.persistence.Column";
//$NON-NLS-1$
@@ -32,6 +33,7 @@
public static final String ANNOTATION_ONE2MANY = "OneToMany"; //$NON-NLS-1$
public static final String ANNOTATION_MANY2ONE = "ManyToOne"; //$NON-NLS-1$
public static final String ANNOTATION_MANY2MANY = "ManyToMany"; //$NON-NLS-1$
+ public static final String ANNOTATION_ENUMERATED = "Enumerated";
//$NON-NLS-1$
public static final String ANNOTATION_MAPPEDSUPERCLASS = "MappedSuperclass";
//$NON-NLS-1$
public static final String ANNOTATION_VERSION = "Version"; //$NON-NLS-1$
public static final String ANNOTATION_COLUMN = "Column"; //$NON-NLS-1$
@@ -48,6 +50,7 @@
ALL_IMPORTS.add(IMPORT_ONE2MANY);
ALL_IMPORTS.add(IMPORT_MANY2ONE);
ALL_IMPORTS.add(IMPORT_MANY2MANY);
+ ALL_IMPORTS.add(IMPORT_ENUMERATED);
ALL_IMPORTS.add(IMPORT_MAPPEDSUPERCLASS);
ALL_IMPORTS.add(IMPORT_VERSION);
ALL_IMPORTS.add(IMPORT_COLUMN);
@@ -66,6 +69,9 @@
else if (refType == RefType.MANY2MANY) {
return ANNOTATION_MANY2MANY;
}
+ else if (refType == RefType.ENUMERATED) {
+ return ANNOTATION_ENUMERATED;
+ }
return ""; //$NON-NLS-1$
}
@@ -125,6 +131,14 @@
return false;
}
+ static public boolean isAnnotationEnumerated(String fullyQualifiedName) {
+ if (ANNOTATION_ENUMERATED.compareTo(fullyQualifiedName) == 0 ||
+ IMPORT_ENUMERATED.compareTo(fullyQualifiedName) == 0) {
+ return true;
+ }
+ return false;
+ }
+
static public boolean isAnnotationMappedSuperclass(String fullyQualifiedName) {
if (ANNOTATION_MAPPEDSUPERCLASS.compareTo(fullyQualifiedName) == 0 ||
IMPORT_MAPPEDSUPERCLASS.compareTo(fullyQualifiedName) == 0) {
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/common/RefType.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -21,4 +21,5 @@
ONE2MANY,
MANY2ONE,
MANY2MANY,
+ ENUMERATED,
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/jpa/process/ProcessEntityInfo.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -447,7 +447,8 @@
addComplexNormalAnnotation(node, JPAConst.getRefType(refType), rei);
}
}
- else if (refType == RefType.MANY2ONE || rei.mappedBy == null || rei.mappedBy ==
"") { //$NON-NLS-1$
+ else if (refType == RefType.MANY2ONE || refType == RefType.ENUMERATED ||
+ rei.mappedBy == null || rei.mappedBy == "") { //$NON-NLS-1$
addSimpleMarkerAnnotation(node, JPAConst.getRefType(refType));
}
else {
@@ -578,7 +579,8 @@
addComplexNormalAnnotation(node, JPAConst.getRefType(refType), rei);
}
}
- else if (refType == RefType.MANY2ONE || rei.mappedBy == null || rei.mappedBy ==
"") { //$NON-NLS-1$
+ else if (refType == RefType.MANY2ONE || refType == RefType.ENUMERATED ||
+ rei.mappedBy == null || rei.mappedBy == "") { //$NON-NLS-1$
addSimpleMarkerAnnotation(node, JPAConst.getRefType(refType));
}
else {
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Employee.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Employee.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/Employee.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import javax.persistence.Entity;
+import javax.persistence.Version;
+
+@Entity
+public class Employee {
+
+ protected EmployeeStatus employeeStatus = EmployeeStatus.CONTRACT;
+ protected SalaryRate salaryRate = SalaryRate.EXECUTIVE;
+
+ public EmployeeStatus getStatus() {
+ return employeeStatus;
+ }
+
+ public SalaryRate getPayScale() {
+ return salaryRate;
+ }
+
+ protected Integer version;
+
+ @Version
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/EmployeeStatus.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/EmployeeStatus.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/EmployeeStatus.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/SalaryRate.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/SalaryRate.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/fields/SalaryRate.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Employee.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Employee.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/Employee.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import javax.persistence.Entity;
+import javax.persistence.Version;
+
+@Entity
+public class Employee {
+
+ protected EmployeeStatus employeeStatus = EmployeeStatus.CONTRACT;
+ protected SalaryRate salaryRate = SalaryRate.EXECUTIVE;
+
+ public EmployeeStatus getStatus() {
+ return employeeStatus;
+ }
+
+ public SalaryRate getPayScale() {
+ return salaryRate;
+ }
+
+ protected Integer version;
+
+ @Version
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/EmployeeStatus.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/EmployeeStatus.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/EmployeeStatus.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/SalaryRate.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/SalaryRate.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/project/test/annotated/getters/SalaryRate.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Employee.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Employee.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/Employee.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+import javax.persistence.Entity;
+import javax.persistence.Enumerated;
+import javax.persistence.Version;
+
+@Entity
+public class Employee {
+
+ @Enumerated
+ protected EmployeeStatus employeeStatus = EmployeeStatus.CONTRACT;
+ @Enumerated
+ protected SalaryRate salaryRate = SalaryRate.EXECUTIVE;
+
+ public EmployeeStatus getStatus() {
+ return employeeStatus;
+ }
+
+ public SalaryRate getPayScale() {
+ return salaryRate;
+ }
+
+ protected Integer version;
+
+ @Version
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/EmployeeStatus.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/EmployeeStatus.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/EmployeeStatus.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/SalaryRate.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/SalaryRate.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/fields/SalaryRate.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.fields;
+
+public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Employee.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Employee.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/Employee.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+import javax.persistence.Entity;
+import javax.persistence.Enumerated;
+import javax.persistence.Version;
+
+@Entity
+public class Employee {
+
+ protected EmployeeStatus employeeStatus = EmployeeStatus.CONTRACT;
+ protected SalaryRate salaryRate = SalaryRate.EXECUTIVE;
+
+ @Enumerated
+ public EmployeeStatus getStatus() {
+ return employeeStatus;
+ }
+
+ @Enumerated
+ public SalaryRate getPayScale() {
+ return salaryRate;
+ }
+
+ protected Integer version;
+
+ @Version
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/EmployeeStatus.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/EmployeeStatus.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/EmployeeStatus.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public enum EmployeeStatus {FULL_TIME, PART_TIME, CONTRACT}
Added:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/SalaryRate.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/SalaryRate.java
(rev 0)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/res/specimen/test/annotated/getters/SalaryRate.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package test.annotated.getters;
+
+public enum SalaryRate {JUNIOR, SENIOR, MANAGER, EXECUTIVE}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapMockTests.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapMockTests.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapMockTests.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -37,7 +37,6 @@
*
* @author Vitali Yemialyanchyk
*/
-@SuppressWarnings("restriction")
public class JPAMapMockTests extends TestCase {
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2010-06-10
15:48:17 UTC (rev 22726)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.jdt.ui.test/src/org/hibernate/eclipse/jdt/ui/test/JPAMapTest.java 2010-06-10
16:11:40 UTC (rev 22727)
@@ -46,7 +46,6 @@
*
* @author Vitali Yemialyanchyk
*/
-@SuppressWarnings("restriction")
public class JPAMapTest extends TestCase {
public static final String PROJECT_NAME = "TestProject"; //$NON-NLS-1$
@@ -111,6 +110,8 @@
"test.annotated." + testSelection + ".FotoXPerson");
//$NON-NLS-1$ //$NON-NLS-2$
ICompilationUnit icu4 = Utils.findCompilationUnit(javaProject,
"test.annotated." + testSelection + ".ZTypesComplex");
//$NON-NLS-1$ //$NON-NLS-2$
+ ICompilationUnit icu5 = Utils.findCompilationUnit(javaProject,
+ "test.annotated." + testSelection + ".Employee"); //$NON-NLS-1$
//$NON-NLS-2$
try {
icu4.becomeWorkingCopy(null);
} catch (JavaModelException e) {
@@ -129,11 +130,13 @@
assertNotNull(icu2);
assertNotNull(icu3);
assertNotNull(icu4);
+ assertNotNull(icu5);
collector.initCollector();
collector.collect(icu, Integer.MAX_VALUE);
collector.collect(icu2, Integer.MAX_VALUE);
collector.collect(icu3, Integer.MAX_VALUE);
collector.collect(icu4, Integer.MAX_VALUE);
+ collector.collect(icu5, Integer.MAX_VALUE);
if (icu44 != null) {
collector.collect(icu44, Integer.MAX_VALUE);
}
@@ -152,6 +155,7 @@
checkItem("Country"); //$NON-NLS-1$
checkItem("Visa"); //$NON-NLS-1$
checkItem("ZTypesComplex"); //$NON-NLS-1$
+ checkItem("Employee"); //$NON-NLS-1$
if (icu44 != null) {
checkItem("Entity"); //$NON-NLS-1$
}