portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r1689980 - /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
Date Thu, 09 Jul 2015 02:56:30 GMT
Author: rwatler
Date: Thu Jul  9 02:56:30 2015
New Revision: 1689980

URL: http://svn.apache.org/r1689980
Log:
JS2-1329: Specify OJB retrieval of ids as BIGINT/long for Security queries.

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java?rev=1689980&r1=1689979&r2=1689980&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/JetspeedSecurityPersistenceManager.java
Thu Jul  9 02:56:30 2015
@@ -365,13 +365,15 @@ public class JetspeedSecurityPersistence
         // perform query
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name", "id"});
+        // need to force OJB to return a Long, otherwise it'll return a Integer causing a
CCE
+        query.setJdbcTypes(new int[]{Types.VARCHAR, Types.BIGINT});
         associatedNamesFrom = new ArrayList<String>();
         List<Long> associatedIdsFrom = new ArrayList<Long>();
         for (Iterator<Object[]> iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query);
iter.hasNext(); )
         {
             Object[] associatedFrom = iter.next();
             associatedNamesFrom.add((String) associatedFrom[0]);
-            associatedIdsFrom.add(((Integer) associatedFrom[1]).longValue());
+            associatedIdsFrom.add((Long) associatedFrom[1]);
         }
         // put result in cache
         try
@@ -411,13 +413,15 @@ public class JetspeedSecurityPersistence
         // perform query
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name", "id"});
+        // need to force OJB to return a Long, otherwise it'll return a Integer causing a
CCE
+        query.setJdbcTypes(new int[]{Types.VARCHAR, Types.BIGINT});
         associatedNamesFrom = new ArrayList<String>();
         List<Long> associatedIdsFrom = new ArrayList<Long>();
         for (Iterator<Object[]> iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query);
iter.hasNext(); )
         {
             Object[] associatedFrom = iter.next();
             associatedNamesFrom.add((String) associatedFrom[0]);
-            associatedIdsFrom.add(((Integer) associatedFrom[1]).longValue());
+            associatedIdsFrom.add((Long) associatedFrom[1]);
         }
         // put result in cache
         jspmCache.putAssociationQuery(cacheKey, principalFromId, associatedIdsFrom.toArray(new
Long[associatedIdsFrom.size()]), fromSecurityDomain, toSecurityDomain, new ArrayList<String>(associatedNamesFrom));
@@ -450,13 +454,15 @@ public class JetspeedSecurityPersistence
         // perform query
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name", "id"});
+        // need to force OJB to return a Long, otherwise it'll return a Integer causing a
CCE
+        query.setJdbcTypes(new int[]{Types.VARCHAR, Types.BIGINT});
         associatedNamesTo = new ArrayList<String>();
         List<Long> associatedIdsTo = new ArrayList<Long>();
         for (Iterator<Object[]> iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query);
iter.hasNext(); )
         {
             Object[] associatedTo = iter.next();
             associatedNamesTo.add((String) associatedTo[0]);
-            associatedIdsTo.add(((Integer) associatedTo[1]).longValue());
+            associatedIdsTo.add((Long) associatedTo[1]);
         }
         // put result in cache
         try
@@ -496,13 +502,15 @@ public class JetspeedSecurityPersistence
         // perform query
         ReportQueryByCriteria query = QueryFactory.newReportQuery(PersistentJetspeedPrincipal.class,
criteria);
         query.setAttributes(new String[]{"name", "id"});
+        // need to force OJB to return a Long, otherwise it'll return a Integer causing a
CCE
+        query.setJdbcTypes(new int[]{Types.VARCHAR, Types.BIGINT});
         associatedNamesTo = new ArrayList<String>();
         List<Long> associatedIdsTo = new ArrayList<Long>();
         for (Iterator<Object[]> iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query);
iter.hasNext(); )
         {
             Object[] associatedTo = iter.next();
             associatedNamesTo.add((String) associatedTo[0]);
-            associatedIdsTo.add(((Integer) associatedTo[1]).longValue());
+            associatedIdsTo.add((Long) associatedTo[1]);
         }
         // put result in cache
         jspmCache.putAssociationQuery(cacheKey, principalToId, associatedIdsTo.toArray(new
Long[associatedIdsTo.size()]), fromSecurityDomain, toSecurityDomain, new ArrayList<String>(associatedNamesTo));



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message