ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [2/2] incubator-ignite git commit: # IGNITE-843 Support Hibernate Store.
Date Thu, 25 Jun 2015 11:38:02 GMT
# IGNITE-843 Support Hibernate Store.


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

Branch: refs/heads/ignite-843
Commit: 20f6c1548a79e723b7dfedf668fc2dbbf37024e6
Parents: e4905d4
Author: sevdokimov <sergey.evdokimov@jetbrains.com>
Authored: Thu Jun 25 14:37:10 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
Committed: Thu Jun 25 14:37:10 2015 +0300

----------------------------------------------------------------------
 modules/webconfig/nodejs/utils/generatorJava.js | 22 +++++++++++++++
 .../webconfig/nodejs/utils/generatorUtils.js    |  2 +-
 modules/webconfig/nodejs/utils/generatorXml.js  | 29 ++++++++++++++------
 3 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/20f6c154/modules/webconfig/nodejs/utils/generatorJava.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/utils/generatorJava.js b/modules/webconfig/nodejs/utils/generatorJava.js
index 0ca8578..a1bc00a 100644
--- a/modules/webconfig/nodejs/utils/generatorJava.js
+++ b/modules/webconfig/nodejs/utils/generatorJava.js
@@ -479,6 +479,28 @@ function addBeanWithProperties(res, bean, objVarName, beanPropName, beanVarName,
                             addProperty(res, bean, beanVarName, propName, 'float', descr.setterName);
                             break;
                         
+                        case 'propertiesAsList':
+                            var val = bean[propName];
+                            
+                            if (val && val.length > 0) {
+                                res.line('Properties ' + descr.propVarName + ' = new Properties();');
+                                
+                                for (var i = 0; i < val.length; i++) {
+                                    var nameAndValue = val[i];
+                                    
+                                    var eqIndex = nameAndValue.indexOf('=');
+                                    if (eqIndex >= 0) {
+                                        res.line(descr.propVarName + '.setProperty(' 
+                                            + nameAndValue.substring(0, eqIndex) + ', ' 
+                                            + nameAndValue.substr(eqIndex + 1) + ');');
+                                    }
+
+                                }
+                                
+                                res.line(beanVarName + '.' + getSetterName(propName) + '('
+ descr.propVarName + ');');
+                            }
+                            break;
+                        
                         case 'className':
                             if (bean[propName]) {
                                 res.line(beanVarName + '.' + getSetterName(propName) + '(new
' + bean[propName] + '());');

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/20f6c154/modules/webconfig/nodejs/utils/generatorUtils.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/utils/generatorUtils.js b/modules/webconfig/nodejs/utils/generatorUtils.js
index 618c93b..b987917 100644
--- a/modules/webconfig/nodejs/utils/generatorUtils.js
+++ b/modules/webconfig/nodejs/utils/generatorUtils.js
@@ -151,7 +151,7 @@ exports.storeFactories = {
     }),
 
     CacheHibernateBlobStoreFactory: new ClassDescriptor('org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory',
{
-        hibernateProperties: {type: 'list'}
+        hibernateProperties: {type: 'propertiesAsList', propVarName: 'props'}
     })
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/20f6c154/modules/webconfig/nodejs/utils/generatorXml.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/utils/generatorXml.js b/modules/webconfig/nodejs/utils/generatorXml.js
index 5fb9cf0..c716c8c 100644
--- a/modules/webconfig/nodejs/utils/generatorXml.js
+++ b/modules/webconfig/nodejs/utils/generatorXml.js
@@ -410,14 +410,6 @@ function addBeanWithProperties(res, bean, beanPropName, beanClass, props,
create
     if (!bean)
         return;
 
-    var hasProp = false;
-    for (var i = 0; i < props.length; i++) {
-        if (bean[props[i]]) {
-            hasProp = true;
-            break;
-        }
-    }
-    
     if (generatorUtils.hasProperty(bean, props)) {
         res.emptyLineIfNeeded();
         res.startBlock('<property name="' + beanPropName + '">');
@@ -438,6 +430,27 @@ function addBeanWithProperties(res, bean, beanPropName, beanClass, props,
create
                             res.endBlock('</property>');
                         }
                     }
+                    else if (descr.type == 'propertiesAsList') {
+                        var val = bean[propName];
+
+                        if (val && val.length > 0) {
+                            res.startBlock('<property name="' + propName + '">');
+                            res.startBlock('<props>');
+
+                            for (var i = 0; i < val.length; i++) {
+                                var nameAndValue = val[i];
+
+                                var eqIndex = nameAndValue.indexOf('=');
+                                if (eqIndex >= 0) {
+                                    res.line('<prop key="' + escapeAttr(nameAndValue.substring(0,
eqIndex)) + '">' +
+                                            + escape(nameAndValue.substr(eqIndex + 1)) +
'</prop>');
+                                }
+                            }
+
+                            res.endBlock('</props>');
+                            res.endBlock('</property>');
+                        }
+                    }
                     else {
                         addProperty(res, bean, propName, descr.setterName);
                     }


Mime
View raw message