Skip to content

Commit

Permalink
Merge pull request #314 from sumeetphadnis/next
Browse files Browse the repository at this point in the history
Enable resultcode module
  • Loading branch information
ar authored Sep 18, 2024
2 parents 1c75c84 + db7e07c commit a6407da
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 30 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
jpos = "3.0.0-SNAPSHOT"
commonsLang3 = "3.14.0"
commonsLang3 = "3.17.0"
quartz = "2.5.0-rc1"
slf4j = "2.0.12"
jakartaBind = "4.0.1"
Expand Down Expand Up @@ -54,4 +54,4 @@ flywayPostgresql = { module = 'org.flywaydb:flyway-database-postgresql', version
flywayMysql = { module = 'org.flywaydb:flyway-mysql', version.ref='flyway' }
h2 = { module = 'com.h2database:h2', version.ref='h2' }
testcontainersPostgresql = { module = 'org.testcontainers:postgresql', version.ref='testcontainers' }
httpAsyncClient = { module = 'org.apache.httpcomponents:httpasyncclient', version.ref = 'httpAsyncClient' }
httpAsyncClient = { module = 'org.apache.httpcomponents:httpasyncclient', version.ref = 'httpAsyncClient' }
2 changes: 1 addition & 1 deletion modules/resultcode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ description = 'jPOS-EE :: Resultcode Module'

dependencies {
api project(':modules:dbsupport')
api libraries.commons_lang
api libs.commonsLang3
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,26 @@

import java.io.Serializable;
import java.util.List;
import java.sql.SQLException;

import org.hibernate.*;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.query.Query;

/** Automatically generated Finder class for ResultCodeFinder.
* @author Hibernate FinderGenerator **/
public class ResultCodeFinder implements Serializable {

public static List findByMnemonic(Session session, java.lang.String mnemonic) throws SQLException, HibernateException {
Query q = session.createQuery (
"from org.jpos.ee.ResultCode as resultcode where resultcode.mnemonic=:mnemonic"
public static List<ResultCode> findByMnemonic(Session session, java.lang.String mnemonic) throws HibernateException {
Query<ResultCode> q = session.createQuery (
"from org.jpos.ee.ResultCode as resultcode where resultcode.mnemonic=:mnemonic", ResultCode.class
);
q.setParameter ("mnemonic", mnemonic);
return q.list();
}

public static List findAll(Session session) throws SQLException, HibernateException {
public static List<ResultCode> findAll(Session session) throws HibernateException {
return session.createQuery(
"from ResultCode in class org.jpos.ee.ResultCode"
"from ResultCode in class org.jpos.ee.ResultCode", ResultCode.class
).list();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@

import java.io.Serializable;
import java.util.List;
import java.sql.SQLException;

import org.hibernate.*;
import org.hibernate.type.Type;
import org.hibernate.HibernateException;
import org.hibernate.Session;

/** Automatically generated Finder class for ResultCodeInfoFinder.
* @author Hibernate FinderGenerator **/
public class ResultCodeInfoFinder implements Serializable {

public static List findAll(Session session) throws SQLException, HibernateException {
public static List<ResultCodeInfo> findAll(Session session) throws HibernateException {
return session.createQuery(
"from ResultCodeInfo in class org.jpos.ee.ResultCodeInfo"
"from ResultCodeInfo in class org.jpos.ee.ResultCodeInfo", ResultCodeInfo.class
).list();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
package org.jpos.ee;

import java.util.List;
import java.util.Iterator;
import java.sql.SQLException;
import org.jpos.util.Logger;
import org.jpos.util.LogEvent;
import org.jpos.core.Configuration;
import org.hibernate.Query;
import org.hibernate.Transaction;
import org.hibernate.HibernateException;
import org.hibernate.ObjectNotFoundException;

Expand All @@ -38,8 +33,8 @@ public ResultCodeManager (DB db) {
}
public ResultCode get (long id) {
try {
return (ResultCode) db.session().load (
ResultCode.class, new Long(id)
return db.session().getReference (
ResultCode.class, id
);
} catch (ObjectNotFoundException e) {
LogEvent evt = db.getLog().createWarn ();
Expand All @@ -53,20 +48,18 @@ ResultCode.class, new Long(id)
}
public ResultCode get (String rc) {
try {
List l = ResultCodeFinder.findByMnemonic (db.session(), rc);
if (l.size() == 0) {
List<ResultCode> l = ResultCodeFinder.findByMnemonic (db.session(), rc);
if (l.isEmpty()) {
LogEvent evt = db.getLog().createWarn ();
evt.addMessage (
"error loading unconfigured result code '" + rc + "'"
);
Logger.log (evt);
} else {
return (ResultCode) l.get(0);
return l.getFirst();
}
} catch (HibernateException e) {
db.getLog().warn (e);
} catch (SQLException e) {
db.getLog().warn (e);
}
return null;
}
Expand All @@ -75,7 +68,7 @@ public ResultCode get (String rc, ResultCode defRc) {
return resultCode != null ? resultCode : defRc;
}
public ResultCodeInfo getInfo (ResultCode rc, String locale) {
return (ResultCodeInfo) rc.getLocales().get(locale);
return rc.getLocales().get(locale);
}
public ResultCodeInfo getInfo (String rc, String locale) {
ResultCode resultCode = get (rc);
Expand Down
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pluginManagement {
repositories {
mavenLocal();
gradlePluginPortal()
}
}
Expand All @@ -27,6 +26,7 @@ include ':modules:syslog'
include ':modules:cryptoservice'
include ':modules:cryptoserver'
include ':modules:http-client'
include ':modules:resultcode'
// include ':modules:dbtest'

dependencyResolutionManagement {
Expand All @@ -40,7 +40,6 @@ dependencyResolutionManagement {
}

// include ':modules:freemarker-decorator'
// include ':modules:resultcode'
// include ':modules:txn'
// include ':modules:db-mssql'
// include ':modules:minigl'
Expand Down

0 comments on commit a6407da

Please sign in to comment.