This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be8d013
commit c326204
Showing
16 changed files
with
565 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...ain/java/net/unir/missi/desarrollowebfullstack/bookabook/operador/config/FeignConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.config; | ||
|
||
import org.springframework.cloud.openfeign.EnableFeignClients; | ||
import feign.Logger; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class FeignConfig { | ||
|
||
@Bean | ||
Logger.Level feingLoggerLevel(){ return Logger.Level.FULL; } | ||
} |
18 changes: 18 additions & 0 deletions
18
...main/java/net/unir/missi/desarrollowebfullstack/bookabook/operador/config/LoanMerger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.config; | ||
|
||
import net.unir.missi.desarrollowebfullstack.bookabook.operador.model.sql.Loan; | ||
import org.springframework.context.annotation.Configuration; | ||
@Configuration | ||
public class LoanMerger { | ||
public Loan merge(Loan destiny, Loan source) | ||
{ | ||
destiny.setBookId(source.getBookId()); | ||
destiny.setClientId(source.getClientId()); | ||
destiny.setDueDate(source.getDueDate()); | ||
destiny.setLoanDate(source.getLoanDate()); | ||
destiny.setIsReturned(source.getIsReturned()); | ||
destiny.setRenewalCount(source.getRenewalCount()); | ||
destiny.setReturnDate(source.getReturnDate()); | ||
return destiny; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...a/net/unir/missi/desarrollowebfullstack/bookabook/operador/config/LoanMergerNonEmpty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.config; | ||
|
||
import net.unir.missi.desarrollowebfullstack.bookabook.operador.model.sql.Loan; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class LoanMergerNonEmpty { | ||
public Loan merge(Loan destiny, Loan source) | ||
{ | ||
if (source.getBookId() != null && source.getBookId() != 0) | ||
{ | ||
destiny.setBookId(source.getBookId()); | ||
} | ||
|
||
if (source.getClientId() != null && source.getClientId() != 0) | ||
{ | ||
destiny.setClientId(source.getClientId()); | ||
} | ||
|
||
if (source.getDueDate() != null) | ||
{ | ||
destiny.setDueDate(source.getDueDate()); | ||
} | ||
|
||
if (source.getLoanDate() != null) | ||
{ | ||
destiny.setLoanDate(source.getLoanDate()); | ||
} | ||
|
||
if (source.getIsReturned() != null) | ||
{ | ||
destiny.setIsReturned(source.getIsReturned()); | ||
} | ||
|
||
if (source.getRenewalCount() != null) | ||
{ | ||
destiny.setRenewalCount(source.getRenewalCount()); | ||
} | ||
|
||
if (source.getReturnDate() != null) | ||
{ | ||
destiny.setReturnDate(source.getReturnDate()); | ||
} | ||
return destiny; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ir/missi/desarrollowebfullstack/bookabook/operador/config/LoanRequestToLoanConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.config; | ||
|
||
import net.unir.missi.desarrollowebfullstack.bookabook.operador.model.api.LoanRequest; | ||
import net.unir.missi.desarrollowebfullstack.bookabook.operador.model.sql.Loan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
@Configuration | ||
public class LoanRequestToLoanConverter implements Converter<LoanRequest, Loan> { | ||
@Override | ||
public Loan convert(LoanRequest source) { | ||
return Loan.builder() | ||
.bookId(source.getBookId()) | ||
.clientId(source.getClientId()) | ||
.loanDate(source.getLoanDate()) | ||
.dueDate(source.getDueDate()) | ||
.returnDate(source.getReturnDate()) | ||
.isReturned(source.getIsReturned()) | ||
.renewalCount(source.getRenewalCount()) | ||
.build(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...r/missi/desarrollowebfullstack/bookabook/operador/config/LoanToLoanResponseConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.config; | ||
|
||
import net.unir.missi.desarrollowebfullstack.bookabook.operador.model.api.LoanResponse; | ||
import net.unir.missi.desarrollowebfullstack.bookabook.operador.model.sql.Loan; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
@Configuration | ||
public class LoanToLoanResponseConverter implements Converter<Loan, LoanResponse> { | ||
@Override | ||
public LoanResponse convert(Loan source) { | ||
return LoanResponse.builder() | ||
.id(source.getId()) | ||
.bookId(source.getBookId()) | ||
.clientId(source.getClientId()) | ||
.loanDate(source.getLoanDate()) | ||
.dueDate(source.getDueDate()) | ||
.returnDate(source.getReturnDate()) | ||
.isReturned(source.getIsReturned()) | ||
.renewalCount(source.getRenewalCount()) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...ir/missi/desarrollowebfullstack/bookabook/operador/exceptions/BadParametersException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.exceptions; | ||
|
||
public class BadParametersException extends RuntimeException{ | ||
public BadParametersException(String errorMessage, Throwable err) | ||
{ | ||
super(errorMessage, err); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...r/missi/desarrollowebfullstack/bookabook/operador/exceptions/EntityNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package net.unir.missi.desarrollowebfullstack.bookabook.operador.exceptions; | ||
|
||
public class EntityNotFoundException extends RuntimeException{ | ||
public EntityNotFoundException(String errorMessage, Throwable err) | ||
{ | ||
super(errorMessage, err); | ||
} | ||
} |
Oops, something went wrong.