moved the APIModelSource.json to resources folder

This commit is contained in:
hongwei 2020-01-10 14:49:42 +01:00
parent 4c8979ea03
commit 5ae7b9a9e2
5 changed files with 15 additions and 4 deletions

2
.gitignore vendored
View File

@ -10,7 +10,7 @@
.project
.cache
target
obp-api/src/main/resources/
#obp-api/src/main/resources/
obp-api/src/test/resources/**
!obp-api/src/test/resources/frozen_type_meta_data
*.iml

View File

@ -149,8 +149,8 @@ Here are the three types:
Type1: If you use `modelSource.json`, please run `APIBuilderModel.scala` main method
```
OBP-API/src/main/scala/code/api/APIBuilder/APIModelSource.json
OBP-API/src/main/scala/code/api/APIBuilder/APIBuilderModel.scala
/OBP-API/obp-api/src/main/resources/apiBuilder/APIModelSource.json
/OBP-API/obp-api/src/main/scala/code/api/APIBuilder/APIBuilderModel.scala
```
Type2: If you use `apisResource.json`, please run `APIBuilder.scala` main method
```

View File

@ -265,7 +265,7 @@ object APIBuilderModel
println("Congratulations! You make the new APIs. Please restart OBP-API server!")
}
val jsonJValueFromFile: JValue = APIUtil.getJValueFromFile("src/main/scala/code/api/APIBuilder/APIModelSource.json")
val jsonJValueFromFile: JValue = APIUtil.APIModelSourceJValue
//"/templates"
val apiUrl= getApiUrl(jsonJValueFromFile)

View File

@ -2756,5 +2756,16 @@ Returns a string showed to the developer
user.hasOwnerViewAccess(BankIdAccountId(bankId, accountId)) || // TODO Use an action instead of the owner view
AccountHolders.accountHolders.vend.getAccountHolders(bankId, accountId).exists(_.userId == user.userId)
}
val APIModelSourceJValue = {
val stream = getClass().getClassLoader().getResourceAsStream("apiBuilder/APIModelSource.json")
try {
val bufferedSource = scala.io.Source.fromInputStream(stream, "utf-8")
val jsonStringFromFile = bufferedSource.mkString
json.parse(jsonStringFromFile);
} finally {
stream.close()
}
}
}