From fcb98666543cb5c6c19bbb5160ffe7d348427997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Mili=C4=87?= Date: Fri, 15 Jul 2022 15:03:16 +0200 Subject: [PATCH] feature/Bump H2 library; 1.4.141 -> 2.1.214 --- obp-api/pom.xml | 2 +- .../props/test.default.props.template | 7 +- .../main/scala/bootstrap/liftweb/Boot.scala | 4 +- .../scala/code/api/constant/constant.scala | 2 + .../code/api/util/migration/Migration.scala | 93 ++++++++++++------- ...grationOfConsentAuthContextDropIndex.scala | 5 +- .../MigrationOfUserAuthContext.scala | 5 +- .../MappedBankAttributeProvider.scala | 8 +- .../bankconnectors/LocalMappedConnector.scala | 3 +- .../context/MappedConsentAuthContext.scala | 4 +- .../MappedConsentAuthContextProvider.scala | 6 +- .../scala/code/metrics/MappedMetrics.scala | 3 +- obp-api/src/main/scala/code/model/OAuth.scala | 6 +- ...dTransactionRequestAttributeProvider.scala | 6 +- .../TransactionRequestAttribute.scala | 4 +- .../code/users/MappedUserAttribute.scala | 8 +- .../code/util/NewAttributeQueryTrait.scala | 4 +- .../webuiprops/MappedWebUiPropsProvider.scala | 6 +- .../code/atms/MappedAtmsProviderTest.scala | 2 +- .../branches/MappedBranchesProviderTest.scala | 2 +- .../products/MappedProductsProviderTest.scala | 2 +- 21 files changed, 106 insertions(+), 76 deletions(-) diff --git a/obp-api/pom.xml b/obp-api/pom.xml index 700fc4b19..f29ac3b4c 100644 --- a/obp-api/pom.xml +++ b/obp-api/pom.xml @@ -115,7 +115,7 @@ com.h2database h2 - 1.4.191 + 2.1.214 runtime diff --git a/obp-api/src/main/resources/props/test.default.props.template b/obp-api/src/main/resources/props/test.default.props.template index 0a54e2d3b..1aa12bb2b 100644 --- a/obp-api/src/main/resources/props/test.default.props.template +++ b/obp-api/src/main/resources/props/test.default.props.template @@ -66,10 +66,11 @@ tests.port=8016 End of minimum settings #################################### -#if connector is mapped, set a database backend. If not set, this will be set to an in-memory h2 database by default -#you can use a no config needed h2 database by setting db.driver=org.h2.Driver and not including db.url +# if connector is mapped, set a database backend. If not set, this will be set to an in-memory h2 database by default +# you can use a no config needed h2 database by setting db.driver=org.h2.Driver and not including db.url +# Please note that since update o version 2.1.214 we use NON_KEYWORDS=VALUE to bypass reserved word issue in SQL statements #db.driver=org.h2.Driver -#db.url=jdbc:h2:./lift_proto.db;DB_CLOSE_ON_EXIT=FALSE +#db.url=jdbc:h2:./lift_proto.db;NON_KEYWORDS=VALUE;DB_CLOSE_ON_EXIT=FALSE #set this to false if you don't want the api payments call to work payments_enabled=false diff --git a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala index 71e23d6bb..12ac29629 100644 --- a/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala +++ b/obp-api/src/main/scala/bootstrap/liftweb/Boot.scala @@ -246,14 +246,14 @@ class Boot extends MdcLoggable { case Props.RunModes.Test => new StandardDBVendor( driver, - APIUtil.getPropsValue("db.url") openOr "jdbc:h2:mem:OBPTest;DB_CLOSE_DELAY=-1", + APIUtil.getPropsValue("db.url") openOr Constant.h2DatabaseDefaultUrlValue, APIUtil.getPropsValue("db.user").orElse(Empty), APIUtil.getPropsValue("db.password").orElse(Empty) ) case _ => new StandardDBVendor( driver, - "jdbc:h2:mem:OBPTest;DB_CLOSE_DELAY=-1", + h2DatabaseDefaultUrlValue, Empty, Empty) } diff --git a/obp-api/src/main/scala/code/api/constant/constant.scala b/obp-api/src/main/scala/code/api/constant/constant.scala index df24e99d7..b6584e625 100644 --- a/obp-api/src/main/scala/code/api/constant/constant.scala +++ b/obp-api/src/main/scala/code/api/constant/constant.scala @@ -8,6 +8,8 @@ import com.openbankproject.commons.util.ApiStandards // Note: Import this with: import code.api.Constant._ object Constant extends MdcLoggable { logger.info("Instantiating Constants") + + final val h2DatabaseDefaultUrlValue = "jdbc:h2:mem:OBPTest_H2_v2.1.214;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=10" final val HostName = APIUtil.getPropsValue("hostname").openOrThrowException(ErrorMessages.HostnameNotSpecified) def localIdentityProvider = APIUtil.getPropsValue("local_identity_provider", HostName) diff --git a/obp-api/src/main/scala/code/api/util/migration/Migration.scala b/obp-api/src/main/scala/code/api/util/migration/Migration.scala index 68ae2fc36..7bd8c1b25 100644 --- a/obp-api/src/main/scala/code/api/util/migration/Migration.scala +++ b/obp-api/src/main/scala/code/api/util/migration/Migration.scala @@ -64,15 +64,15 @@ object Migration extends MdcLoggable { addAccountAccessConsumerId() populateTableViewDefinition() populateTableAccountAccess() - generateAndPopulateMissingCustomerUUIDs() - generateAndPopulateMissingConsumersUUIDs() + generateAndPopulateMissingCustomerUUIDs(startedBeforeSchemifier) + generateAndPopulateMissingConsumersUUIDs(startedBeforeSchemifier) populateTableRateLimiting() updateTableViewDefinition() bankAccountHoldersAndOwnerViewAccessInfo() alterTableMappedConsent() alterColumnChallengeAtTableMappedConsent() alterTableOpenIDConnectToken() - alterTableMappedUserAuthContext() + alterTableMappedUserAuthContext(startedBeforeSchemifier) alterTableMappedUserAuthContextUpdate() populateNameAndAppTypeFieldsAtConsumerTable() populateAzpAndSubFieldsAtConsumerTable() @@ -80,7 +80,7 @@ object Migration extends MdcLoggable { populateSettlementBankAccounts() alterColumnStatusAtTableMappedConsent() alterColumnDetailsAtTableTransactionRequest() - deleteDuplicatedRowsInTheTableUserAuthContext() + deleteDuplicatedRowsInTheTableUserAuthContext(startedBeforeSchemifier) populateTheFieldDeletedAtResourceUser(startedBeforeSchemifier) populateTheFieldIsActiveAtProductAttribute(startedBeforeSchemifier) alterColumnUsernameProviderFirstnameAndLastnameAtAuthUser(startedBeforeSchemifier) @@ -124,36 +124,47 @@ object Migration extends MdcLoggable { } } - private def generateAndPopulateMissingCustomerUUIDs(): Boolean = { - val name = nameOf(generateAndPopulateMissingCustomerUUIDs) - runOnce(name) { - val startDate = System.currentTimeMillis() - val commitId: String = APIUtil.gitCommit - val isSuccessful = CustomerX.customerProvider.vend.populateMissingUUIDs() - val endDate = System.currentTimeMillis() + private def generateAndPopulateMissingCustomerUUIDs(startedBeforeSchemifier: Boolean): Boolean = { + if(startedBeforeSchemifier == true) { + logger.warn(s"Migration.database.generateAndPopulateMissingCustomerUUIDs(true) cannot be run before Schemifier.") + true + } else { + val name = nameOf(generateAndPopulateMissingCustomerUUIDs(startedBeforeSchemifier)) + runOnce(name) { + val startDate = System.currentTimeMillis() + val commitId: String = APIUtil.gitCommit + val isSuccessful = CustomerX.customerProvider.vend.populateMissingUUIDs() + val endDate = System.currentTimeMillis() - val comment: String = - s"""Execute `generateAndPopulateMissingCustomerUUIDs` - |Duration: ${endDate - startDate} ms; + val comment: String = + s"""Execute `generateAndPopulateMissingCustomerUUIDs` + |Duration: ${endDate - startDate} ms; """.stripMargin - saveLog(name, commitId, isSuccessful, startDate, endDate, comment) - isSuccessful + saveLog(name, commitId, isSuccessful, startDate, endDate, comment) + isSuccessful + } } + } - private def generateAndPopulateMissingConsumersUUIDs(): Boolean = { - val name = nameOf(generateAndPopulateMissingConsumersUUIDs) - runOnce(name) { - val startDate = System.currentTimeMillis() - val commitId: String = APIUtil.gitCommit - val isSuccessful = Consumers.consumers.vend.populateMissingUUIDs() - val endDate = System.currentTimeMillis() - val comment: String = - s"""Execute `generateAndPopulateMissingConsumersUUIDs` - |Duration: ${endDate - startDate} ms; + private def generateAndPopulateMissingConsumersUUIDs(startedBeforeSchemifier: Boolean): Boolean = { + if(startedBeforeSchemifier == true) { + logger.warn(s"Migration.database.generateAndPopulateMissingConsumersUUIDs(true) cannot be run before Schemifier.") + true + } else { + val name = nameOf(generateAndPopulateMissingConsumersUUIDs(startedBeforeSchemifier)) + runOnce(name) { + val startDate = System.currentTimeMillis() + val commitId: String = APIUtil.gitCommit + val isSuccessful = Consumers.consumers.vend.populateMissingUUIDs() + val endDate = System.currentTimeMillis() + val comment: String = + s"""Execute `generateAndPopulateMissingConsumersUUIDs` + |Duration: ${endDate - startDate} ms; """.stripMargin - saveLog(name, commitId, isSuccessful, startDate, endDate, comment) - isSuccessful + saveLog(name, commitId, isSuccessful, startDate, endDate, comment) + isSuccessful + } } } @@ -208,10 +219,15 @@ object Migration extends MdcLoggable { MigrationOfConsumer.populateAzpAndSub(name) } } - private def alterTableMappedUserAuthContext(): Boolean = { - val name = nameOf(alterTableMappedUserAuthContext) - runOnce(name) { - MigrationOfMappedUserAuthContext.dropUniqueIndex(name) + private def alterTableMappedUserAuthContext(startedBeforeSchemifier: Boolean): Boolean = { + if(startedBeforeSchemifier == true) { + logger.warn(s"Migration.database.alterTableMappedUserAuthContext(true) cannot be run before Schemifier.") + true + } else { + val name = nameOf(alterTableMappedUserAuthContext(startedBeforeSchemifier)) + runOnce(name) { + MigrationOfMappedUserAuthContext.dropUniqueIndex(name) + } } } private def alterTableMappedUserAuthContextUpdate(): Boolean = { @@ -244,10 +260,15 @@ object Migration extends MdcLoggable { MigrationOfTransactionRequerst.alterColumnDetails(name) } } - private def deleteDuplicatedRowsInTheTableUserAuthContext(): Boolean = { - val name = nameOf(deleteDuplicatedRowsInTheTableUserAuthContext) - runOnce(name) { - MigrationOfUserAuthContext.removeDuplicates(name) + private def deleteDuplicatedRowsInTheTableUserAuthContext(startedBeforeSchemifier: Boolean): Boolean = { + if(startedBeforeSchemifier == true) { + logger.warn(s"Migration.database.deleteDuplicatedRowsInTheTableUserAuthContext(true) cannot be run before Schemifier.") + true + } else { + val name = nameOf(deleteDuplicatedRowsInTheTableUserAuthContext(startedBeforeSchemifier)) + runOnce(name) { + MigrationOfUserAuthContext.removeDuplicates(name) + } } } private def populateTheFieldDeletedAtResourceUser(startedBeforeSchemifier: Boolean): Boolean = { diff --git a/obp-api/src/main/scala/code/api/util/migration/MigrationOfConsentAuthContextDropIndex.scala b/obp-api/src/main/scala/code/api/util/migration/MigrationOfConsentAuthContextDropIndex.scala index 1b421bcb0..95ff17449 100644 --- a/obp-api/src/main/scala/code/api/util/migration/MigrationOfConsentAuthContextDropIndex.scala +++ b/obp-api/src/main/scala/code/api/util/migration/MigrationOfConsentAuthContextDropIndex.scala @@ -8,10 +8,11 @@ import net.liftweb.mapper.{DB, Schemifier} import net.liftweb.util.DefaultConnectionIdentifier import scalikejdbc.DB.CPContext import scalikejdbc._ - import java.time.format.DateTimeFormatter import java.time.{ZoneId, ZonedDateTime} +import code.api.Constant + object MigrationOfConsentAuthContextDropIndex { val oneDayAgo = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1) @@ -19,7 +20,7 @@ object MigrationOfConsentAuthContextDropIndex { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm'Z'") private lazy val getDbConnectionParameters: (String, String, String) = { - val dbUrl = APIUtil.getPropsValue("db.url") openOr "jdbc:h2:mem:OBPTest;DB_CLOSE_DELAY=-1" + val dbUrl = APIUtil.getPropsValue("db.url") openOr Constant.h2DatabaseDefaultUrlValue val username = dbUrl.split(";").filter(_.contains("user")).toList.headOption.map(_.split("=")(1)) val password = dbUrl.split(";").filter(_.contains("password")).toList.headOption.map(_.split("=")(1)) val dbUser = APIUtil.getPropsValue("db.user").orElse(username) diff --git a/obp-api/src/main/scala/code/api/util/migration/MigrationOfUserAuthContext.scala b/obp-api/src/main/scala/code/api/util/migration/MigrationOfUserAuthContext.scala index 18146714b..1c5d67eb5 100644 --- a/obp-api/src/main/scala/code/api/util/migration/MigrationOfUserAuthContext.scala +++ b/obp-api/src/main/scala/code/api/util/migration/MigrationOfUserAuthContext.scala @@ -3,6 +3,7 @@ package code.api.util.migration import java.time.format.DateTimeFormatter import java.time.{ZoneId, ZonedDateTime} +import code.api.Constant import code.api.util.APIUtil import code.api.util.migration.Migration.{DbFunction, saveLog} import code.context.MappedUserAuthContext @@ -20,7 +21,7 @@ object MigrationOfUserAuthContext { val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm'Z'") private lazy val getDbConnectionParameters: (String, String, String) = { - val dbUrl = APIUtil.getPropsValue("db.url") openOr "jdbc:h2:mem:OBPTest;DB_CLOSE_DELAY=-1" + val dbUrl = APIUtil.getPropsValue("db.url") openOr Constant.h2DatabaseDefaultUrlValue val username = dbUrl.split(";").filter(_.contains("user")).toList.headOption.map(_.split("=")(1)) val password = dbUrl.split(";").filter(_.contains("password")).toList.headOption.map(_.split("=")(1)) val dbUser = APIUtil.getPropsValue("db.user").orElse(username) @@ -51,6 +52,8 @@ object MigrationOfUserAuthContext { // Make back up DbFunction.makeBackUpOfTable(MappedUserAuthContext) + MappedUserAuthContext.findAll() + val startDate = System.currentTimeMillis() val commitId: String = APIUtil.gitCommit diff --git a/obp-api/src/main/scala/code/bankattribute/MappedBankAttributeProvider.scala b/obp-api/src/main/scala/code/bankattribute/MappedBankAttributeProvider.scala index 51482c050..96b4d9abb 100644 --- a/obp-api/src/main/scala/code/bankattribute/MappedBankAttributeProvider.scala +++ b/obp-api/src/main/scala/code/bankattribute/MappedBankAttributeProvider.scala @@ -37,7 +37,7 @@ object BankAttributeProvider extends BankAttributeProviderTrait { attribute.BankId_(bankId.value) .Name(name) .Type(attributType.toString) - .Value(value) + .`Value`(value) .IsActive(isActive.getOrElse(true)) .saveMe() } @@ -50,7 +50,7 @@ object BankAttributeProvider extends BankAttributeProviderTrait { .BankId_(bankId.value) .Name(name) .Type(attributType.toString()) - .Value(value) + .`Value`(value) .IsActive(isActive.getOrElse(true)) .saveMe() } @@ -73,7 +73,7 @@ class BankAttribute extends BankAttributeTrait with LongKeyedMapper[BankAttribut object BankAttributeId extends MappedUUID(this) object Name extends MappedString(this, 50) object Type extends MappedString(this, 50) - object Value extends MappedString(this, 255) + object `Value` extends MappedString(this, 255) object IsActive extends MappedBoolean(this) { override def defaultValue = true } @@ -83,7 +83,7 @@ class BankAttribute extends BankAttributeTrait with LongKeyedMapper[BankAttribut override def bankAttributeId: String = BankAttributeId.get override def name: String = Name.get override def attributeType: BankAttributeType.Value = BankAttributeType.withName(Type.get) - override def value: String = Value.get + override def value: String = `Value`.get override def isActive: Option[Boolean] = if (IsActive.jdbcFriendly(IsActive.calcFieldName) == null) { None } else Some(IsActive.get) } diff --git a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala index bb1aefb19..75b9df1a1 100644 --- a/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala +++ b/obp-api/src/main/scala/code/bankconnectors/LocalMappedConnector.scala @@ -10,6 +10,7 @@ import code.accountapplication.AccountApplicationX import code.accountattribute.AccountAttributeX import code.accountholders.{AccountHolders, MapperAccountHolders} import code.api.BerlinGroup.{AuthenticationType, ScaStatus} +import code.api.Constant import code.api.Constant.{INCOMING_SETTLEMENT_ACCOUNT_ID, OUTGOING_SETTLEMENT_ACCOUNT_ID} import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON import code.api.attributedefinition.{AttributeDefinition, AttributeDefinitionDI} @@ -840,7 +841,7 @@ object LocalMappedConnector extends Connector with MdcLoggable { } private lazy val getDbConnectionParameters: (String, String, String) = { - val dbUrl = APIUtil.getPropsValue("db.url") openOr "jdbc:h2:mem:OBPTest;DB_CLOSE_DELAY=-1" + val dbUrl = APIUtil.getPropsValue("db.url") openOr Constant.h2DatabaseDefaultUrlValue val username = dbUrl.split(";").filter(_.contains("user")).toList.headOption.map(_.split("=")(1)) val password = dbUrl.split(";").filter(_.contains("password")).toList.headOption.map(_.split("=")(1)) val dbUser = APIUtil.getPropsValue("db.user").orElse(username) diff --git a/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala b/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala index 19a24eac3..8f57fb243 100644 --- a/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala +++ b/obp-api/src/main/scala/code/context/MappedConsentAuthContext.scala @@ -11,11 +11,11 @@ class MappedConsentAuthContext extends ConsentAuthContext with LongKeyedMapper[M object ConsentAuthContextId extends MappedUUID(this) object ConsentId extends UUIDString(this) object Key extends MappedString(this, 255) - object Value extends MappedString(this, 255) + object `Value` extends MappedString(this, 255) override def consentId = ConsentId.get override def key = Key.get - override def value = Value.get + override def value = `Value`.get override def consentAuthContextId = ConsentAuthContextId.get override def timeStamp = createdAt.get } diff --git a/obp-api/src/main/scala/code/context/MappedConsentAuthContextProvider.scala b/obp-api/src/main/scala/code/context/MappedConsentAuthContextProvider.scala index d509381a0..f25688d6c 100644 --- a/obp-api/src/main/scala/code/context/MappedConsentAuthContextProvider.scala +++ b/obp-api/src/main/scala/code/context/MappedConsentAuthContextProvider.scala @@ -19,7 +19,7 @@ object MappedConsentAuthContextProvider extends ConsentAuthContextProvider with } def createConsentAuthContextAkka(consentId: String, key: String, value: String): Box[MappedConsentAuthContext] = tryo { - MappedConsentAuthContext.create.ConsentId(consentId).Key(key).Value(value).saveMe() + MappedConsentAuthContext.create.ConsentId(consentId).Key(key).`Value`(value).saveMe() } override def getConsentAuthContexts(consentId: String): Future[Box[List[MappedConsentAuthContext]]] = Future { @@ -50,11 +50,11 @@ object MappedConsentAuthContextProvider extends ConsentAuthContextProvider with By(MappedConsentAuthContext.ConsentId, consentId), By(MappedConsentAuthContext.Key, authContext.key) ).map( authContext => - authContext.Key(authContext.key).Value(authContext.value).saveMe() + authContext.Key(authContext.key).`Value`(authContext.value).saveMe() ) ) val created = create.map( authContext => - MappedConsentAuthContext.create.ConsentId(consentId).Key(authContext.key).Value(authContext.value).saveMe() + MappedConsentAuthContext.create.ConsentId(consentId).Key(authContext.key).`Value`(authContext.value).saveMe() ) tryo { updated ::: created diff --git a/obp-api/src/main/scala/code/metrics/MappedMetrics.scala b/obp-api/src/main/scala/code/metrics/MappedMetrics.scala index a17806dd4..e644ad523 100644 --- a/obp-api/src/main/scala/code/metrics/MappedMetrics.scala +++ b/obp-api/src/main/scala/code/metrics/MappedMetrics.scala @@ -4,6 +4,7 @@ import java.sql.{PreparedStatement, Timestamp} import java.util.Date import java.util.UUID.randomUUID +import code.api.Constant import code.api.cache.Caching import code.api.util._ import code.model.MappedConsumersProvider @@ -65,7 +66,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{ } private lazy val getDbConnectionParameters: (String, String, String) = { - val dbUrl = APIUtil.getPropsValue("db.url") openOr "jdbc:h2:mem:OBPTest;DB_CLOSE_DELAY=-1" + val dbUrl = APIUtil.getPropsValue("db.url") openOr Constant.h2DatabaseDefaultUrlValue val username = dbUrl.split(";").filter(_.contains("user")).toList.headOption.map(_.split("=")(1)) val password = dbUrl.split(";").filter(_.contains("password")).toList.headOption.map(_.split("=")(1)) val dbUser = APIUtil.getPropsValue("db.user").orElse(username) diff --git a/obp-api/src/main/scala/code/model/OAuth.scala b/obp-api/src/main/scala/code/model/OAuth.scala index ab6982bf8..56b9d881c 100644 --- a/obp-api/src/main/scala/code/model/OAuth.scala +++ b/obp-api/src/main/scala/code/model/OAuth.scala @@ -716,7 +716,7 @@ object MappedNonceProvider extends NoncesProvider { case None => } value match { - case Some(v) => n.value(v) + case Some(v) => n.`value`(v) case None => } val nonce = n.saveMe() @@ -733,7 +733,7 @@ object MappedNonceProvider extends NoncesProvider { timestamp: Date, value: String): Long = { Nonce.count( - By(Nonce.value, value), + By(Nonce.`value`, value), By(Nonce.tokenKey, tokenKey), By(Nonce.consumerkey, consumerKey), By(Nonce.timestamp, timestamp) @@ -763,7 +763,7 @@ class Nonce extends LongKeyedMapper[Nonce] { timestamp.get.getTime().toString() } } - object value extends MappedString(this,250) + object `value` extends MappedString(this,250) } object Nonce extends Nonce with LongKeyedMetaMapper[Nonce]{} diff --git a/obp-api/src/main/scala/code/transactionRequestAttribute/MappedTransactionRequestAttributeProvider.scala b/obp-api/src/main/scala/code/transactionRequestAttribute/MappedTransactionRequestAttributeProvider.scala index 01a1c5582..89e3f823e 100644 --- a/obp-api/src/main/scala/code/transactionRequestAttribute/MappedTransactionRequestAttributeProvider.scala +++ b/obp-api/src/main/scala/code/transactionRequestAttribute/MappedTransactionRequestAttributeProvider.scala @@ -99,7 +99,7 @@ object MappedTransactionRequestAttributeProvider extends TransactionRequestAttri .TransactionRequestId(transactionRequestId.value) .Name(name) .Type(attributeType.toString) - .Value(value) + .`Value`(value) .saveMe() } case _ => Empty @@ -112,7 +112,7 @@ object MappedTransactionRequestAttributeProvider extends TransactionRequestAttri .TransactionRequestId(transactionRequestId.value) .Name(name) .Type(attributeType.toString()) - .Value(value) + .`Value`(value) .saveMe() } } @@ -131,7 +131,7 @@ object MappedTransactionRequestAttributeProvider extends TransactionRequestAttri .BankId(bankId.value) .Name(transactionRequestAttribute.name) .Type(transactionRequestAttribute.attributeType.toString()) - .Value(transactionRequestAttribute.value) + .`Value`(transactionRequestAttribute.value) .saveMe() } } diff --git a/obp-api/src/main/scala/code/transactionRequestAttribute/TransactionRequestAttribute.scala b/obp-api/src/main/scala/code/transactionRequestAttribute/TransactionRequestAttribute.scala index ee8951339..99c55d000 100644 --- a/obp-api/src/main/scala/code/transactionRequestAttribute/TransactionRequestAttribute.scala +++ b/obp-api/src/main/scala/code/transactionRequestAttribute/TransactionRequestAttribute.scala @@ -21,7 +21,7 @@ class TransactionRequestAttribute extends TransactionRequestAttributeTrait with override def attributeType: TransactionRequestAttributeType.Value = TransactionRequestAttributeType.withName(Type.get) - override def value: String = Value.get + override def value: String = `Value`.get object BankId extends UUIDString(this) // combination of this @@ -33,7 +33,7 @@ class TransactionRequestAttribute extends TransactionRequestAttributeTrait with object Type extends MappedString(this, 50) - object Value extends MappedString(this, 255) + object `Value` extends MappedString(this, 255) } diff --git a/obp-api/src/main/scala/code/users/MappedUserAttribute.scala b/obp-api/src/main/scala/code/users/MappedUserAttribute.scala index d81decb22..6b281c10d 100644 --- a/obp-api/src/main/scala/code/users/MappedUserAttribute.scala +++ b/obp-api/src/main/scala/code/users/MappedUserAttribute.scala @@ -39,7 +39,7 @@ object MappedUserAttributeProvider extends UserAttributeProvider { .UserId(userId) .Name(name) .Type(attributeType.toString) - .Value(value) + .`Value`(value) .saveMe() } case _ => Empty @@ -51,7 +51,7 @@ object MappedUserAttributeProvider extends UserAttributeProvider { .UserId(userId) .Name(name) .Type(attributeType.toString()) - .Value(value) + .`Value`(value) .saveMe() } } @@ -67,13 +67,13 @@ class UserAttribute extends UserAttributeTrait with LongKeyedMapper[UserAttribut object UserId extends MappedUUID(this) object Name extends MappedString(this, 50) object Type extends MappedString(this, 50) - object Value extends MappedString(this, 255) + object `Value` extends MappedString(this, 255) override def userAttributeId: String = UserAttributeId.get override def userId: String = UserId.get override def name: String = Name.get override def attributeType: UserAttributeType.Value = UserAttributeType.withName(Type.get) - override def value: String = Value.get + override def value: String = `Value`.get override def insertDate: Date = createdAt.get } diff --git a/obp-api/src/main/scala/code/util/NewAttributeQueryTrait.scala b/obp-api/src/main/scala/code/util/NewAttributeQueryTrait.scala index 15399b269..4d5f14769 100644 --- a/obp-api/src/main/scala/code/util/NewAttributeQueryTrait.scala +++ b/obp-api/src/main/scala/code/util/NewAttributeQueryTrait.scala @@ -14,12 +14,12 @@ trait NewAttributeQueryTrait { // TODO Should we rename this column to attributeName private lazy val nameColumn = Name.dbColumnName // TODO Should we rename this column to attributeValue - private lazy val valueColumn = Value.dbColumnName + private lazy val valueColumn = `Value`.dbColumnName private lazy val parentIdColumn = ParentId.dbColumnName private lazy val bankIdColumn = BankId.dbColumnName val BankId: BaseMappedField val Name: BaseMappedField - val Value: BaseMappedField + val `Value`: BaseMappedField /** * Attribute entity's parent id, for example: CustomerAttribute.customerId, * need implemented in companion object diff --git a/obp-api/src/main/scala/code/webuiprops/MappedWebUiPropsProvider.scala b/obp-api/src/main/scala/code/webuiprops/MappedWebUiPropsProvider.scala index 7b0e545f9..e577e1c3b 100644 --- a/obp-api/src/main/scala/code/webuiprops/MappedWebUiPropsProvider.scala +++ b/obp-api/src/main/scala/code/webuiprops/MappedWebUiPropsProvider.scala @@ -23,7 +23,7 @@ object MappedWebUiPropsProvider extends WebUiPropsProvider { override def createOrUpdate(webUiProps: WebUiPropsT): Box[WebUiPropsT] = { WebUiProps.find(By(WebUiProps.Name, webUiProps.name)) .or(Full(WebUiProps.create)) - .map(_.Name(webUiProps.name).Value(webUiProps.value).saveMe()) + .map(_.Name(webUiProps.name).Value1(webUiProps.value).saveMe()) } override def delete(webUiPropsId: String):Box[Boolean] = WebUiProps.find(By(WebUiProps.WebUiPropsId, webUiPropsId)) match { @@ -60,11 +60,11 @@ class WebUiProps extends WebUiPropsT with LongKeyedMapper[WebUiProps] with IdPK object WebUiPropsId extends MappedUUID(this) object Name extends MappedString(this, 255) - object Value extends MappedText(this) + object Value1 extends MappedText(this) override def webUiPropsId: Option[String] = Option(WebUiPropsId.get) override def name: String = Name.get - override def value: String = Value.get + override def value: String = Value1.get } object WebUiProps extends WebUiProps with LongKeyedMetaMapper[WebUiProps] { diff --git a/obp-api/src/test/scala/code/atms/MappedAtmsProviderTest.scala b/obp-api/src/test/scala/code/atms/MappedAtmsProviderTest.scala index d2b816dce..6843b6858 100644 --- a/obp-api/src/test/scala/code/atms/MappedAtmsProviderTest.scala +++ b/obp-api/src/test/scala/code/atms/MappedAtmsProviderTest.scala @@ -105,7 +105,7 @@ class MappedAtmsProviderTest extends ServerSetup { atms.size should equal(3) And("they should be the licensed ones") - atms should equal (expectedAtms) + atms.sortBy(_.atmId.value) should equal (expectedAtms.sortBy(_.atmId.value)) } scenario("We try to get atms for a bank that doesn't have any") { diff --git a/obp-api/src/test/scala/code/branches/MappedBranchesProviderTest.scala b/obp-api/src/test/scala/code/branches/MappedBranchesProviderTest.scala index 32b01be99..5a787b436 100644 --- a/obp-api/src/test/scala/code/branches/MappedBranchesProviderTest.scala +++ b/obp-api/src/test/scala/code/branches/MappedBranchesProviderTest.scala @@ -104,7 +104,7 @@ class MappedBranchesProviderTest extends ServerSetup { branches.size should equal(3) And("they should be the licensed ones") - branches should equal (expectedBranches) + branches.sortBy(_.branchId.value) should equal (expectedBranches.sortBy(_.branchId.value)) } scenario("We try to get branches for a bank that doesn't have any") { diff --git a/obp-api/src/test/scala/code/products/MappedProductsProviderTest.scala b/obp-api/src/test/scala/code/products/MappedProductsProviderTest.scala index 58de82114..fa9be0808 100644 --- a/obp-api/src/test/scala/code/products/MappedProductsProviderTest.scala +++ b/obp-api/src/test/scala/code/products/MappedProductsProviderTest.scala @@ -93,7 +93,7 @@ class MappedProductsProviderTest extends ServerSetup { products.size should equal(3) And("they should be the licensed ones") - products should equal (expectedProducts) + products.sortBy(_.code.value) should equal (expectedProducts.sortBy(_.code.value)) } scenario("We try to get Products for a bank that doesn't have any") {