Author: dgeraskov
Date: 2009-07-09 09:37:41 -0400 (Thu, 09 Jul 2009)
New Revision: 16518
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateNamedQueryImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/CacheModeType.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/FlushModeType.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQuery.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateQueryContainer.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotationDefinition.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueriesAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAddQueryDialog.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateNamedQueryPropertyComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateQueriesComposite.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJavaNamedQueryImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaNamedQuery.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQueryAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateSourceNamedQueryAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/java/details/HibernateJavaEntityComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/persistence/details/HibernatePropertiesComposite.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4521
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJavaNamedQueryImpl.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJavaNamedQueryImpl.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJavaNamedQueryImpl.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaNamedQuery;
-import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaNamedQuery;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public class HibernateJavaNamedQueryImpl extends GenericJavaNamedQuery
- implements HibernateJavaNamedQuery {
-
- /**
- * @param parent
- */
- public HibernateJavaNamedQueryImpl(JavaJpaContextNode parent) {
- super(parent);
- }
-
-
-}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -17,6 +17,7 @@
import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryAnnotationDefinition;
import
org.jboss.tools.hibernate.jpt.core.internal.context.java.GenericGeneratorAnnotationImpl.GenericGeneratorAnnotationDefinition;
+import
org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueriesAnnotationDefinition;
/**
* @author Dmitry Geraskov
@@ -49,6 +50,7 @@
protected void addTypeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition>
definitions) {
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(HibernateNamedQueryAnnotationDefinition.instance());
+ definitions.add(HibernateNamedQueriesAnnotationDefinition.instance());
}
@Override
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -13,7 +13,6 @@
import org.eclipse.jpt.core.context.java.JavaEntity;
import org.eclipse.jpt.core.context.java.JavaIdMapping;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.persistence.Persistence;
@@ -23,6 +22,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntity;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaIdMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaParameter;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaGenericGenerator;
import
org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaGenericGeneratorImpl;
@@ -54,8 +54,8 @@
return new JavaGenericGeneratorImpl(parent);
}
- public JavaNamedQuery buildHibernateJavaNamedQuery(JavaJpaContextNode parent) {
- return new HibernateJavaNamedQueryImpl(parent);
+ public HibernateNamedQuery buildHibernateNamedQuery(JavaJpaContextNode parent) {
+ return new HibernateNamedQueryImpl(parent);
}
public JavaParameter buildJavaParameter(JavaGenericGeneratorImpl
javaGenericGeneratorImpl) {
Copied:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateNamedQueryImpl.java
(from rev 16282,
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJavaNamedQueryImpl.java)
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateNamedQueryImpl.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateNamedQueryImpl.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal;
+
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaNamedQuery;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.CacheModeType;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.FlushModeType;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQuery;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateNamedQueryImpl extends GenericJavaNamedQuery
+ implements HibernateNamedQuery {
+
+ private FlushModeType specifiedFlushMode;
+
+ private CacheModeType specifiedCacheMode;
+
+ private Boolean specifiedCacheable;
+
+ private String specifiedCacheRegion;
+
+ private Integer specifiedFetchSize;
+
+ private Integer specifiedTimeout;
+
+ private String specifiedComment;
+
+ private Boolean specifiedReadOnly;
+
+ /**
+ * @param parent
+ */
+ public HibernateNamedQueryImpl(JavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ public void initialize(HibernateNamedQueryAnnotation resourceQuery) {
+ this.specifiedFlushMode = this.getResourceFlushMode(resourceQuery);
+ this.specifiedCacheMode = this.getResourceCacheMode(resourceQuery);
+ this.specifiedCacheable = resourceQuery.isCacheable();
+ this.specifiedCacheRegion = resourceQuery.getCacheRegion();
+ this.specifiedFetchSize = resourceQuery.getFetchSize();
+ this.specifiedTimeout = resourceQuery.getTimeout();
+ this.specifiedComment = resourceQuery.getComment();
+ this.specifiedReadOnly = resourceQuery.isReadOnly();
+ super.initialize(resourceQuery);
+ }
+
+ public void update(HibernateNamedQueryAnnotation resourceQuery) {
+ this.setFlushMode_(resourceQuery.getFlushMode());
+ this.setCacheMode_ (resourceQuery.getCacheMode());
+ this.setSpecifiedCacheable_(resourceQuery.isCacheable());
+ this.setSpecifiedCacheRegion_(resourceQuery.getCacheRegion());
+ this.setSpecifiedFetchSize_(resourceQuery.getFetchSize());
+ this.setSpecifiedTimeout_(resourceQuery.getTimeout());
+ this.setSpecifiedComment_(resourceQuery.getComment());
+ this.setSpecifiedReadOnly_(resourceQuery.isReadOnly());
+ super.update(resourceQuery);
+ }
+
+ private CacheModeType getResourceCacheMode(HibernateNamedQueryAnnotation resourceQuery)
{
+ return CacheModeType.fromJavaAnnotationValue(resourceQuery);
+ }
+
+ private FlushModeType getResourceFlushMode(HibernateNamedQueryAnnotation resourceQuery)
{
+ return FlushModeType.fromJavaAnnotationValue(resourceQuery);
+ }
+
+ @Override
+ protected HibernateNamedQueryAnnotation getResourceQuery() {
+ return (HibernateNamedQueryAnnotation) super.getResourceQuery();
+ }
+
+ // ****** flushMode
+ public FlushModeType getFlushMode() {
+ return getSpecifiedFlushMode() == null ? getDefaultFlushMode() :
getSpecifiedFlushMode();
+ }
+
+ public FlushModeType getSpecifiedFlushMode() {
+ return specifiedFlushMode;
+ }
+
+ public FlushModeType getDefaultFlushMode() {
+ return HibernateNamedQuery.DEFAULT_FLUSH_MODE_TYPE;
+ }
+
+ public void setSpecifiedFlushMode(FlushModeType flushMode) {
+ FlushModeType oldFlushMode = this.specifiedFlushMode;
+ this.specifiedFlushMode = flushMode;
+ getResourceQuery().setFlushMode(flushMode);
+ firePropertyChanged(SPECIFIED_FLUSH_MODE_PROPERTY, oldFlushMode, flushMode);
+ }
+
+ protected void setFlushMode_(FlushModeType flushMode) {
+ FlushModeType oldFlushMode = this.specifiedFlushMode;
+ this.specifiedFlushMode = flushMode;
+ firePropertyChanged(SPECIFIED_FLUSH_MODE_PROPERTY, oldFlushMode, flushMode);
+ }
+ // ****** cacheMode
+ public CacheModeType getCacheMode() {
+ return getSpecifiedCacheMode() == null ? getDefaultCacheMode() :
getSpecifiedCacheMode();
+ }
+
+ public CacheModeType getDefaultCacheMode() {
+ return HibernateNamedQuery.DEFAULT_CACHE_MODE_TYPE;
+ }
+
+ public CacheModeType getSpecifiedCacheMode() {
+ return specifiedCacheMode;
+ }
+
+ public void setSpecifiedCacheMode(CacheModeType cacheMode) {
+ CacheModeType oldCacheMode = this.specifiedCacheMode;
+ this.specifiedCacheMode = cacheMode;
+ getResourceQuery().setCacheMode(cacheMode);
+ firePropertyChanged(SPECIFIED_CACHE_MODE_PROPERTY, oldCacheMode, cacheMode);
+ }
+
+ public void setCacheMode_(CacheModeType cacheMode) {
+ CacheModeType oldCacheMode = this.specifiedCacheMode;
+ this.specifiedCacheMode = cacheMode;
+ firePropertyChanged(SPECIFIED_CACHE_MODE_PROPERTY, oldCacheMode, cacheMode);
+ }
+ //************************ cacheable *********************************
+ public boolean isCacheable(){
+ return (this.getSpecifiedCacheable() == null) ? this.isDefaultCacheable()
+ : this.getSpecifiedCacheable().booleanValue();
+ }
+
+ public Boolean getSpecifiedCacheable(){
+ return this.specifiedCacheable;
+ }
+
+ public void setSpecifiedCacheable(Boolean newSpecifiedCacheable) {
+ Boolean oldSpecifiedCacheable = this.specifiedCacheable;
+ this.specifiedCacheable = newSpecifiedCacheable;
+ this.getResourceQuery().setCacheable(newSpecifiedCacheable);
+ firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, oldSpecifiedCacheable,
newSpecifiedCacheable);
+
+ }
+
+ public void setSpecifiedCacheable_(Boolean newSpecifiedCacheable) {
+ Boolean oldSpecifiedCacheable = this.specifiedCacheable;
+ this.specifiedCacheable = newSpecifiedCacheable;
+ firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, oldSpecifiedCacheable,
newSpecifiedCacheable);
+ }
+
+ public boolean isDefaultCacheable() {
+ return HibernateNamedQuery.DEFAULT_CACHEABLE;
+ }
+ //************************ cacheRegion *********************************
+ public String getCacheRegion(){
+ return (getSpecifiedCacheRegion() == null ? getDefaultCacheRegion()
+ : getSpecifiedCacheRegion());
+ }
+ public String getSpecifiedCacheRegion(){
+ return this.specifiedCacheRegion;
+ }
+
+ public void setSpecifiedCacheRegion(String cacheRegion){
+ String oldSpecifiedCacheRegion = this.specifiedCacheRegion;
+ this.specifiedCacheRegion = cacheRegion;
+ this.getResourceQuery().setCacheRegion(cacheRegion);
+ firePropertyChanged(SPECIFIED_CACHE_REGION_PROPERTY, oldSpecifiedCacheRegion,
cacheRegion);
+ }
+
+ public void setSpecifiedCacheRegion_(String cacheRegion){
+ String oldSpecifiedCacheRegion = this.specifiedCacheRegion;
+ this.specifiedCacheRegion = cacheRegion;
+ firePropertyChanged(SPECIFIED_CACHE_REGION_PROPERTY, oldSpecifiedCacheRegion,
cacheRegion);
+ }
+
+ public String getDefaultCacheRegion(){
+ return HibernateNamedQuery.DEFAULT_CACHE_REGION;
+ }
+ //************************ fetchSize *********************************
+ public int getFetchSize(){
+ return (getSpecifiedFetchSize() == null ? getDefaultFetchSize()
+ : getSpecifiedFetchSize().intValue());
+ }
+
+ public Integer getSpecifiedFetchSize(){
+ return this.specifiedFetchSize;
+ }
+
+ public void setSpecifiedFetchSize(Integer newSpecifiedFetchSize){
+ Integer oldSpecifiedFetchSize = this.specifiedFetchSize;
+ this.specifiedFetchSize = newSpecifiedFetchSize;
+ this.getResourceQuery().setFetchSize(newSpecifiedFetchSize);
+ firePropertyChanged(SPECIFIED_FETCH_SIZE_PROPERTY, oldSpecifiedFetchSize,
newSpecifiedFetchSize);
+ }
+
+ public void setSpecifiedFetchSize_(Integer fetchSize){
+ Integer oldSpecifiedFetchSize = this.specifiedFetchSize;
+ this.specifiedFetchSize = fetchSize;
+ firePropertyChanged(SPECIFIED_FETCH_SIZE_PROPERTY, oldSpecifiedFetchSize, fetchSize);
+ }
+
+ public int getDefaultFetchSize(){
+ return HibernateNamedQuery.DEFAULT_FETCH_SIZE;
+ }
+ //************************ timeout *********************************
+ public int getTimeout(){
+ return (getSpecifiedTimeout() == null ? getDefaultTimeout()
+ : getSpecifiedTimeout().intValue());
+ }
+
+ public Integer getSpecifiedTimeout(){
+ return this.specifiedTimeout;
+ }
+
+ public void setSpecifiedTimeout(Integer newSpecifiedTimeout){
+ Integer oldSpecifiedTimeout = this.specifiedTimeout;
+ this.specifiedTimeout = newSpecifiedTimeout;
+ this.getResourceQuery().setTimeout(newSpecifiedTimeout);
+ firePropertyChanged(SPECIFIED_TIMEOUT_PROPERTY, oldSpecifiedTimeout,
newSpecifiedTimeout);
+ }
+
+ public void setSpecifiedTimeout_(Integer timeout){
+ Integer oldSpecifiedTimeout = this.specifiedTimeout;
+ this.specifiedTimeout = timeout;
+ firePropertyChanged(SPECIFIED_TIMEOUT_PROPERTY, oldSpecifiedTimeout, timeout);
+ }
+
+ public int getDefaultTimeout(){
+ return HibernateNamedQuery.DEFAULT_TIMEOUT;
+ }
+ //************************ comment *********************************
+ public String getComment(){
+ return (getSpecifiedComment() == null ? getDefaultComment()
+ : getSpecifiedComment());
+ }
+ public String getSpecifiedComment(){
+ return this.specifiedComment;
+ }
+
+ public void setSpecifiedComment(String newSpecifiedComment){
+ String oldSpecifiedComment = this.specifiedComment;
+ this.specifiedComment = newSpecifiedComment;
+ this.getResourceQuery().setComment(newSpecifiedComment);
+ firePropertyChanged(SPECIFIED_COMMENT_PROPERTY, oldSpecifiedComment,
newSpecifiedComment);
+ }
+
+ public void setSpecifiedComment_(String comment){
+ String oldSpecifiedComment = this.specifiedComment;
+ this.specifiedComment = comment;
+ firePropertyChanged(SPECIFIED_COMMENT_PROPERTY, oldSpecifiedComment, comment);
+ }
+
+ public String getDefaultComment(){
+ return HibernateNamedQuery.DEFAULT_COMMENT;
+ }
+
+ //************************ readOnly *********************************
+ public boolean isReadOnly(){
+ return (getSpecifiedReadOnly() == null ? isDefaultReadOnly()
+ : getSpecifiedReadOnly().booleanValue());
+ }
+
+ public Boolean getSpecifiedReadOnly(){
+ return this.specifiedReadOnly;
+ }
+
+ public void setSpecifiedReadOnly(Boolean newSpecifiedReadOnly){
+ Boolean oldSpecifiedReadOnly = this.specifiedReadOnly;
+ this.specifiedReadOnly = newSpecifiedReadOnly;
+ this.getResourceQuery().setReadOnly(newSpecifiedReadOnly);
+ firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldSpecifiedReadOnly,
newSpecifiedReadOnly);
+ }
+
+ public void setSpecifiedReadOnly_(Boolean readOnly){
+ Boolean oldSpecifiedReadOnly = this.specifiedReadOnly;
+ this.specifiedReadOnly = readOnly;
+ firePropertyChanged(SPECIFIED_READ_ONLY_PROPERTY, oldSpecifiedReadOnly, readOnly);
+ }
+
+ public boolean isDefaultReadOnly(){
+ return HibernateNamedQuery.DEFAULT_READ_ONLY;
+ }
+}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -36,8 +36,33 @@
String NAMED_QUERY__NAME = "name"; //$NON-NLS-1$
String NAMED_QUERY__QUERY = "query"; //$NON-NLS-1$
String NAMED_QUERY__HINTS = "hints"; //$NON-NLS-1$
+ String NAMED_QUERY__FLUSH_MODE = "flushMode"; //$NON-NLS-1$
+ String NAMED_QUERY__CACHE_MODE = "cacheMode"; //$NON-NLS-1$
+ String NAMED_QUERY__CACHEABLE = "cacheable"; //$NON-NLS-1$
+ String NAMED_QUERY__CACHE_REGION = "cacheRegion"; //$NON-NLS-1$
+ String NAMED_QUERY__FETCH_SIZE = "fetchSize"; //$NON-NLS-1$
+ String NAMED_QUERY__TIMEOUT = "timeout"; //$NON-NLS-1$
+ String NAMED_QUERY__COMMENT = "comment"; //$NON-NLS-1$
+ String NAMED_QUERY__READ_ONLY = "readOnly"; //$NON-NLS-1$
String NAMED_QUERIES = PACKAGE_ + "NamedQueries"; //$NON-NLS-1$
String NAMED_QUERIES__VALUE = "value"; //$NON-NLS-1$
+
+ String FLUSH_MODE_TYPE = PACKAGE_ + "FlushModeType"; //$NON-NLS-1$
+ String FLUSH_MODE_TYPE_ = FLUSH_MODE_TYPE + '.';
+ String FLUSH_MODE_TYPE__ALWAYS = FLUSH_MODE_TYPE_ + "ALWAYS"; //$NON-NLS-1$
+ String FLUSH_MODE_TYPE__AUTO = FLUSH_MODE_TYPE_ + "AUTO"; //$NON-NLS-1$
+ String FLUSH_MODE_TYPE__COMMIT = FLUSH_MODE_TYPE_ + "COMMIT"; //$NON-NLS-1$
+ String FLUSH_MODE_TYPE__NEVER = FLUSH_MODE_TYPE_ + "NEVER"; //$NON-NLS-1$
+ String FLUSH_MODE_TYPE__MANUAL = FLUSH_MODE_TYPE_ + "MANUAL"; //$NON-NLS-1$
+
+ String CACHE_MODE_TYPE = PACKAGE_ + "CacheModeType"; //$NON-NLS-1$
+ String CACHE_MODE_TYPE_ = CACHE_MODE_TYPE + '.';
+ String CACHE_MODE_TYPE__GET = CACHE_MODE_TYPE_ + "GET"; //$NON-NLS-1$
+ String CACHE_MODE_TYPE__IGNORE = CACHE_MODE_TYPE_ + "IGNORE"; //$NON-NLS-1$
+ String CACHE_MODE_TYPE__NORMAL = CACHE_MODE_TYPE_ + "NORMAL"; //$NON-NLS-1$
+ String CACHE_MODE_TYPE__PUT = CACHE_MODE_TYPE_ + "PUT"; //$NON-NLS-1$
+ String CACHE_MODE_TYPE__REFRESH = CACHE_MODE_TYPE_ + "REFRESH";
//$NON-NLS-1$
+
}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/CacheModeType.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/CacheModeType.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/CacheModeType.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+/**
+ * Corresponds to the Hibernate enum
+ * org.hibernate.annotations.CacheModeType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public enum CacheModeType {
+
+ GET(Hibernate.CACHE_MODE_TYPE__GET),
+ IGNORE(Hibernate.CACHE_MODE_TYPE__IGNORE),
+ NORMAL(Hibernate.CACHE_MODE_TYPE__NORMAL),
+ PUT(Hibernate.CACHE_MODE_TYPE__PUT),
+ REFRESH(Hibernate.CACHE_MODE_TYPE__REFRESH);
+
+
+ private String javaAnnotationValue;
+
+ CacheModeType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static CacheModeType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null :
fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static CacheModeType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (CacheModeType cacheModeType : CacheModeType.values()) {
+ if (cacheModeType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return cacheModeType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(CacheModeType cacheModeType) {
+ return (cacheModeType == null) ? null : cacheModeType.getJavaAnnotationValue();
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/CacheModeType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/FlushModeType.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/FlushModeType.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/FlushModeType.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+/**
+ * Corresponds to the Hibernate enum
+ * org.hibernate.annotations.FlushModeType
+ *
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public enum FlushModeType {
+
+ ALWAYS(Hibernate.FLUSH_MODE_TYPE__ALWAYS),
+ AUTO(Hibernate.FLUSH_MODE_TYPE__AUTO),
+ COMMIT(Hibernate.FLUSH_MODE_TYPE__COMMIT),
+ NEVER(Hibernate.FLUSH_MODE_TYPE__NEVER),
+ MANUAL(Hibernate.FLUSH_MODE_TYPE__MANUAL);
+
+
+ private String javaAnnotationValue;
+
+ FlushModeType(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+
+ // ********** static methods **********
+
+ public static FlushModeType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null :
fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static FlushModeType fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (FlushModeType flushModeType : FlushModeType.values()) {
+ if (flushModeType.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return flushModeType;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(FlushModeType flushModeType) {
+ return (flushModeType == null) ? null : flushModeType.getJavaAnnotationValue();
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/FlushModeType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -17,41 +17,67 @@
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaGenerator;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaEntity;
+import org.eclipse.jpt.core.context.java.JavaQuery;
+import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.utility.Filter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaFactory;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+import
org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueriesAnnotation;
/**
* @author Dmitry Geraskov
*
*/
-public class HibernateJavaEntity extends GenericJavaEntity implements
GenericGeneratorHolder {
+public class HibernateJavaEntity extends AbstractJavaEntity
+implements GenericGeneratorHolder, HibernateQueryContainer {
protected JavaGenericGenerator genericGenerator;
+ protected final List<HibernateNamedQuery> hibernateNamedQueries;
+
public HibernateJavaEntity(JavaPersistentType parent) {
super(parent);
+ this.hibernateNamedQueries = new ArrayList<HibernateNamedQuery>();
}
@Override
public void initialize(JavaResourcePersistentType resourcePersistentType) {
super.initialize(resourcePersistentType);
this.initializeGenericGenerator();
+ this.initializeHibernateNamedQueries();
}
@Override
+ public void update(JavaResourcePersistentType resourcePersistentType) {
+ super.update(resourcePersistentType);
+ this.updateGenericGenerator();
+ this.updateHibernateNamedQueries();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Iterator<JavaQuery> queries() {
+ return new CompositeIterator<JavaQuery>(super.queries(),
this.hibernateNamedQueries());
+ }
+
+ // ********************* GenericGenerator **************
+ @SuppressWarnings("unchecked")
+ @Override
public Iterator<String> correspondingAnnotationNames() {
- return new CompositeIterator<String>(Hibernate.GENERIC_GENERATOR,
super.correspondingAnnotationNames());
+ return new CompositeIterator<String>(
+ new ArrayIterator<String>(Hibernate.GENERIC_GENERATOR,
+ Hibernate.NAMED_QUERY,
+ Hibernate.NAMED_QUERIES),
+ super.correspondingAnnotationNames());
}
public void setGenericGenerator(JavaGenericGenerator newGenericGenerator) {
@@ -70,20 +96,6 @@
this.genericGenerator = buildGenericGenerator(genericGeneratorResource);
}
}
-
- @Override
- protected void initializeNamedQueries() {
- super.initializeNamedQueries();
- for (ListIterator<NestableAnnotation> stream =
this.javaResourcePersistentType.supportingAnnotations(Hibernate.NAMED_QUERY,
Hibernate.NAMED_QUERIES); stream.hasNext(); ) {
- this.namedQueries.add(buildHibernateNamedQuery((HibernateNamedQueryAnnotation)
stream.next()));
- }
- }
-
- protected JavaNamedQuery buildHibernateNamedQuery(HibernateNamedQueryAnnotation
namedQueryResource) {
- JavaNamedQuery namedQuery = getJpaFactory().buildHibernateJavaNamedQuery(this);
- namedQuery.initialize(namedQueryResource);
- return namedQuery;
- }
protected GenericGeneratorAnnotation getResourceGenericGenerator() {
return (GenericGeneratorAnnotation)
this.javaResourcePersistentType.getSupportingAnnotation(GenericGeneratorAnnotation.ANNOTATION_NAME);
@@ -129,12 +141,6 @@
}
}
- @Override
- public void update(JavaResourcePersistentType resourcePersistentType) {
- super.update(resourcePersistentType);
- updateGenericGenerator();
- }
-
protected void updateGenericGenerator() {
GenericGeneratorAnnotation genericGeneratorResource = getResourceGenericGenerator();
if (genericGeneratorResource == null) {
@@ -151,40 +157,85 @@
}
}
}
-
- @Override
- protected void updateNamedQueries() {
- ListIterator<JavaNamedQuery> queries = namedQueries();
- ListIterator<NestableAnnotation> resourceNamedQueries =
this.javaResourcePersistentType.supportingAnnotations(NamedQueryAnnotation.ANNOTATION_NAME,
NamedQueriesAnnotation.ANNOTATION_NAME);
+ // ********************* NamedQuery **************
+ public ListIterator<HibernateNamedQuery> hibernateNamedQueries() {
+ return new CloneListIterator<HibernateNamedQuery>(this.hibernateNamedQueries);
+ }
+
+ public int hibernateNamedQueriesSize() {
+ return this.hibernateNamedQueries.size();
+ }
+
+ protected void initializeHibernateNamedQueries() {
+ for (ListIterator<NestableAnnotation> stream =
this.javaResourcePersistentType.supportingAnnotations(HibernateNamedQueryAnnotation.ANNOTATION_NAME,
HibernateNamedQueriesAnnotation.ANNOTATION_NAME); stream.hasNext(); ) {
+ this.hibernateNamedQueries.add(buildHibernateNamedQuery((HibernateNamedQueryAnnotation)
stream.next()));
+ }
+ }
+
+ protected HibernateNamedQuery buildHibernateNamedQuery(HibernateNamedQueryAnnotation
namedQueryResource) {
+ HibernateNamedQuery hibernateNamedQuery =
getJpaFactory().buildHibernateNamedQuery(this);
+ hibernateNamedQuery.initialize(namedQueryResource);
+ return hibernateNamedQuery;
+ }
+
+ protected void updateHibernateNamedQueries() {
+ ListIterator<HibernateNamedQuery> queries = hibernateNamedQueries();
+ ListIterator<NestableAnnotation> resourceNamedQueries =
this.javaResourcePersistentType.supportingAnnotations(HibernateNamedQueryAnnotation.ANNOTATION_NAME,
HibernateNamedQueriesAnnotation.ANNOTATION_NAME);
- ListIterator<NestableAnnotation> hibernateNamedQueries =
this.javaResourcePersistentType.supportingAnnotations(Hibernate.NAMED_QUERY,
Hibernate.NAMED_QUERIES);
-
while (queries.hasNext()) {
- JavaNamedQuery namedQuery = queries.next();
- if (namedQuery instanceof HibernateJavaNamedQuery) {
- if (hibernateNamedQueries.hasNext()) {
- namedQuery.update((HibernateNamedQueryAnnotation) hibernateNamedQueries.next());
- } else {
- removeNamedQuery_(namedQuery);
- }
- } else {
- if (resourceNamedQueries.hasNext()) {
- namedQuery.update((NamedQueryAnnotation) resourceNamedQueries.next());
- } else {
- removeNamedQuery_(namedQuery);
- }
- }
+ HibernateNamedQuery hibernateNamedQuery = queries.next();
+ if (resourceNamedQueries.hasNext()) {
+ hibernateNamedQuery.update((HibernateNamedQueryAnnotation)
resourceNamedQueries.next());
+ }
+ else {
+ removeHibernateNamedQuery_(hibernateNamedQuery);
+ }
}
while (resourceNamedQueries.hasNext()) {
- addNamedQuery(buildNamedQuery((NamedQueryAnnotation) resourceNamedQueries.next()));
+ addHibernateNamedQuery(buildHibernateNamedQuery((HibernateNamedQueryAnnotation)
resourceNamedQueries.next()));
}
-
- while (hibernateNamedQueries.hasNext()) {
- addNamedQuery(buildHibernateNamedQuery((HibernateNamedQueryAnnotation)
hibernateNamedQueries.next()));
- }
}
+
+ public HibernateNamedQuery addHibernateNamedQuery(int index) {
+ HibernateNamedQuery hibernateNamedQuery =
getJpaFactory().buildHibernateNamedQuery(this);
+ this.hibernateNamedQueries.add(index, hibernateNamedQuery);
+ HibernateNamedQueryAnnotation hibernateNamedQueryAnnotation =
(HibernateNamedQueryAnnotation) this.javaResourcePersistentType
+ .addSupportingAnnotation(index, HibernateNamedQueryAnnotation.ANNOTATION_NAME,
HibernateNamedQueriesAnnotation.ANNOTATION_NAME);
+ hibernateNamedQuery.initialize(hibernateNamedQueryAnnotation);
+ fireItemAdded(HIBERNATE_NAMED_QUERIES_LIST, index, hibernateNamedQuery);
+ return hibernateNamedQuery;
+ }
+
+ protected void addHibernateNamedQuery(int index, HibernateNamedQuery
hibernateNamedQuery) {
+ addItemToList(index, hibernateNamedQuery, this.hibernateNamedQueries,
HIBERNATE_NAMED_QUERIES_LIST);
+ }
+
+ protected void addHibernateNamedQuery(HibernateNamedQuery hibernateNamedQuery) {
+ this.addHibernateNamedQuery(this.hibernateNamedQueries.size(), hibernateNamedQuery);
+ }
+
+ public void removeHibernateNamedQuery(HibernateNamedQuery hibernateNamedQuery) {
+ removeHibernateNamedQuery(this.hibernateNamedQueries.indexOf(hibernateNamedQuery));
+ }
+
+ public void removeHibernateNamedQuery(int index) {
+ HibernateNamedQuery removedHibernateNamedQuery =
this.hibernateNamedQueries.remove(index);
+ this.javaResourcePersistentType.removeSupportingAnnotation(index,
HibernateNamedQueryAnnotation.ANNOTATION_NAME,
HibernateNamedQueriesAnnotation.ANNOTATION_NAME);
+ fireItemRemoved(HIBERNATE_NAMED_QUERIES_LIST, index, removedHibernateNamedQuery);
+ }
+
+ protected void removeHibernateNamedQuery_(HibernateNamedQuery hibernateNamedQuery) {
+ removeItemFromList(hibernateNamedQuery, this.hibernateNamedQueries,
HIBERNATE_NAMED_QUERIES_LIST);
+ }
+
+ public void moveHibernateNamedQuery(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.hibernateNamedQueries, targetIndex, sourceIndex);
+ this.javaResourcePersistentType.moveSupportingAnnotation(targetIndex, sourceIndex,
HibernateNamedQueriesAnnotation.ANNOTATION_NAME);
+ fireItemMoved(HIBERNATE_NAMED_QUERIES_LIST, targetIndex, sourceIndex);
+ }
+ // ************************* validation ***********************
@Override
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit
astRoot) {
super.validate(messages, reporter, astRoot);
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaNamedQuery.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaNamedQuery.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaNamedQuery.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public interface HibernateJavaNamedQuery extends JavaNamedQuery {
-
-}
Copied:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQuery.java
(from rev 16282,
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaNamedQuery.java)
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQuery.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQuery.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaNamedQuery;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface HibernateNamedQuery extends JavaNamedQuery {
+
+ String HIBERNATE_NAMED_QUERY="hibernateNamedQuery"; //$NON-NLS-1$
+ // **************** flushMode ***************************************************
+
+ FlushModeType getFlushMode();
+ FlushModeType getSpecifiedFlushMode();
+ String SPECIFIED_FLUSH_MODE_PROPERTY = "specifiedFlushMode"; //$NON-NLS-1$
+ FlushModeType getDefaultFlushMode();
+ String DEFAULT_FLUSH_MODE_PROPERTY = "defaultFlushMode"; //$NON-NLS-1$
+ FlushModeType DEFAULT_FLUSH_MODE_TYPE = FlushModeType.AUTO;
+
+ void setSpecifiedFlushMode(FlushModeType flushMode);
+
+ //************************ cacheMode *********************************
+
+ CacheModeType getCacheMode();
+ CacheModeType getSpecifiedCacheMode();
+ String SPECIFIED_CACHE_MODE_PROPERTY = "specifiedCacheMode"; //$NON-NLS-1$
+ CacheModeType getDefaultCacheMode();
+ String DEFAULT_CACHE_MODE_PROPERTY = "defaultCacheMode"; //$NON-NLS-1$
+ CacheModeType DEFAULT_CACHE_MODE_TYPE = CacheModeType.NORMAL;
+
+ void setSpecifiedCacheMode(CacheModeType cacheMode);
+
+ //************************ cacheable *********************************
+ boolean isCacheable();
+ Boolean getSpecifiedCacheable();
+ void setSpecifiedCacheable(Boolean value);
+ String SPECIFIED_CACHEABLE_PROPERTY = "specifiedCacheable"; //$NON-NLS-1$
+
+ boolean isDefaultCacheable();
+ boolean DEFAULT_CACHEABLE = false;
+ String DEFAULT_CACHEABLE_PROPERTY = "defaultCacheable"; //$NON-NLS-1$
+
+ //************************ cacheRegion *********************************
+ String getCacheRegion();
+ String getSpecifiedCacheRegion();
+ void setSpecifiedCacheRegion(String value);
+ String SPECIFIED_CACHE_REGION_PROPERTY = "specifiedCacheRegion";
//$NON-NLS-1$
+
+ String getDefaultCacheRegion();
+ String DEFAULT_CACHE_REGION = ""; //$NON-NLS-1$
+ String DEFAULT_CACHE_REGION_PROPERTY = "defaultCacheRegion"; //$NON-NLS-1$
+
+ //************************ fetchSize *********************************
+ int getFetchSize();
+
+ Integer getSpecifiedFetchSize();
+ void setSpecifiedFetchSize(Integer value);
+ String SPECIFIED_FETCH_SIZE_PROPERTY = "specifiedFetchSize"; //$NON-NLS-1$
+
+ int getDefaultFetchSize();
+ int DEFAULT_FETCH_SIZE = -1;
+ String DEFAULT_FETCH_SIZE_PROPERTY = "defaultFetchSize"; //$NON-NLS-1$
+
+ //************************ timeout *********************************
+ int getTimeout();
+
+ Integer getSpecifiedTimeout();
+ void setSpecifiedTimeout(Integer value);
+ String SPECIFIED_TIMEOUT_PROPERTY = "specifiedTimeout"; //$NON-NLS-1$
+
+ int getDefaultTimeout();
+ int DEFAULT_TIMEOUT = -1;
+ String DEFAULT_TIMEOUT_PROPERTY = "defaultTimeout"; //$NON-NLS-1$
+
+ //************************ comment *********************************
+ String getComment();
+ String getSpecifiedComment();
+ void setSpecifiedComment(String value);
+ String SPECIFIED_COMMENT_PROPERTY = "specifiedComment"; //$NON-NLS-1$
+
+ String getDefaultComment();
+ String DEFAULT_COMMENT = ""; //$NON-NLS-1$
+ String DEFAULT_COMMENT_PROPERTY = "defaultComment"; //$NON-NLS-1$
+
+ //************************ readOnly *********************************
+ boolean isReadOnly();
+ Boolean getSpecifiedReadOnly();
+ void setSpecifiedReadOnly(Boolean value);
+ String SPECIFIED_READ_ONLY_PROPERTY = "specifiedReadOnly"; //$NON-NLS-1$
+
+ boolean isDefaultReadOnly();
+ boolean DEFAULT_READ_ONLY = false;
+ String DEFAULT_READ_ONLY_PROPERTY = "defaultReadOnly"; //$NON-NLS-1$
+}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQueryAnnotation.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQueryAnnotation.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateNamedQueryAnnotation.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -10,12 +10,89 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
/**
* @author Dmitry Geraskov
*
*/
public interface HibernateNamedQueryAnnotation extends NestableNamedQueryAnnotation {
+
+ //replace with Hibernate annotation
+ String ANNOTATION_NAME = Hibernate.NAMED_QUERY;
+
+ //************************ flushMode *********************************
+
+ /**
+ * Corresponds to the 'flushMode' element of the *NamedQuery annotation.
+ * Return null if the element does not exist in Java.
+ */
+ FlushModeType getFlushMode();
+ String FLUSH_MODE_PROPERTY = "flushMode"; //$NON-NLS-1$
+ /**
+ * Corresponds to the 'flushMode' element of the *NamedQuery annotation.
+ * Set to null to remove the element.
+ */
+ void setFlushMode(FlushModeType flushMode);
+
+ /**
+ * Return the {@link TextRange} for the 'flushMode' element. If element
+ * does not exist return the {@link TextRange} for the *NamedQuery annotation.
+ */
+ TextRange getFlushModeTextRange(CompilationUnit astRoot);
+
+ //************************ cacheMode *********************************
+
+ /**
+ * Corresponds to the 'cacheMode' element of the *NamedQuery annotation.
+ * Return null if the element does not exist in Java.
+ */
+ CacheModeType getCacheMode();
+ String CACHE_MODE_PROPERTY = "cacheMode"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'cacheMode' element of the *NamedQuery annotation.
+ * Set to null to remove the element.
+ */
+ void setCacheMode(CacheModeType cacheMode);
+
+ /**
+ * Return the {@link TextRange} for the 'cacheMode' element. If element
+ * does not exist return the {@link TextRange} for the *NamedQuery annotation.
+ */
+ TextRange getCacheModeTextRange(CompilationUnit astRoot);
+
+ //************************ cacheable *********************************
+ Boolean isCacheable();
+ void setCacheable(Boolean value);
+ String CACHEABLE_PROPERTY = "cacheable"; //$NON-NLS-1$
+
+ //************************ cacheRegion *********************************
+ String getCacheRegion();
+ void setCacheRegion(String value);
+ String CACHE_REGION_PROPERTY = "cacheRegion"; //$NON-NLS-1$
+
+ //************************ fetchSize *********************************
+ Integer getFetchSize();
+ void setFetchSize(Integer value);
+ String FETCH_SIZE_PROPERTY = "fetchSize"; //$NON-NLS-1$
+
+ //************************ timeout *********************************
+ Integer getTimeout();
+ void setTimeout(Integer value);
+ String TIMEOUT_PROPERTY = "timeout"; //$NON-NLS-1$
+
+ //************************ comment *********************************
+ String getComment();
+ void setComment(String value);
+ String COMMENT_PROPERTY = "comment"; //$NON-NLS-1$
+
+ //************************ readOnly *********************************
+ Boolean isReadOnly();
+ void setReadOnly(Boolean value);
+ String READ_ONLY_PROPERTY = "readOnly"; //$NON-NLS-1$
}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateQueryContainer.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateQueryContainer.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateQueryContainer.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.core.context.QueryContainer;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface HibernateQueryContainer extends QueryContainer {
+
+ String HIBERNATE_NAMED_QUERIES_LIST = "hibernateNamedQueries"; //$NON-NLS-1$
+ // ********** named queries **********
+
+ /**
+ * Return a list iterator of the named queries.
+ * This will not be null.
+ */
+ <T extends HibernateNamedQuery> ListIterator<T> hibernateNamedQueries();
+
+ /**
+ * Return the number of named queries.
+ */
+ int hibernateNamedQueriesSize();
+
+ /**
+ * Add a named query to the entity return the object representing it.
+ */
+ HibernateNamedQuery addHibernateNamedQuery(int index);
+
+ /**
+ * Remove the named query at the index from the entity.
+ */
+ void removeHibernateNamedQuery(int index);
+
+ /**
+ * Remove the named query at from the entity.
+ */
+ void removeHibernateNamedQuery(HibernateNamedQuery namedQuery);
+
+ /**
+ * Move the named query from the source index to the target index.
+ */
+ void moveHibernateNamedQuery(int targetIndex, int sourceIndex);
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateQueryContainer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateSourceNamedQueryAnnotation.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateSourceNamedQueryAnnotation.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateSourceNamedQueryAnnotation.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -11,17 +11,17 @@
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
import java.util.ListIterator;
-import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
import
org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import
org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
+import
org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.resource.java.BaseNamedQueryAnnotation;
import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.core.resource.java.NestableQueryHintAnnotation;
import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
@@ -31,9 +31,9 @@
import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
/**
@@ -41,43 +41,99 @@
*
*/
public class HibernateSourceNamedQueryAnnotation extends SourceAnnotation<Member>
- implements BaseNamedQueryAnnotation, HibernateNamedQueryAnnotation {
-
- public static String ANNOTATION_NAME = Hibernate.NAMED_QUERY;
+ implements HibernateNamedQueryAnnotation {
- final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
+ public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER =
new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- final DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter;
- final AnnotationElementAdapter<String> queryAdapter;
- String query;
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ private final AnnotationElementAdapter<String> nameAdapter;
+ private String name;
- //FIXME: can't have hints
- final Vector<NestableQueryHintAnnotation> hints = new
Vector<NestableQueryHintAnnotation>();
- //final HintsAnnotationContainer hintsContainer = new HintsAnnotationContainer();
-
- public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER =
new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
+ private final DeclarationAnnotationElementAdapter<String>
queryDeclarationAdapter;
+ private final AnnotationElementAdapter<String> queryAdapter;
+ private String query;
+
+ private final DeclarationAnnotationElementAdapter<String>
flushModeDeclarationAdapter;
+ private final AnnotationElementAdapter<String> flushModeAdapter;
+ private FlushModeType flushMode;
+
+ private final DeclarationAnnotationElementAdapter<String>
cacheModeDeclarationAdapter;
+ private final AnnotationElementAdapter<String> cacheModeAdapter;
+ private CacheModeType cacheMode;
+
+ private final DeclarationAnnotationElementAdapter<Boolean>
cacheableDeclarationAdapter;
+ private final AnnotationElementAdapter<Boolean> cacheableAdapter;
+ private Boolean cacheable;
+
+ private final DeclarationAnnotationElementAdapter<String>
cacheRegionDeclarationAdapter;
+ private final AnnotationElementAdapter<String> cacheRegionAdapter;
+ private String cacheRegion;
+
+ private final DeclarationAnnotationElementAdapter<Integer>
fetchSizeDeclarationAdapter;
+ private final AnnotationElementAdapter<Integer> fetchSizeAdapter;
+ private Integer fetchSize;
+
+ private final DeclarationAnnotationElementAdapter<Integer>
timeoutDeclarationAdapter;
+ private final AnnotationElementAdapter<Integer> timeoutAdapter;
+ private Integer timeout;
+
+ private final DeclarationAnnotationElementAdapter<String>
commentDeclarationAdapter;
+ private final AnnotationElementAdapter<String> commentAdapter;
+ private String comment;
+
+ private final DeclarationAnnotationElementAdapter<Boolean>
readOnlyDeclarationAdapter;
+ private final AnnotationElementAdapter<Boolean> readOnlyAdapter;
+ private Boolean readOnly;
+
HibernateSourceNamedQueryAnnotation(JavaResourceNode parent, Member
member,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
super(parent, member, daa, annotationAdapter);
this.nameDeclarationAdapter = this.buildNameAdapter(daa);
+ this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
this.queryDeclarationAdapter = this.buildQueryAdapter(daa);
- this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
this.queryAdapter = this.buildAdapter(this.queryDeclarationAdapter);
+ this.flushModeDeclarationAdapter = this.buildFlushModeAdapter(daa);
+ this.flushModeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member,
flushModeDeclarationAdapter);
+ this.cacheModeDeclarationAdapter = this.buildCacheModeAdapter(daa);
+ this.cacheModeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member,
cacheModeDeclarationAdapter);
+ this.cacheableDeclarationAdapter = this.buildCacheableAdapter(daa);
+ this.cacheableAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(member,
cacheableDeclarationAdapter);
+ this.cacheRegionDeclarationAdapter = this.buildCacheRegionAdapter(daa);
+ this.cacheRegionAdapter = this.buildAdapter(this.cacheRegionDeclarationAdapter);
+ this.fetchSizeDeclarationAdapter = this.buildFetchSizeAdapter(daa);
+ this.fetchSizeAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(member,
fetchSizeDeclarationAdapter);
+ this.timeoutDeclarationAdapter = this.buildTimeoutAdapter(daa);
+ this.timeoutAdapter = new ShortCircuitAnnotationElementAdapter<Integer>(member,
timeoutDeclarationAdapter);
+ this.commentDeclarationAdapter = this.buildCommentAdapter(daa);
+ this.commentAdapter = new ShortCircuitAnnotationElementAdapter<String>(member,
commentDeclarationAdapter);
+ this.readOnlyDeclarationAdapter = this.buildReadOnlyAdapter(daa);
+ this.readOnlyAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(member,
readOnlyDeclarationAdapter);
}
public void initialize(CompilationUnit astRoot) {
this.name = this.buildName(astRoot);
this.query = this.buildQuery(astRoot);
- //AnnotationContainerTools.initialize(this.hintsContainer, astRoot);
+ this.flushMode = this.buildFlushMode(astRoot);
+ this.cacheMode = this.buildCacheMode(astRoot);
+ this.cacheable = this.buildCacheable(astRoot);
+ this.cacheRegion = this.buildCacheRegion(astRoot);
+ this.fetchSize = this.buildFetchSize(astRoot);
+ this.timeout = this.buildTimeout(astRoot);
+ this.comment = this.buildComment(astRoot);
+ this.readOnly = this.buildReadOnly(astRoot);
}
public void update(CompilationUnit astRoot) {
this.setName(this.buildName(astRoot));
this.setQuery(this.buildQuery(astRoot));
- //AnnotationContainerTools.update(this.hintsContainer, astRoot);
- }
+ this.setFlushMode(this.buildFlushMode(astRoot));
+ this.setCacheMode(this.buildCacheMode(astRoot));
+ this.setCacheable(this.buildCacheable(astRoot));
+ this.setCacheRegion(this.buildCacheRegion(astRoot));
+ this.setFetchSize(this.buildFetchSize(astRoot));
+ this.setTimeout(this.buildTimeout(astRoot));
+ this.setComment(this.buildComment(astRoot));
+ this.setReadOnly(this.buildReadOnly(astRoot));
+ }
public String getAnnotationName() {
return ANNOTATION_NAME;
@@ -90,12 +146,6 @@
return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
}
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
// ********** BaseNamedQueryAnnotation implementation **********
// ***** name
@@ -119,16 +169,8 @@
public TextRange getNameTextRange(CompilationUnit astRoot) {
return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
- }
+ }
- private DeclarationAnnotationElementAdapter<String>
buildNameAdapter(DeclarationAnnotationAdapter daAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter,
this.getNameElementName());
- }
-
- String getNameElementName() {
- return Hibernate.NAMED_QUERY__NAME;
- }
-
// ***** query
public String getQuery() {
return this.query;
@@ -152,71 +194,200 @@
return this.getElementTextRange(this.queryDeclarationAdapter, astRoot);
}
- private DeclarationAnnotationElementAdapter<String>
buildQueryAdapter(DeclarationAnnotationAdapter daAdapter) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter,
this.getQueryElementName());
- }
-
String getQueryElementName() {
return Hibernate.NAMED_QUERY__QUERY;
}
-
+
// ***** hints
public ListIterator<QueryHintAnnotation> hints() {
- return new CloneListIterator<QueryHintAnnotation>(this.hints);
+ return EmptyListIterator.instance();
}
ListIterator<NestableQueryHintAnnotation> nestableHints() {
- return new CloneListIterator<NestableQueryHintAnnotation>(this.hints);
+ return EmptyListIterator.instance();
}
public int hintsSize() {
- return this.hints.size();
+ return 0;
}
public NestableQueryHintAnnotation hintAt(int index) {
- return this.hints.get(index);
+ throw new UnsupportedOperationException();
}
public int indexOfHint(QueryHintAnnotation queryHint) {
- return this.hints.indexOf(queryHint);
+ return -1;
}
public NestableQueryHintAnnotation addHint(int index) {
return null;
}
- NestableQueryHintAnnotation addHintInternal() {
- return null;
+ public void moveHint(int targetIndex, int sourceIndex) {
+ //AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex,
this.hintsContainer);
}
- void hintAdded(int index, NestableQueryHintAnnotation hint) {
- this.fireItemAdded(HINTS_LIST, index, hint);
+ public void removeHint(int index) {
+ //AnnotationContainerTools.removeNestedAnnotation(index, this.hintsContainer);
}
- public void moveHint(int targetIndex, int sourceIndex) {
- //AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex,
this.hintsContainer);
+ // ******************** HibernateNamedQueryAnnotation implementation *************
+ // ***** flushMode
+
+ public FlushModeType getFlushMode() {
+ return flushMode;
}
- NestableQueryHintAnnotation moveHintInternal(int targetIndex, int sourceIndex) {
- return CollectionTools.move(this.hints, targetIndex, sourceIndex).get(targetIndex);
+ public void setFlushMode(FlushModeType flushMode) {
+ if (this.attributeValueHasNotChanged(this.flushMode, flushMode)) {
+ return;
+ }
+ FlushModeType old = this.flushMode;
+ this.flushMode = flushMode;
+ this.flushModeAdapter.setValue(FlushModeType.toJavaAnnotationValue(flushMode));
+ this.firePropertyChanged(FLUSH_MODE_PROPERTY, old, flushMode);
}
- void hintMoved(int targetIndex, int sourceIndex) {
- this.fireItemMoved(HINTS_LIST, targetIndex, sourceIndex);
+ private FlushModeType buildFlushMode(CompilationUnit astRoot) {
+ return FlushModeType.fromJavaAnnotationValue(this.flushModeAdapter.getValue(astRoot));
}
- public void removeHint(int index) {
- //AnnotationContainerTools.removeNestedAnnotation(index, this.hintsContainer);
+ public TextRange getFlushModeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(flushModeDeclarationAdapter, astRoot);
}
- NestableQueryHintAnnotation removeHintInternal(int index) {
- return this.hints.remove(index);
+ // ***** caheMode
+
+ public CacheModeType getCacheMode() {
+ return cacheMode;
}
- void hintRemoved(int index, NestableQueryHintAnnotation hint) {
- this.fireItemRemoved(HINTS_LIST, index, hint);
+ public void setCacheMode(CacheModeType cacheMode) {
+ if (this.attributeValueHasNotChanged(this.cacheMode, cacheMode)) {
+ return;
+ }
+ CacheModeType old = this.cacheMode;
+ this.cacheMode = cacheMode;
+ this.cacheModeAdapter.setValue(CacheModeType.toJavaAnnotationValue(cacheMode));
+ this.firePropertyChanged(CACHE_MODE_PROPERTY, old, cacheMode);
}
+
+ private CacheModeType buildCacheMode(CompilationUnit astRoot) {
+ return CacheModeType.fromJavaAnnotationValue(this.cacheModeAdapter.getValue(astRoot));
+ }
+ public TextRange getCacheModeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(cacheModeDeclarationAdapter, astRoot);
+ }
+
+ //************************ cacheable *********************************
+ public Boolean isCacheable(){
+ return this.cacheable;
+ }
+
+ public void setCacheable(Boolean cacheable){
+ if (this.attributeValueHasNotChanged(this.cacheable, cacheable)) {
+ return;
+ }
+ Boolean old = this.cacheable;
+ this.cacheable = cacheable;
+ this.cacheableAdapter.setValue(cacheable);
+ this.firePropertyChanged(CACHEABLE_PROPERTY, old, cacheable);
+ }
+
+ private Boolean buildCacheable(CompilationUnit astRoot) {
+ return this.cacheableAdapter.getValue(astRoot);
+ }
+
+ //************************ cacheRegion *********************************
+ public String getCacheRegion(){
+ return this.cacheRegion;
+ }
+
+ public void setCacheRegion(String cacheRegion){
+ if (this.attributeValueHasNotChanged(this.cacheRegion, cacheRegion)) {
+ return;
+ }
+ String old = this.cacheRegion;
+ this.cacheRegion = cacheRegion;
+ this.cacheRegionAdapter.setValue(cacheRegion);
+ this.firePropertyChanged(CACHE_REGION_PROPERTY, old, cacheRegion);
+ }
+
+ private String buildCacheRegion(CompilationUnit astRoot) {
+ return this.cacheRegionAdapter.getValue(astRoot);
+ }
+ //************************ fetchSize *********************************
+ public Integer getFetchSize(){
+ return this.fetchSize;
+ }
+
+ public void setFetchSize(Integer fetchSize){
+ if (this.attributeValueHasNotChanged(this.fetchSize, fetchSize)) {
+ return;
+ }
+ Integer old = this.fetchSize;
+ this.fetchSize = fetchSize;
+ this.fetchSizeAdapter.setValue(fetchSize);
+ this.firePropertyChanged(FETCH_SIZE_PROPERTY, old, fetchSize);
+ }
+
+ private Integer buildFetchSize(CompilationUnit astRoot) {
+ return this.fetchSizeAdapter.getValue(astRoot);
+ }
+ //************************ timeout *********************************
+ public Integer getTimeout(){
+ return this.timeout;
+ }
+ public void setTimeout(Integer timeout){
+ if (this.attributeValueHasNotChanged(this.timeout, timeout)) {
+ return;
+ }
+ Integer old = this.timeout;
+ this.timeout = timeout;
+ this.timeoutAdapter.setValue(timeout);
+ this.firePropertyChanged(TIMEOUT_PROPERTY, old, timeout);
+ }
+
+ private Integer buildTimeout(CompilationUnit astRoot) {
+ return this.timeoutAdapter.getValue(astRoot);
+ }
+ //************************ comment *********************************
+ public String getComment(){
+ return this.comment;
+ }
+
+ public void setComment(String comment){
+ if (this.attributeValueHasNotChanged(this.comment, comment)) {
+ return;
+ }
+ String old = this.comment;
+ this.comment = comment;
+ this.commentAdapter.setValue(comment);
+ this.firePropertyChanged(COMMENT_PROPERTY, old, comment);
+ }
+
+ private String buildComment(CompilationUnit astRoot) {
+ return this.commentAdapter.getValue(astRoot);
+ }
+ //************************ readOnly *********************************
+ public Boolean isReadOnly(){
+ return this.readOnly;
+ }
+
+ public void setReadOnly(Boolean readOnly){
+ if (this.attributeValueHasNotChanged(this.readOnly, readOnly)) {
+ return;
+ }
+ Boolean old = this.readOnly;
+ this.readOnly = readOnly;
+ this.readOnlyAdapter.setValue(readOnly);
+ this.firePropertyChanged(READ_ONLY_PROPERTY, old, readOnly);
+ }
+
+ private Boolean buildReadOnly(CompilationUnit astRoot) {
+ return this.readOnlyAdapter.getValue(astRoot);
+ }
// ********** NestableAnnotation implementation **********
/**
@@ -224,13 +395,17 @@
* for subclasses
*/
public void initializeFrom(NestableAnnotation oldAnnotation) {
- BaseNamedQueryAnnotation oldQuery = (BaseNamedQueryAnnotation) oldAnnotation;
+ HibernateSourceNamedQueryAnnotation oldQuery = (HibernateSourceNamedQueryAnnotation)
oldAnnotation;
this.setName(oldQuery.getName());
this.setQuery(oldQuery.getQuery());
- for (QueryHintAnnotation oldQueryHint : CollectionTools.iterable(oldQuery.hints())) {
- NestableQueryHintAnnotation newQueryHint =
this.addHint(oldQuery.indexOfHint(oldQueryHint));
- newQueryHint.initializeFrom((NestableQueryHintAnnotation) oldQueryHint);
- }
+ this.setFlushMode(oldQuery.getFlushMode());
+ this.setCacheMode(oldQuery.getCacheMode());
+ this.setCacheable(oldQuery.isCacheable());
+ this.setComment(oldQuery.getComment());
+ this.setFetchSize(oldQuery.getFetchSize());
+ this.setTimeout(oldQuery.getTimeout());
+ this.setCacheRegion(oldQuery.getCacheRegion());
+ this.setReadOnly(oldQuery.isReadOnly());
}
/**
@@ -245,7 +420,69 @@
return (IndexedAnnotationAdapter) this.annotationAdapter;
}
- public static NamedQueryAnnotation createNamedQuery(JavaResourceNode parent, Member
member) {
+ public static HibernateNamedQueryAnnotation createNamedQuery(JavaResourceNode parent,
Member member) {
return new HibernateSourceNamedQueryAnnotation(parent, member,
DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member,
DECLARATION_ANNOTATION_ADAPTER));
}
+
+ protected DeclarationAnnotationElementAdapter<String>
buildNameAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter,
Hibernate.NAMED_QUERY__NAME);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String>
buildQueryAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter,
Hibernate.NAMED_QUERY__QUERY);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String>
buildFlushModeAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return new EnumDeclarationAnnotationElementAdapter(daAdapter,
Hibernate.NAMED_QUERY__FLUSH_MODE);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String>
buildCacheModeAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return new EnumDeclarationAnnotationElementAdapter(daAdapter,
Hibernate.NAMED_QUERY__CACHE_MODE);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Boolean>
buildCacheableAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forBooleans(daAdapter,
Hibernate.NAMED_QUERY__CACHEABLE);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String>
buildCacheRegionAdapter(DeclarationAnnotationAdapter daAdapter){
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter,
Hibernate.NAMED_QUERY__CACHE_REGION);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer>
buildFetchSizeAdapter(DeclarationAnnotationAdapter daAdapter){
+ return ConversionDeclarationAnnotationElementAdapter.forNumbers(daAdapter,
Hibernate.NAMED_QUERY__FETCH_SIZE);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer>
buildTimeoutAdapter(DeclarationAnnotationAdapter daAdapter){
+ return ConversionDeclarationAnnotationElementAdapter.forNumbers(daAdapter,
Hibernate.NAMED_QUERY__TIMEOUT);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String>
buildCommentAdapter(DeclarationAnnotationAdapter daAdapter){
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daAdapter,
Hibernate.NAMED_QUERY__COMMENT);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Boolean>
buildReadOnlyAdapter(DeclarationAnnotationAdapter daAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forBooleans(daAdapter,
Hibernate.NAMED_QUERY__READ_ONLY);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+
+ // ********** static methods **********
+
+ public static HibernateSourceNamedQueryAnnotation
createHibernateNamedQuery(JavaResourceNode parent, Member member) {
+ return new HibernateSourceNamedQueryAnnotation(parent, member,
DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member,
DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ public static HibernateSourceNamedQueryAnnotation
createNestedHibernateNamedQuery(JavaResourceNode parent, Member member, int index,
DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa =
buildNestedHibernateDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member,
idaa);
+ return new HibernateSourceNamedQueryAnnotation(parent, member, idaa,
annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter
buildNestedHibernateDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter
hibernateNamedQueriesAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(hibernateNamedQueriesAdapter,
index, Hibernate.NAMED_QUERY);
+ }
+
}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotation.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotation.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotation.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+
+import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface HibernateNamedQueriesAnnotation extends
+ ContainerAnnotation<HibernateNamedQueryAnnotation> {
+
+ String ANNOTATION_NAME = Hibernate.NAMED_QUERIES;
+
+ String HIBERNATE_NAMED_QUERIES_LIST = "hibernateNamedQueries"; //$NON-NLS-1$
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotationDefinition.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotationDefinition.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotationDefinition.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.jdt.Member;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateNamedQueriesAnnotationDefinition implements AnnotationDefinition {
+
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new
HibernateNamedQueriesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private HibernateNamedQueriesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new HibernateSourceNamedQueriesAnnotation(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation
jdtAnnotation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return HibernateNamedQueriesAnnotation.ANNOTATION_NAME;
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateNamedQueriesAnnotationDefinition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueriesAnnotation.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueriesAnnotation.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueriesAnnotation.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryAnnotation;
+import
org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateSourceNamedQueryAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateSourceNamedQueriesAnnotation extends SourceAnnotation<Member>
+implements HibernateNamedQueriesAnnotation {
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new
SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<HibernateNamedQueryAnnotation> hibernateNamedQueries = new
Vector<HibernateNamedQueryAnnotation>();
+
+
+ public HibernateSourceNamedQueriesAnnotation(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ AnnotationContainerTools.update(this, astRoot);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.hibernateNamedQueries);
+ }
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getContainerAnnotationName() {
+ return this.getAnnotationName();
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation getContainerJdtAnnotation(CompilationUnit
astRoot) {
+ return this.getJdtAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return Hibernate.NAMED_QUERIES__VALUE;
+ }
+
+ public String getNestableAnnotationName() {
+ return HibernateNamedQueryAnnotation.ANNOTATION_NAME;
+ }
+
+ public ListIterator<HibernateNamedQueryAnnotation> nestedAnnotations() {
+ return new
CloneListIterator<HibernateNamedQueryAnnotation>(this.hibernateNamedQueries);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.hibernateNamedQueries.size();
+ }
+
+ public HibernateNamedQueryAnnotation addNestedAnnotationInternal() {
+ HibernateNamedQueryAnnotation namedQuery =
this.buildHibernateNamedQuery(this.hibernateNamedQueries.size());
+ this.hibernateNamedQueries.add(namedQuery);
+ return namedQuery;
+ }
+
+ private HibernateNamedQueryAnnotation buildHibernateNamedQuery(int index) {
+ return HibernateSourceNamedQueryAnnotation.createNestedHibernateNamedQuery(this,
member, index, this.daa);
+ }
+
+ public void nestedAnnotationAdded(int index, HibernateNamedQueryAnnotation
nestedAnnotation) {
+ this.fireItemAdded(HIBERNATE_NAMED_QUERIES_LIST, index, nestedAnnotation);
+ }
+
+ public HibernateNamedQueryAnnotation moveNestedAnnotationInternal(int targetIndex, int
sourceIndex) {
+ return CollectionTools.move(this.hibernateNamedQueries, targetIndex,
sourceIndex).get(targetIndex);
+ }
+
+ public void nestedAnnotationMoved(int targetIndex, int sourceIndex) {
+ this.fireItemMoved(HIBERNATE_NAMED_QUERIES_LIST, targetIndex, sourceIndex);
+ }
+
+ public HibernateNamedQueryAnnotation removeNestedAnnotationInternal(int index) {
+ return this.hibernateNamedQueries.remove(index);
+ }
+
+ public void nestedAnnotationRemoved(int index, HibernateNamedQueryAnnotation
nestedAnnotation) {
+ this.fireItemRemoved(HIBERNATE_NAMED_QUERIES_LIST, index, nestedAnnotation);
+ }
+
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueriesAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/java/details/HibernateJavaEntityComposite.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/java/details/HibernateJavaEntityComposite.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/java/details/HibernateJavaEntityComposite.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -17,6 +17,7 @@
import org.eclipse.jpt.utility.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import
org.jboss.tools.hibernate.jpt.ui.internal.mapping.details.HibernateGeneratorsComposite;
+import
org.jboss.tools.hibernate.jpt.ui.internal.mapping.details.HibernateQueriesComposite;
/**
* @author Dmitry Geraskov
@@ -35,6 +36,16 @@
}
@Override
+ protected void initializeQueriesPane(Composite container) {
+ container = addCollapsableSection(
+ container,
+ JptUiMappingsMessages.EntityComposite_queries
+ );
+
+ new HibernateQueriesComposite(this, container);
+ }
+
+ @Override
protected void initializeGeneratorsPane(Composite container) {
container = addCollapsableSection(
container,
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAddQueryDialog.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAddQueryDialog.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAddQueryDialog.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.ui.internal.mapping.details;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jpt.core.context.Query;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.DialogPane;
+import org.eclipse.jpt.ui.internal.widgets.ValidatingDialog;
+import org.eclipse.jpt.utility.internal.StringConverter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
+import org.eclipse.jpt.utility.internal.node.AbstractNode;
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.jpt.utility.internal.node.Problem;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQuery;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateAddQueryDialog extends ValidatingDialog<AddQueryStateObject>
{
+
+ // ********** constructors **********
+
+ /**
+ * Use this constructor to edit an existing conversion value
+ */
+ public HibernateAddQueryDialog(Shell parent) {
+ super(parent);
+ }
+
+ @Override
+ protected AddQueryStateObject buildStateObject() {
+ return new AddQueryStateObject();
+ }
+
+ // ********** open **********
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(this.getTitle());
+ }
+
+ @Override
+ protected String getTitle() {
+ return JptUiMappingsMessages.AddQueryDialog_title;
+ }
+
+ @Override
+ protected String getDescriptionTitle() {
+ return JptUiMappingsMessages.AddQueryDialog_descriptionTitle;
+ }
+
+ @Override
+ protected String getDescription() {
+ return JptUiMappingsMessages.AddQueryDialog_description;
+ }
+
+ @Override
+ protected DialogPane<AddQueryStateObject> buildLayout(Composite container) {
+ return new QueryDialogPane(container);
+ }
+
+ @Override
+ public void create() {
+ super.create();
+
+ QueryDialogPane pane = (QueryDialogPane) getPane();
+ pane.selectAll();
+
+ getButton(OK).setEnabled(false);
+ }
+
+
+ // ********** public API **********
+
+ /**
+ * Return the data value set in the text widget.
+ */
+ public String getName() {
+ return getSubject().getName();
+ }
+
+ /**
+ * Return the object value set in the text widget.
+ */
+ public String getQueryType() {
+ return getSubject().getQueryType();
+ }
+
+ private class QueryDialogPane extends DialogPane<AddQueryStateObject> {
+
+ private Text nameText;
+
+ QueryDialogPane(Composite parent) {
+ super(HibernateAddQueryDialog.this.getSubjectHolder(), parent);
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+ this.nameText = addLabeledText(
+ container,
+ JptUiMappingsMessages.AddQueryDialog_name,
+ buildNameHolder()
+ );
+
+ addLabeledCombo(
+ container,
+ JptUiMappingsMessages.AddQueryDialog_queryType,
+ buildQueryTypeListHolder(),
+ buildQueryTypeHolder(),
+ buildStringConverter(),
+ null);
+ }
+
+ protected ListValueModel<String> buildQueryTypeListHolder() {
+ List<String> queryTypes = new ArrayList<String>();
+ queryTypes.add(Query.NAMED_QUERY);
+ queryTypes.add(Query.NAMED_NATIVE_QUERY);
+ queryTypes.add(HibernateNamedQuery.HIBERNATE_NAMED_QUERY);
+
+ return new StaticListValueModel<String>(queryTypes);
+ }
+
+ private StringConverter<String> buildStringConverter() {
+ return new StringConverter<String>() {
+ public String convertToString(String value) {
+ if (value == Query.NAMED_QUERY) {
+ return JptUiMappingsMessages.AddQueryDialog_namedQuery;
+ }
+ if (value == Query.NAMED_NATIVE_QUERY) {
+ return JptUiMappingsMessages.AddQueryDialog_namedNativeQuery;
+ }
+ if (value == HibernateNamedQuery.HIBERNATE_NAMED_QUERY) {
+ return HibernateUIMappingMessages.HibernateAddQueryDialog_hibernateNamedQuery;
+ }
+ return value;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildNameHolder() {
+ return new PropertyAspectAdapter<AddQueryStateObject,
String>(getSubjectHolder(), AddQueryStateObject.NAME_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getName();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ this.subject.setName(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildQueryTypeHolder() {
+ return new PropertyAspectAdapter<AddQueryStateObject,
String>(getSubjectHolder(), AddQueryStateObject.QUERY_TYPE_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getQueryType();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ this.subject.setQueryType(value);
+ }
+ };
+ }
+
+ void selectAll() {
+ this.nameText.selectAll();
+ }
+ }
+}
+
+final class AddQueryStateObject extends AbstractNode
+{
+ /**
+ * The initial name or <code>null</code>
+ */
+ private String name;
+
+ /**
+ * The initial queryType or <code>null</code>
+ */
+ private String queryType;
+
+ /**
+ * The <code>Validator</code> used to validate this state object.
+ */
+ private Validator validator;
+
+ /**
+ * Notifies a change in the data value property.
+ */
+ static final String NAME_PROPERTY = "nameProperty"; //$NON-NLS-1$
+
+ /**
+ * Notifies a change in the query type property.
+ */
+ static final String QUERY_TYPE_PROPERTY = "queryTypeProperty"; //$NON-NLS-1$
+
+ /**
+ * Creates a new <code>NewNameStateObject</code>.
+ *
+ * @param name The initial input or <code>null</code> if no initial value
can
+ * be specified
+ * @param names The collection of names that can't be used or an empty
+ * collection if none are available
+ */
+ AddQueryStateObject() {
+ super(null);
+
+ }
+
+ private void addNameProblemsTo(List<Problem> currentProblems) {
+ if (StringTools.stringIsEmpty(this.name)) {
+ currentProblems.add(buildProblem(JptUiMappingsMessages.QueryStateObject_nameMustBeSpecified));
+ }
+ }
+
+ private void addQueryTypeProblemsTo(List<Problem> currentProblems) {
+ if (StringTools.stringIsEmpty(this.queryType)) {
+ currentProblems.add(buildProblem(JptUiMappingsMessages.QueryStateObject_typeMustBeSpecified));
+ }
+ }
+
+ @Override
+ protected void addProblemsTo(List<Problem> currentProblems) {
+ super.addProblemsTo(currentProblems);
+ addNameProblemsTo(currentProblems);
+ addQueryTypeProblemsTo(currentProblems);
+ }
+
+ @Override
+ protected void checkParent(Node parentNode) {
+ //no parent
+ }
+
+ public String displayString() {
+ return null;
+ }
+
+ String getName() {
+ return this.name;
+ }
+
+ String getQueryType() {
+ return this.queryType;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public void setQueryType(String newQueryType) {
+ String old = this.queryType;
+ this.queryType = newQueryType;
+ firePropertyChanged(QUERY_TYPE_PROPERTY, old, newQueryType);
+ }
+
+ @Override
+ public void setValidator(Validator validator) {
+ this.validator = validator;
+ }
+
+ @Override
+ public Validator getValidator() {
+ return this.validator;
+ }
+}
+
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAddQueryDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateNamedQueryPropertyComposite.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateNamedQueryPropertyComposite.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateNamedQueryPropertyComposite.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,490 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.ui.internal.mapping.details;
+
+import java.util.Collection;
+
+import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater;
+import org.eclipse.jpt.ui.internal.util.LabeledLabel;
+import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
+import org.eclipse.jpt.ui.internal.widgets.Pane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.CacheModeType;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.FlushModeType;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQuery;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateNamedQueryPropertyComposite extends Pane<HibernateNamedQuery>
{
+
+ /**
+ * Creates a new <code>HibernateNamedQueryPropertyComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public HibernateNamedQueryPropertyComposite(Pane<?> parentPane,
+ PropertyValueModel<? extends
HibernateNamedQuery> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ addLabeledText(
+ container,
+ JptUiMappingsMessages.NamedQueryComposite_nameTextLabel,
+ buildNameTextHolder());
+
+ // Query text area
+ addLabeledMultiLineText(
+ container,
+ JptUiMappingsMessages.NamedQueryPropertyComposite_query,
+ buildQueryHolder(),
+ 4,
+ null
+ );
+
+ // ReadOnly tri-state check box
+ addTriStateCheckBoxWithDefault(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_readOnly,
+ buildReadOnlyHolder(),
+ buildReadOnlyStringHolder(),
+ null//TODO help
+ );
+
+ //Flush Mode combobox
+ addLabeledComposite(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_flushMode,
+ addFlushModeTypeCombo(container),
+ null//TODO help
+ );
+
+ // Cacheable tri-state check box
+ addTriStateCheckBoxWithDefault(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_cacheable,
+ buildCacheableHolder(),
+ buildCacheableStringHolder(),
+ null//TODO help
+ );
+
+ //Cache Mode combobox
+ addLabeledComposite(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_cacheMode,
+ addCacheModeTypeCombo(container),
+ null//TODO help
+ );
+
+ addLabeledText(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_cacheRegion,
+ buildCacheRegionTextHolder());
+
+ // Fetch size widgets
+ Spinner fetchSizeSpinner = addLabeledSpinner(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_fetchSize,
+ buildFetchSizeHolder(),
+ -1,
+ -1,
+ Integer.MAX_VALUE,
+ addDefaultFetchSizeLabel(container),
+ JpaHelpContextIds.MAPPING_COLUMN_LENGTH
+ );
+
+ updateGridData(container, fetchSizeSpinner);
+
+ // Timeout size widgets
+ Spinner timeoutSpinner = addLabeledSpinner(
+ container,
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_timeout,
+ buildTimeoutHolder(),
+ -1,
+ -1,
+ Integer.MAX_VALUE,
+ addDefaultFetchSizeLabel(container),
+ JpaHelpContextIds.MAPPING_COLUMN_LENGTH
+ );
+
+ updateGridData(container, timeoutSpinner);
+
+ }
+
+ private Control addDefaultFetchSizeLabel(Composite container) {
+
+ Label label = addLabel(
+ container,
+ JptUiMappingsMessages.DefaultEmpty
+ );
+
+ new LabeledControlUpdater(
+ new LabeledLabel(label),
+ buildDefaultFetchSizeLabelHolder()
+ );
+
+ return label;
+ }
+
+ private PropertyValueModel<String> buildDefaultFetchSizeLabelHolder() {
+
+ return new TransformationPropertyValueModel<Integer,
String>(buildDefaultFetchSizeHolder()) {
+
+ @Override
+ protected String transform(Integer value) {
+
+ int defaultValue = (getSubject() != null) ? getSubject().getDefaultFetchSize() :
+ HibernateNamedQuery.DEFAULT_FETCH_SIZE;
+
+ return NLS.bind(
+ JptUiMappingsMessages.DefaultWithOneParam,
+ Integer.valueOf(defaultValue)
+ );
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Integer> buildDefaultFetchSizeHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery,
Integer>(getSubjectHolder(), HibernateNamedQuery.DEFAULT_FETCH_SIZE_PROPERTY) {
+ @Override
+ protected Integer buildValue_() {
+ return Integer.valueOf(this.subject.getDefaultFetchSize());
+ }
+
+ @Override
+ protected synchronized void subjectChanged() {
+ Object oldValue = this.getValue();
+ super.subjectChanged();
+ Object newValue = this.getValue();
+
+ // Make sure the default value is appended to the text
+ if (oldValue == newValue && newValue == null) {
+ this.fireAspectChange(Integer.MIN_VALUE, newValue);
+ }
+ }
+ };
+ }
+
+ protected WritablePropertyValueModel<String> buildNameTextHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery, String>(
+ getSubjectHolder(), HibernateNamedQuery.NAME_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getName();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setName(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildQueryHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery, String>(getSubjectHolder(),
HibernateNamedQuery.QUERY_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getQuery();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ this.subject.setQuery(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildCacheableHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery, Boolean>(
+ getSubjectHolder(),
+ HibernateNamedQuery.DEFAULT_CACHEABLE_PROPERTY,
+ HibernateNamedQuery.SPECIFIED_CACHEABLE_PROPERTY)
+ {
+ @Override
+ protected Boolean buildValue_() {
+ return this.subject.getSpecifiedCacheable();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ this.subject.setSpecifiedCacheable(value);
+ }
+
+ @Override
+ protected synchronized void subjectChanged() {
+ Object oldValue = this.getValue();
+ super.subjectChanged();
+ Object newValue = this.getValue();
+
+ // Make sure the default value is appended to the text
+ if (oldValue == newValue && newValue == null) {
+ this.fireAspectChange(Boolean.TRUE, newValue);
+ }
+ }
+ };
+ }
+
+ private PropertyValueModel<String> buildCacheableStringHolder() {
+
+ return new TransformationPropertyValueModel<Boolean,
String>(buildCacheableHolder()) {
+
+ @Override
+ protected String transform(Boolean value) {
+
+ if ((getSubject() != null) && (value == null)) {
+ boolean defaultValue = getSubject().isDefaultCacheable();
+
+ String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True :
+ JptUiMappingsMessages.Boolean_False;
+
+ return NLS.bind(
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_cacheableWithDefault,
+ defaultStringValue
+ );
+ }
+
+ return HibernateUIMappingMessages.NamedQueryPropertyComposite_cacheable;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildReadOnlyHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery, Boolean>(
+ getSubjectHolder(),
+ HibernateNamedQuery.DEFAULT_READ_ONLY_PROPERTY,
+ HibernateNamedQuery.SPECIFIED_READ_ONLY_PROPERTY)
+ {
+ @Override
+ protected Boolean buildValue_() {
+ return this.subject.getSpecifiedReadOnly();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ this.subject.setSpecifiedReadOnly(value);
+ }
+
+ @Override
+ protected synchronized void subjectChanged() {
+ Object oldValue = this.getValue();
+ super.subjectChanged();
+ Object newValue = this.getValue();
+
+ // Make sure the default value is appended to the text
+ if (oldValue == newValue && newValue == null) {
+ this.fireAspectChange(Boolean.TRUE, newValue);
+ }
+ }
+ };
+ }
+
+ private PropertyValueModel<String> buildReadOnlyStringHolder() {
+
+ return new TransformationPropertyValueModel<Boolean,
String>(buildReadOnlyHolder()) {
+
+ @Override
+ protected String transform(Boolean value) {
+
+ if ((getSubject() != null) && (value == null)) {
+ boolean defaultValue = getSubject().isDefaultReadOnly();
+
+ String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True :
+ JptUiMappingsMessages.Boolean_False;
+
+ return NLS.bind(
+ HibernateUIMappingMessages.NamedQueryPropertyComposite_readOnlyWithDefault,
+ defaultStringValue
+ );
+ }
+
+ return HibernateUIMappingMessages.NamedQueryPropertyComposite_readOnly;
+ }
+ };
+ }
+
+ private EnumFormComboViewer<HibernateNamedQuery, FlushModeType>
addFlushModeTypeCombo(Composite container) {
+
+ return new EnumFormComboViewer<HibernateNamedQuery, FlushModeType>(this,
container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(HibernateNamedQuery.DEFAULT_FLUSH_MODE_PROPERTY);
+ propertyNames.add(HibernateNamedQuery.SPECIFIED_FLUSH_MODE_PROPERTY);
+ }
+
+ @Override
+ protected FlushModeType[] getChoices() {
+ return FlushModeType.values();
+ }
+
+ @Override
+ protected FlushModeType getDefaultValue() {
+ return getSubject().getDefaultFlushMode();
+ }
+
+ @Override
+ protected String displayString(FlushModeType value) {
+ return value.toString();
+
+ }
+
+ @Override
+ protected FlushModeType getValue() {
+ return getSubject().getSpecifiedFlushMode();
+ }
+
+ @Override
+ protected void setValue(FlushModeType value) {
+ getSubject().setSpecifiedFlushMode(value);
+ }
+ };
+ }
+
+ private EnumFormComboViewer<HibernateNamedQuery, CacheModeType>
addCacheModeTypeCombo(Composite container) {
+
+ return new EnumFormComboViewer<HibernateNamedQuery, CacheModeType>(this,
container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(HibernateNamedQuery.DEFAULT_CACHE_MODE_PROPERTY);
+ propertyNames.add(HibernateNamedQuery.SPECIFIED_CACHE_MODE_PROPERTY);
+ }
+
+ @Override
+ protected CacheModeType[] getChoices() {
+ return CacheModeType.values();
+ }
+
+ @Override
+ protected CacheModeType getDefaultValue() {
+ return getSubject().getDefaultCacheMode();
+ }
+
+ @Override
+ protected String displayString(CacheModeType value) {
+ return value.toString();
+
+ }
+
+ @Override
+ protected CacheModeType getValue() {
+ return getSubject().getSpecifiedCacheMode();
+ }
+
+ @Override
+ protected void setValue(CacheModeType value) {
+ getSubject().setSpecifiedCacheMode(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildCacheRegionTextHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery, String>(
+ getSubjectHolder(),
+ HibernateNamedQuery.DEFAULT_CACHE_REGION_PROPERTY,
+ HibernateNamedQuery.SPECIFIED_CACHE_REGION_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getSpecifiedCacheRegion();
+ }
+
+ @Override
+ protected void setValue_(String value) {
+ if (value.length() == 0) {
+ value = null;
+ }
+ this.subject.setSpecifiedCacheRegion(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Integer> buildFetchSizeHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery,
Integer>(getSubjectHolder(), HibernateNamedQuery.SPECIFIED_FETCH_SIZE_PROPERTY) {
+ @Override
+ protected Integer buildValue_() {
+ return this.subject.getSpecifiedFetchSize();
+ }
+
+ @Override
+ protected void setValue_(Integer value) {
+ if (value.intValue() == -1) {
+ value = null;
+ }
+ this.subject.setSpecifiedFetchSize(value);
+ }
+ };
+ }
+
+
+
+ private WritablePropertyValueModel<Integer> buildTimeoutHolder() {
+ return new PropertyAspectAdapter<HibernateNamedQuery,
Integer>(getSubjectHolder(), HibernateNamedQuery.SPECIFIED_TIMEOUT_PROPERTY) {
+ @Override
+ protected Integer buildValue_() {
+ return this.subject.getSpecifiedTimeout();
+ }
+
+ @Override
+ protected void setValue_(Integer value) {
+ if (value.intValue() == -1) {
+ value = null;
+ }
+ this.subject.setSpecifiedTimeout(value);
+ }
+ };
+ }
+
+ private void updateGridData(Composite container, Spinner spinner) {
+
+ // It is possible the spinner's parent is not the container of the
+ // label, spinner and right control (a pane is sometimes required for
+ // painting the spinner's border)
+ Composite paneContainer = spinner.getParent();
+
+ while (container != paneContainer.getParent()) {
+ paneContainer = paneContainer.getParent();
+ }
+
+ Control[] controls = paneContainer.getChildren();
+
+ GridData gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = false;
+ gridData.horizontalAlignment = GridData.BEGINNING;
+ controls[1].setLayoutData(gridData);
+
+ controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ removeAlignRight(controls[2]);
+ }
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateNamedQueryPropertyComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateQueriesComposite.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateQueriesComposite.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateQueriesComposite.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -0,0 +1,336 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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 org.jboss.tools.hibernate.jpt.ui.internal.mapping.details;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.core.context.NamedNativeQuery;
+import org.eclipse.jpt.core.context.NamedQuery;
+import org.eclipse.jpt.core.context.Query;
+import org.eclipse.jpt.core.context.QueryContainer;
+import org.eclipse.jpt.ui.internal.JpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.mappings.details.NamedNativeQueryPropertyComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.NamedQueryPropertyComposite;
+import org.eclipse.jpt.ui.internal.util.ControlSwitcher;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.ui.internal.widgets.Pane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Transformer;
+import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
+import org.eclipse.jpt.utility.model.value.ListValueModel;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.PageBook;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQuery;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateQueryContainer;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateQueriesComposite extends Pane<QueryContainer> {
+
+ private AddRemoveListPane<QueryContainer> listPane;
+ private NamedNativeQueryPropertyComposite namedNativeQueryPane;
+ private NamedQueryPropertyComposite namedQueryPane;
+ private HibernateNamedQueryPropertyComposite hibernateNamedQueryPane;
+ private WritablePropertyValueModel<Query> queryHolder;
+
+ /**
+ * Creates a new <code>QueriesComposite</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ */
+ public HibernateQueriesComposite(Pane<? extends QueryContainer> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent, false);
+ }
+
+ private void addQuery() {
+ addQueryFromDialog(buildAddQueryDialog());
+ }
+
+ protected HibernateAddQueryDialog buildAddQueryDialog() {
+ return new HibernateAddQueryDialog(getControl().getShell());
+ }
+
+ protected void addQueryFromDialog(HibernateAddQueryDialog hibernateAddQueryDialog) {
+ if (hibernateAddQueryDialog.open() != Window.OK) {
+ return;
+ }
+ String queryType = hibernateAddQueryDialog.getQueryType();
+ Query query;
+ HibernateQueryContainer subj = (HibernateQueryContainer)this.getSubject();
+ if (queryType == Query.NAMED_QUERY) {
+ query = this.getSubject().addNamedQuery(getSubject().namedQueriesSize());
+ }
+ else if (queryType == Query.NAMED_NATIVE_QUERY) {
+ query = subj.addNamedNativeQuery(subj.namedNativeQueriesSize());
+ }
+ else if (queryType == HibernateNamedQuery.HIBERNATE_NAMED_QUERY) {
+ query = subj.addHibernateNamedQuery(subj.hibernateNamedQueriesSize());
+ }
+ else {
+ throw new IllegalArgumentException();
+ }
+ query.setName(hibernateAddQueryDialog.getName());
+ this.queryHolder.setValue(query);//so that it gets selected in the List for the user to
edit
+ }
+
+ private ListValueModel<Query> buildDisplayableQueriesListHolder() {
+ return new ItemPropertyListValueModelAdapter<Query>(
+ buildQueriesListHolder(),
+ Query.NAME_PROPERTY
+ );
+ }
+
+ private AddRemoveListPane<QueryContainer> addListPane(Composite container) {
+
+ return new AddRemoveListPane<QueryContainer>(
+ this,
+ container,
+ buildQueriesAdapter(),
+ buildDisplayableQueriesListHolder(),
+ this.queryHolder,
+ buildQueriesListLabelProvider(),
+ JpaHelpContextIds.MAPPING_NAMED_QUERIES
+ );
+ }
+
+ private ListValueModel<NamedNativeQuery> buildNamedNativeQueriesListHolder() {
+ return new ListAspectAdapter<QueryContainer, NamedNativeQuery>(
+ getSubjectHolder(),
+ QueryContainer.NAMED_NATIVE_QUERIES_LIST)
+ {
+ @Override
+ protected ListIterator<NamedNativeQuery> listIterator_() {
+ return this.subject.namedNativeQueries();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.namedNativeQueriesSize();
+ }
+ };
+ }
+
+ private PropertyValueModel<NamedNativeQuery> buildNamedNativeQueryHolder() {
+ return new TransformationPropertyValueModel<Query,
NamedNativeQuery>(this.queryHolder) {
+ @Override
+ protected NamedNativeQuery transform_(Query value) {
+ return (value instanceof NamedNativeQuery) ? (NamedNativeQuery) value : null;
+ }
+ };
+ }
+
+ private ListValueModel<HibernateNamedQuery> buildHibernateNamedQueriesListHolder()
{
+ return new ListAspectAdapter<QueryContainer, HibernateNamedQuery>(
+ getSubjectHolder(),
+ HibernateQueryContainer.HIBERNATE_NAMED_QUERIES_LIST)
+ {
+ @Override
+ protected ListIterator<HibernateNamedQuery> listIterator_() {
+ return ((HibernateQueryContainer)this.subject).hibernateNamedQueries();
+ }
+
+ @Override
+ protected int size_() {
+ return ((HibernateQueryContainer)this.subject).hibernateNamedQueriesSize();
+ }
+ };
+ }
+
+ private ListValueModel<NamedQuery> buildNamedQueriesListHolder() {
+ return new ListAspectAdapter<QueryContainer, NamedQuery>(
+ getSubjectHolder(),
+ QueryContainer.NAMED_QUERIES_LIST)
+ {
+ @Override
+ protected ListIterator<NamedQuery> listIterator_() {
+ return this.subject.namedQueries();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.namedQueriesSize();
+ }
+ };
+ }
+
+ private PropertyValueModel<NamedQuery> buildNamedQueryHolder() {
+ return new TransformationPropertyValueModel<Query, NamedQuery>(this.queryHolder)
{
+ @Override
+ protected NamedQuery transform_(Query value) {
+ return (value instanceof NamedQuery) ? (NamedQuery) value : null;
+ }
+ };
+ }
+
+ private PropertyValueModel<HibernateNamedQuery> buildHibernateNamedQueryHolder()
{
+ return new TransformationPropertyValueModel<Query,
HibernateNamedQuery>(this.queryHolder) {
+ @Override
+ protected HibernateNamedQuery transform_(Query value) {
+ return (value instanceof HibernateNamedQuery) ? (HibernateNamedQuery) value : null;
+ }
+ };
+ }
+
+ private Transformer<Query, Control> buildPaneTransformer() {
+ return new Transformer<Query, Control>() {
+ public Control transform(Query query) {
+
+ if (query == null) {
+ return null;
+ }
+
+ if (query instanceof HibernateNamedQuery) {
+ return HibernateQueriesComposite.this.hibernateNamedQueryPane.getControl();
+ }
+
+ if (query instanceof NamedNativeQuery) {
+ return HibernateQueriesComposite.this.namedNativeQueryPane.getControl();
+ }
+
+ return HibernateQueriesComposite.this.namedQueryPane.getControl();
+ }
+ };
+ }
+
+ private Adapter buildQueriesAdapter() {
+
+ return new AddRemoveListPane.AbstractAdapter() {
+
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
+ addQuery();
+ }
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ for (Object item : listSelectionModel.selectedValues()) {
+ if (item instanceof HibernateNamedQuery) {
+ ((HibernateQueryContainer)getSubject()).removeHibernateNamedQuery((HibernateNamedQuery)item);
+ } else if (item instanceof NamedQuery) {
+ getSubject().removeNamedQuery((NamedQuery) item);
+ } else {
+ getSubject().removeNamedNativeQuery((NamedNativeQuery) item);
+ }
+ }
+ }
+ };
+ }
+
+ private ListValueModel<Query> buildQueriesListHolder() {
+ List<ListValueModel<? extends Query>> list = new
ArrayList<ListValueModel<? extends Query>>();
+ list.add(buildHibernateNamedQueriesListHolder());
+ list.add(buildNamedQueriesListHolder());
+ list.add(buildNamedNativeQueriesListHolder());
+ return new CompositeListValueModel<ListValueModel<? extends Query>,
Query>(list);
+ }
+
+ private ILabelProvider buildQueriesListLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ Query query = (Query) element;
+ String name = query.getName();
+
+ if (name == null) {
+ int index = -1;
+
+ if (query instanceof HibernateNamedQuery) {
+ index =
CollectionTools.indexOf(((HibernateQueryContainer)getSubject()).hibernateNamedQueries(),
query);
+ } else if (query instanceof NamedQuery) {
+ index = CollectionTools.indexOf(getSubject().namedQueries(), query);
+ } else {
+ index = CollectionTools.indexOf(getSubject().namedNativeQueries(), query);
+ }
+
+ name = NLS.bind(JptUiMappingsMessages.QueriesComposite_displayString, index);
+ }
+
+ return name;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Query> buildQueryHolder() {
+ return new SimplePropertyValueModel<Query>();
+ }
+
+ @Override
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(enabled);
+ this.listPane.enableWidgets(enabled);
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.queryHolder = buildQueryHolder();
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // List pane
+ this.listPane = addListPane(container);
+
+ // Property pane
+ PageBook pageBook = new PageBook(container, SWT.NULL);
+ pageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Named Query property pane
+ this.hibernateNamedQueryPane = new HibernateNamedQueryPropertyComposite(
+ this,
+ buildHibernateNamedQueryHolder(),
+ pageBook
+ );
+
+ // Named Query property pane
+ this.namedQueryPane = new NamedQueryPropertyComposite(
+ this,
+ buildNamedQueryHolder(),
+ pageBook
+ );
+
+ // Named Native Query property pane
+ this.namedNativeQueryPane = new NamedNativeQueryPropertyComposite(
+ this,
+ buildNamedNativeQueryHolder(),
+ pageBook
+ );
+
+ installPaneSwitcher(pageBook);
+ }
+
+ private void installPaneSwitcher(PageBook pageBook) {
+ new ControlSwitcher(this.queryHolder, buildPaneTransformer(), pageBook);
+ }
+
+}
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateQueriesComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -18,13 +18,24 @@
*/
public class HibernateUIMappingMessages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.tools.hibernate.jpt.ui.internal.mapping.details.messages";
//$NON-NLS-1$
+
public static String GenericGeneratorComposite_name;
public static String GenericGeneratorComposite_strategy;
-
public static String HibernateGeneratorsComposite_CheckBoxLabel;
-
public static String HibernateGeneratorsComposite_SectionLabel;
+ public static String NamedQueryPropertyComposite_cacheable;
+ public static String NamedQueryPropertyComposite_cacheableWithDefault;
+ public static String NamedQueryPropertyComposite_flushMode;
+ public static String NamedQueryPropertyComposite_cacheMode;
+ public static String NamedQueryPropertyComposite_readOnly;
+ public static String NamedQueryPropertyComposite_readOnlyWithDefault;
+ public static String NamedQueryPropertyComposite_cacheRegion;
+ public static String NamedQueryPropertyComposite_fetchSize;
+ public static String NamedQueryPropertyComposite_timeout;
+ public static String HibernateAddQueryDialog_hibernateNamedQuery;
+ public static String HibernateAddQueryDialog_hibernateNamedNativeQuery;
+
private HibernateUIMappingMessages() {}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties 2009-07-09
13:37:41 UTC (rev 16518)
@@ -2,3 +2,14 @@
GenericGeneratorComposite_name=Name:
HibernateGeneratorsComposite_CheckBoxLabel=Generic generator
HibernateGeneratorsComposite_SectionLabel=Generic Generator
+NamedQueryPropertyComposite_cacheable=Cacheable
+NamedQueryPropertyComposite_cacheableWithDefault=Cacheable ({0})
+NamedQueryPropertyComposite_readOnly=Read Only
+NamedQueryPropertyComposite_readOnlyWithDefault=Read Only ({0})
+NamedQueryPropertyComposite_flushMode=Flush Mode
+NamedQueryPropertyComposite_cacheMode=Cache Mode
+NamedQueryPropertyComposite_cacheRegion=Cache Region
+NamedQueryPropertyComposite_fetchSize=Fetch Size
+NamedQueryPropertyComposite_timeout=Timeout
+HibernateAddQueryDialog_hibernateNamedQuery=Named Query (hibernate)
+HibernateAddQueryDialog_hibernateNamedNativeQuery=Named Native Query (hibernate)
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/persistence/details/HibernatePropertiesComposite.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/persistence/details/HibernatePropertiesComposite.java 2009-07-09
12:40:41 UTC (rev 16517)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/persistence/details/HibernatePropertiesComposite.java 2009-07-09
13:37:41 UTC (rev 16518)
@@ -317,7 +317,7 @@
}
public String getHelpID() {
- // TODO Auto-generated method stub
+ // TODO help
return null;
}