Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 113051 Details for
Bug 248031
API enhancement request for org.eclipse.jpt.db.Column
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
248031.patch.txt (text/plain), 4.50 KB, created by
Danny Ju
on 2008-09-19 16:54:19 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Danny Ju
Created:
2008-09-19 16:54:19 EDT
Size:
4.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.db >Index: src/org/eclipse/jpt/db/Column.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/Column.java,v >retrieving revision 1.4 >diff -u -r1.4 Column.java >--- src/org/eclipse/jpt/db/Column.java 29 Jul 2008 05:25:46 -0000 1.4 >+++ src/org/eclipse/jpt/db/Column.java 19 Sep 2008 20:29:36 -0000 >@@ -9,6 +9,8 @@ > ******************************************************************************/ > package org.eclipse.jpt.db; > >+import org.eclipse.datatools.modelbase.sql.datatypes.CharacterStringDataType; >+import org.eclipse.datatools.modelbase.sql.datatypes.NumericalDataType; > import org.eclipse.jpt.utility.JavaType; > > /** >@@ -80,4 +82,38 @@ > */ > JavaType getPrimaryKeyJavaType(); > >+ /** >+ * Return whether the column is part of it's table's unique constraint. >+ */ >+ public boolean isPartOfUniqueConstraint(); >+ >+ /** >+ * Return whether the column is nullable. >+ */ >+ public boolean isNullable(); >+ >+ /** >+ * Return whether the column is of numeric type. >+ */ >+ public boolean isNumeric() ; >+ >+ /** >+ * Return precision of the column if it is NumericalDataType >+ * otherwise, return -1 >+ */ >+ public int getPrecision(); >+ >+ /** >+ * Return scale of the column if it is ExactNumericDataType >+ * otherwise, return -1 >+ */ >+ public int getScale(); >+ >+ /** >+ * Return size of the column: >+ * - if the column is CharacterStringDataType, return the length >+ * - otherwise, return -1 >+ */ >+ public int getLength() ; >+ > } >Index: src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java,v >retrieving revision 1.5 >diff -u -r1.5 DTPColumnWrapper.java >--- src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java 29 Jul 2008 05:25:46 -0000 1.5 >+++ src/org/eclipse/jpt/db/internal/DTPColumnWrapper.java 19 Sep 2008 20:29:37 -0000 >@@ -12,7 +12,10 @@ > import java.text.Collator; > > import org.eclipse.datatools.modelbase.dbdefinition.PredefinedDataTypeDefinition; >+import org.eclipse.datatools.modelbase.sql.datatypes.CharacterStringDataType; > import org.eclipse.datatools.modelbase.sql.datatypes.DataType; >+import org.eclipse.datatools.modelbase.sql.datatypes.ExactNumericDataType; >+import org.eclipse.datatools.modelbase.sql.datatypes.NumericalDataType; > import org.eclipse.datatools.modelbase.sql.datatypes.PredefinedDataType; > import org.eclipse.datatools.modelbase.sql.datatypes.PrimitiveType; > import org.eclipse.jpt.db.Column; >@@ -47,9 +50,13 @@ > this.getConnectionProfile().columnChanged(this); > } > >+ // ********** return the wrapped DTP Column ********** > >- // ********** Column implementation ********** >+ public org.eclipse.datatools.modelbase.sql.tables.Column getDtpColumn(){ >+ return this.dtpColumn; >+ } > >+ // ********** Column implementation ********** > public String getName() { > return this.dtpColumn.getName(); > } >@@ -66,6 +73,47 @@ > return this.getTable().foreignKeyBaseColumnsContains(this); > } > >+ public boolean isPartOfUniqueConstraint() { >+ return this.dtpColumn.isPartOfUniqueConstraint() ; >+ } >+ >+ public boolean isNullable() { >+ return this.dtpColumn.isNullable(); >+ } >+ >+ public int getPrecision(){ >+ DataType dataType = this.dtpColumn.getDataType(); >+ if( dataType instanceof NumericalDataType){ >+ NumericalDataType type = (NumericalDataType)dataType; >+ return type.getPrecision(); >+ } >+ return -1; >+ } >+ >+ public int getScale(){ >+ DataType dataType = this.dtpColumn.getDataType(); >+ if( dataType instanceof ExactNumericDataType){ >+ ExactNumericDataType type = (ExactNumericDataType)dataType; >+ return type.getScale(); >+ } >+ return -1; >+ } >+ >+ public int getLength() { >+ DataType dataType = this.dtpColumn.getDataType(); >+ if(dataType instanceof CharacterStringDataType){ >+ CharacterStringDataType type = (CharacterStringDataType)dataType ; >+ return type.getLength(); >+ } >+ return -1; >+ } >+ >+ public boolean isNumeric() { >+ DataType dataType = this.dtpColumn.getDataType(); >+ boolean ret = dataType instanceof NumericalDataType; >+ return ret; >+ } >+ > public String getDataTypeName() { > DataType dataType = this.dtpColumn.getDataType(); > return (dataType == null) ? null : dataType.getName();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
neil.hauge
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 248031
: 113051