ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: IGNITE-5071 Added table name property for query entity.
Date Thu, 04 May 2017 15:33:41 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 8cd9fbe59 -> 94c1d7589


IGNITE-5071 Added table name property for query entity.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/94c1d758
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/94c1d758
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/94c1d758

Branch: refs/heads/master
Commit: 94c1d758940fc4d82d855760f7b514d329e46daa
Parents: 8cd9fbe
Author: Vasiliy Sisko <vsisko@gridgain.com>
Authored: Thu May 4 22:33:29 2017 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Thu May 4 22:33:29 2017 +0700

----------------------------------------------------------------------
 modules/web-console/backend/app/mongo.js        |  1 +
 .../generator/ConfigurationGenerator.js         |  3 ++-
 .../states/configuration/domains/general.pug    |  4 ++--
 .../states/configuration/domains/query.pug      |  2 ++
 .../frontend/controllers/domains-controller.js  | 24 ++++++++++++++------
 .../views/configuration/domains-import.tpl.pug  | 11 +++++----
 6 files changed, 31 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 80be010..077044c 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -105,6 +105,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo,
mongoose
         caches: [{type: ObjectId, ref: 'Cache'}],
         queryMetadata: {type: String, enum: ['Annotations', 'Configuration']},
         kind: {type: String, enum: ['query', 'store', 'both']},
+        tableName: String,
         databaseSchema: String,
         databaseTable: String,
         keyType: String,

http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index d5aecdb..8bc74a9 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1342,7 +1342,8 @@ export default class IgniteConfigurationGenerator {
             const fields = _.map(domain.fields,
                 (e) => ({name: e.name, className: javaTypes.fullClassName(e.className)}));
 
-            cfg.mapProperty('fields', fields, 'fields', true)
+            cfg.stringProperty('tableName')
+                .mapProperty('fields', fields, 'fields', true)
                 .mapProperty('aliases', 'aliases');
 
             const indexes = _.map(domain.indexes, (index) =>

http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
b/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
index 6432adf..a6d3fc2 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/domains/general.pug
@@ -18,6 +18,7 @@ include /app/helpers/jade/mixins
 
 -var form = 'general'
 -var model = 'backupItem'
+-var generatePojo = `${model}.generatePojo`
 
 .panel.panel-default(ng-form=form novalidate)
     .panel-heading(bs-collapse-toggle)
@@ -32,7 +33,7 @@ include /app/helpers/jade/mixins
         .panel-body
             .col-sm-6
                 .settings-row
-                    +checkbox('Generate POJO classes', `${model}.generatePojo`, '"generatePojo"',
'If selected then POJO classes will be generated from database tables')
+                    +checkbox('Generate POJO classes', generatePojo, '"generatePojo"', 'If
selected then POJO classes will be generated from database tables')
                 .settings-row
                     +caches(model, 'Select caches to associate domain model with cache')
                 .settings-row
@@ -42,7 +43,6 @@ include /app/helpers/jade/mixins
                             <li>Java annotations like @QuerySqlField</li>\
                             <li>Configuration via QueryEntity class</li>\
                         </ul>')
-                -var generatePojo = `${model}.generatePojo`
                 .settings-row
                     +java-class-typeahead('Key type:', `${model}.keyType`, '"keyType"', 'javaBuiltInClasses',
'true', 'true', '{{ ' + generatePojo + ' ? "Full class name for Key" : "Key type name" }}',
'Key class used to store key in cache', generatePojo)
                 .settings-row

http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
index a057f59..aff3c73 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/domains/query.pug
@@ -66,6 +66,8 @@ mixin table-index-item-edit(prefix, index, sortAvailable, idAddition)
                     label Not available for annotated types
                 div(ng-if=`${model}.queryMetadata === 'Configuration'`)
                     .settings-row
+                        +text('Table name:', `${model}.tableName`, '"tableName"', 'false',
'Enter table name', 'Table name for this query entity')
+                    .settings-row
                         +ignite-form-group(ng-model=queryFields ng-form=queryFieldsForm)
                             ignite-form-field-label(id='queryFields')
                                 | Fields

http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index d7237b9..3c8830b 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -63,7 +63,8 @@ export default ['domainsController', [
         $scope.ui.generatePojo = true;
         $scope.ui.builtinKeys = true;
         $scope.ui.usePrimitives = true;
-        $scope.ui.generateAliases = true;
+        $scope.ui.generateTypeAliases = true;
+        $scope.ui.generateFieldAliases = true;
         $scope.ui.generatedCachesClusters = [];
 
         function _mapCaches(caches) {
@@ -857,7 +858,15 @@ export default ['domainsController', [
                         containDup = true;
                     }
 
-                    const valType = generatePojo ? _toJavaPackage(packageName) + '.' + typeName
: tableName;
+                    let valType = tableName;
+                    let typeAlias;
+
+                    if (generatePojo) {
+                        if ($scope.ui.generateTypeAliases && tableName.toLowerCase()
!== typeName.toLowerCase())
+                            typeAlias = tableName;
+
+                        valType = _toJavaPackage(packageName) + '.' + typeName;
+                    }
 
                     let _containKey = false;
 
@@ -868,7 +877,7 @@ export default ['domainsController', [
 
                         const dbName = fld.databaseFieldName;
 
-                        if ($scope.ui.generateAliases &&
+                        if (generatePojo && $scope.ui.generateFieldAliases &&
                             SqlTypes.validIdentifier(dbName) && !SqlTypes.isKeyword(dbName)
&&
                             !_.find(aliases, {field: fld.javaFieldName}) &&
                             fld.javaFieldName.toUpperCase() !== dbName.toUpperCase())
@@ -916,6 +925,7 @@ export default ['domainsController', [
                         newDomain.confirm = true;
                     }
 
+                    newDomain.tableName = typeAlias;
                     newDomain.keyType = valType + 'Key';
                     newDomain.valueType = valType;
                     newDomain.queryMetadata = 'Configuration';
@@ -1024,7 +1034,7 @@ export default ['domainsController', [
             function checkDuplicate() {
                 if (containDup) {
                     Confirm.confirm('Some tables have the same name.<br/>' +
-                            'Name of types for that tables will contain schema name too.')
+                        'Name of types for that tables will contain schema name too.')
                         .then(() => checkOverwrite());
                 }
                 else
@@ -1035,7 +1045,7 @@ export default ['domainsController', [
                 checkDuplicate();
             else {
                 Confirm.confirm('Some tables have no primary key.<br/>' +
-                        'You will need to configure key type and key fields for such tables
after import complete.')
+                    'You will need to configure key type and key fields for such tables after
import complete.')
                     .then(() => checkDuplicate());
             }
         }
@@ -1816,8 +1826,8 @@ export default ['domainsController', [
                 // Found duplicate.
                 if (idx >= 0 && idx !== curIdx) {
                     return !stopEdit && ErrorPopover.show(LegacyTable.tableFieldId(curIdx,
-                        'FieldName' + indexIdx + (curIdx >= 0 ? '-' : '')),
-                        'Field with such name already exists in index!', $scope.ui, 'query');
+                                'FieldName' + indexIdx + (curIdx >= 0 ? '-' : '')),
+                            'Field with such name already exists in index!', $scope.ui, 'query');
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/94c1d758/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 1289bb3..20a7b85 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -153,6 +153,7 @@ mixin td-ellipses-lbl(w, lbl)
                             button.btn.btn-primary(ng-click='applyDefaults()') Apply
                 .import-domain-model-wizard-page(ng-show='importDomain.action == "options"')
                     -var form = 'optionsForm'
+                    -var generatePojo = 'ui.generatePojo'
 
                     form.form-horizontal(name=form novalidate)
                         .settings-row
@@ -160,10 +161,12 @@ mixin td-ellipses-lbl(w, lbl)
                         .settings-row
                             +checkbox('Use primitive types for NOT NULL table columns', 'ui.usePrimitives',
'"domainUsePrimitives"', 'Use primitive types like "int", "long", "double" for POJOs fields
generation in case of NOT NULL columns')
                         .settings-row
-                            +checkbox('Generate aliases for query fields', 'ui.generateAliases',
'"domainGenerateAliases"', 'Generate aliases for query fields with database field names when
database field name differ from Java field name')
-                        .settings-row
-                            +checkbox('Generate POJO classes', 'ui.generatePojo', '"domainGeneratePojo"',
'If selected then POJO classes will be generated from database tables')
-                        .settings-row.settings-row_small-label(ng-show='ui.generatePojo')
+                            +checkbox('Generate POJO classes', generatePojo, '"domainGeneratePojo"',
'If selected then POJO classes will be generated from database tables')
+                        .settings-row(ng-show=generatePojo)
+                            +checkbox('Generate aliases for query entity', 'ui.generateTypeAliases',
'"domainGenerateTypeAliases"', 'Generate aliases for query entity if table name is invalid
Java identifier')
+                        .settings-row(ng-show=generatePojo)
+                            +checkbox('Generate aliases for query fields', 'ui.generateFieldAliases',
'"domainGenerateFieldAliases"', 'Generate aliases for query fields with database field names
when database field name differ from Java field name')
+                        .settings-row.settings-row_small-label(ng-show=generatePojo)
                             +java-package('Package:', 'ui.packageName', '"domainPackageName"',
true, true, 'Package that will be used for POJOs generation')(data-container='.modal-domain-import')
                         .settings-row.settings-row_small-label
                             +ignite-form-field-dropdown('Clusters:', 'ui.generatedCachesClusters',
'"generatedCachesClusters"', false, false, true,


Mime
View raw message