Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Store-Producer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mahesh Rohra
Store-Producer
Commits
2356d4c0
Commit
2356d4c0
authored
May 05, 2020
by
Mahesh Rohra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read data from PostgreSQL database
parent
4bd17d0e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
152 additions
and
1 deletion
+152
-1
build.gradle
build.gradle
+1
-0
TransactionController.java
...ava/com/safeway/epe/controller/TransactionController.java
+30
-0
TransactionRecorder.java
...main/java/com/safeway/epe/domain/TransactionRecorder.java
+48
-0
TransactionRepository.java
...ava/com/safeway/epe/repository/TransactionRepository.java
+14
-0
TransactionService.java
...main/java/com/safeway/epe/service/TransactionService.java
+13
-0
TransactionServiceImpl.java
.../java/com/safeway/epe/service/TransactionServiceImpl.java
+31
-0
application.properties
src/main/resources/application.properties
+0
-1
application.yml
src/main/resources/application.yml
+15
-0
No files found.
build.gradle
View file @
2356d4c0
...
@@ -29,6 +29,7 @@ dependencies {
...
@@ -29,6 +29,7 @@ dependencies {
developmentOnly
'org.springframework.boot:spring-boot-devtools'
developmentOnly
'org.springframework.boot:spring-boot-devtools'
runtimeOnly
'org.postgresql:postgresql'
runtimeOnly
'org.postgresql:postgresql'
annotationProcessor
'org.projectlombok:lombok'
annotationProcessor
'org.projectlombok:lombok'
compile
'com.vladmihalcea:hibernate-types-52:2.0.0'
testImplementation
(
'org.springframework.boot:spring-boot-starter-test'
)
{
testImplementation
(
'org.springframework.boot:spring-boot-starter-test'
)
{
exclude
group:
'org.junit.vintage'
,
module:
'junit-vintage-engine'
exclude
group:
'org.junit.vintage'
,
module:
'junit-vintage-engine'
}
}
...
...
src/main/java/com/safeway/epe/controller/TransactionController.java
0 → 100644
View file @
2356d4c0
package
com
.
safeway
.
epe
.
controller
;
import
com.safeway.epe.domain.TransactionRecorder
;
import
com.safeway.epe.service.TransactionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
public
class
TransactionController
{
@Autowired
private
TransactionService
service
;
/*@GetMapping("transactions")
public ResponseEntity<List<TransactionController>> getAllTransactions()
{
return service.getAllTransactions();
}*/
@GetMapping
(
"transaction/{uuid}"
)
public
ResponseEntity
<
TransactionRecorder
>
getTransaction
(
@PathVariable
(
"uuid"
)
String
uuid
)
{
return
service
.
getTransactionById
(
uuid
);
}
}
src/main/java/com/safeway/epe/domain/TransactionRecorder.java
0 → 100644
View file @
2356d4c0
package
com
.
safeway
.
epe
.
domain
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.vladmihalcea.hibernate.type.json.JsonBinaryType
;
import
lombok.AccessLevel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.FieldDefaults
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.TypeDef
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.UUID
;
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Entity
@Table
(
name
=
"transaction_recorder"
)
@TypeDef
(
name
=
"jsonb"
,
typeClass
=
JsonBinaryType
.
class
)
public
class
TransactionRecorder
{
@Id
@Column
(
name
=
"uuid"
)
@JsonProperty
(
"uuid"
)
UUID
uuid
;
@Type
(
type
=
"jsonb"
)
@JsonProperty
(
"offertransactionresponse"
)
@Column
(
name
=
"offertransactionresponse"
)
String
offerTransactionResponse
;
@Type
(
type
=
"jsonb"
)
@JsonProperty
(
"offers"
)
@Column
(
name
=
"offers"
)
String
offers
;
@Column
(
name
=
"isprocessed"
)
boolean
isProcessed
;
}
src/main/java/com/safeway/epe/repository/TransactionRepository.java
0 → 100644
View file @
2356d4c0
package
com
.
safeway
.
epe
.
repository
;
import
com.safeway.epe.domain.TransactionRecorder
;
import
com.safeway.epe.service.TransactionService
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.UUID
;
@Repository
public
interface
TransactionRepository
extends
CrudRepository
<
TransactionRecorder
,
UUID
>
{
}
src/main/java/com/safeway/epe/service/TransactionService.java
0 → 100644
View file @
2356d4c0
package
com
.
safeway
.
epe
.
service
;
import
com.safeway.epe.controller.TransactionController
;
import
com.safeway.epe.domain.TransactionRecorder
;
import
org.springframework.http.ResponseEntity
;
import
java.util.List
;
public
interface
TransactionService
{
//ResponseEntity<List<TransactionController>> getAllTransactions();
ResponseEntity
<
TransactionRecorder
>
getTransactionById
(
String
uuid
);
}
src/main/java/com/safeway/epe/service/TransactionServiceImpl.java
0 → 100644
View file @
2356d4c0
package
com
.
safeway
.
epe
.
service
;
import
com.safeway.epe.controller.TransactionController
;
import
com.safeway.epe.domain.TransactionRecorder
;
import
com.safeway.epe.repository.TransactionRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
public
class
TransactionServiceImpl
implements
TransactionService
{
@Autowired
TransactionRepository
repository
;
/*@Override
public ResponseEntity<List<TransactionController>> getAllTransactions() {
List<TransactionRecorder> transactions = new ArrayList<TransactionRecorder>();
repository.findAll().forEach(transactions::add);
return new ResponseEntity<List<TransactionController>>(HttpStatus.OK);
}*/
@Override
public
ResponseEntity
<
TransactionRecorder
>
getTransactionById
(
String
uuid
)
{
Optional
<
TransactionRecorder
>
optionalTransaction
=
repository
.
findById
(
UUID
.
fromString
(
uuid
));
return
ResponseEntity
.
status
(
HttpStatus
.
FOUND
).
body
(
optionalTransaction
.
get
());
}
}
src/main/resources/application.properties
deleted
100644 → 0
View file @
4bd17d0e
src/main/resources/application.yml
0 → 100644
View file @
2356d4c0
spring
:
application
:
name
:
store-producer
datasource
:
url
:
jdbc:postgresql://127.0.0.1:5432/epe
username
:
postgres
password
:
welcome
driver-class-name
:
org.postgresql.Driver
jpa
:
show-sql
:
true
properties
:
hibernate
:
dialect
:
org.hibernate.dialect.PostgreSQLDialect
server
:
port
:
8200
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment