ADD - models with Builder method
This commit is contained in:
parent
7bbab8dbfa
commit
e1dda84360
@ -1,5 +1,6 @@
|
||||
package com.banesco;
|
||||
|
||||
import com.banesco.domain.model.BackResponse;
|
||||
import com.banesco.util.StringUtil;
|
||||
|
||||
|
||||
@ -10,7 +11,17 @@ import com.banesco.util.StringUtil;
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
boolean value = StringUtil.isNumeric("45");
|
||||
boolean value = StringUtil.isNumeric("45");
|
||||
System.out.println(value);
|
||||
|
||||
BackResponse backResponse = BackResponse.builder()
|
||||
.backendCode("200")
|
||||
.httpCode("420")
|
||||
.statusCode("420")
|
||||
.description("asdasd")
|
||||
.build();
|
||||
|
||||
System.out.println(backResponse);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
80
src/main/java/com/banesco/domain/model/BackResponse.java
Normal file
80
src/main/java/com/banesco/domain/model/BackResponse.java
Normal file
@ -0,0 +1,80 @@
|
||||
package com.banesco.domain.model;
|
||||
|
||||
public class BackResponse {
|
||||
private final String backendCode;
|
||||
private final String httpCode;
|
||||
private final String statusCode;
|
||||
private final String description;
|
||||
|
||||
private BackResponse(Builder builder) {
|
||||
this.backendCode = builder.backendCode;
|
||||
this.httpCode = builder.httpCode;
|
||||
this.statusCode = builder.statusCode;
|
||||
this.description = builder.description;
|
||||
}
|
||||
|
||||
public String getBackendCode() {
|
||||
return backendCode;
|
||||
}
|
||||
|
||||
public String getHttpCode() {
|
||||
return httpCode;
|
||||
}
|
||||
|
||||
public String getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String backendCode;
|
||||
private String httpCode;
|
||||
private String statusCode;
|
||||
private String description;
|
||||
|
||||
public Builder() {}
|
||||
|
||||
public Builder backendCode(String backendCode) {
|
||||
this.backendCode = backendCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder httpCode(String httpCode) {
|
||||
this.httpCode = httpCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder statusCode(String statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BackResponse build() {
|
||||
// Validaciones de ser necesario
|
||||
// if (attr == null || attr.isEmpty()) {
|
||||
// throw new IllegalStateException("El atributo1 no puede estar vacío");
|
||||
// }
|
||||
return new BackResponse(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BackResponse [backendCode=" + backendCode + ", httpCode=" + httpCode + ", statusCode=" + statusCode
|
||||
+ ", description=" + description + "]";
|
||||
}
|
||||
|
||||
}
|
||||
53
src/main/java/com/banesco/domain/model/BaseResponse.java
Normal file
53
src/main/java/com/banesco/domain/model/BaseResponse.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.banesco.domain.model;
|
||||
|
||||
public class BaseResponse<T> {
|
||||
private final StatusResponse statusCode;
|
||||
private final T dataResponse;
|
||||
|
||||
private BaseResponse(Builder<T> builder) {
|
||||
this.statusCode = builder.statusCode;
|
||||
this.dataResponse = builder.dataResponse;
|
||||
}
|
||||
|
||||
public StatusResponse getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public T getDataResponse() {
|
||||
return dataResponse;
|
||||
}
|
||||
|
||||
public static class Builder<T> {
|
||||
private StatusResponse statusCode;
|
||||
private T dataResponse;
|
||||
|
||||
public Builder() {}
|
||||
|
||||
public Builder<T> statusCode(StatusResponse statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder<T> dataResponse(T dataResponse) {
|
||||
this.dataResponse = dataResponse;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseResponse<T> build() {
|
||||
// Validaciones de ser necesario
|
||||
// if (attr == null || attr.isEmpty()) {
|
||||
// throw new IllegalStateException("El atributo1 no puede estar vacío");
|
||||
// }
|
||||
return new BaseResponse<>(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> Builder<T> builder() {
|
||||
return new Builder<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BaseResponse [statusCode=" + statusCode + ", dataResponse=" + dataResponse + "]";
|
||||
}
|
||||
}
|
||||
73
src/main/java/com/banesco/domain/model/Device.java
Normal file
73
src/main/java/com/banesco/domain/model/Device.java
Normal file
@ -0,0 +1,73 @@
|
||||
package com.banesco.domain.model;
|
||||
|
||||
|
||||
public class Device {
|
||||
private final String type;
|
||||
private final Integer description;
|
||||
private final String ipAddress;
|
||||
|
||||
private Device(Builder builder) {
|
||||
this.type = builder.type;
|
||||
this.description = builder.description;
|
||||
this.ipAddress = builder.ipAddress;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Integer getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return ipAddress;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String type;
|
||||
private Integer description;
|
||||
private String ipAddress;
|
||||
|
||||
public Builder() {}
|
||||
|
||||
public Builder type(String type) {
|
||||
this.type = type;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder description(Integer description) {
|
||||
this.description = description;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder ipAddress(String ipAddress) {
|
||||
this.ipAddress = ipAddress;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Device build() {
|
||||
// Validaciones de ser necesario
|
||||
// if (attr == null || attr.isEmpty()) {
|
||||
// throw new IllegalStateException("El atributo1 no puede estar vacío");
|
||||
// }
|
||||
return new Device(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Device{");
|
||||
sb.append("type=").append(type);
|
||||
sb.append(", description=").append(description);
|
||||
sb.append(", ipAddress=").append(ipAddress);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
250
src/main/java/com/banesco/domain/model/RegisterSecurityRq.java
Normal file
250
src/main/java/com/banesco/domain/model/RegisterSecurityRq.java
Normal file
@ -0,0 +1,250 @@
|
||||
package com.banesco.domain.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class RegisterSecurityRq {
|
||||
private final String codBan;
|
||||
private final String codMon;
|
||||
private final String codEve;
|
||||
private final String codEve2;
|
||||
private final String login;
|
||||
private final Date fecHor;
|
||||
private final String nacCli;
|
||||
private final Long cedRifCli;
|
||||
private final String objeto;
|
||||
private final Integer tipoRespuesta;
|
||||
private final String msgRespuesta;
|
||||
private final Integer tiempoRespuesta;
|
||||
private final String codFintech;
|
||||
private final String nombreFintech;
|
||||
private final String tipoDispositivo;
|
||||
private final String desDispositivo;
|
||||
private final String ipCli;
|
||||
private final String sp;
|
||||
|
||||
private RegisterSecurityRq(Builder builder) {
|
||||
this.codBan = builder.codBan;
|
||||
this.codMon = builder.codMon;
|
||||
this.codEve = builder.codEve;
|
||||
this.codEve2 = builder.codEve2;
|
||||
this.login = builder.login;
|
||||
this.fecHor = builder.fecHor;
|
||||
this.nacCli = builder.nacCli;
|
||||
this.cedRifCli = builder.cedRifCli;
|
||||
this.objeto = builder.objeto;
|
||||
this.tipoRespuesta = builder.tipoRespuesta;
|
||||
this.msgRespuesta = builder.msgRespuesta;
|
||||
this.tiempoRespuesta = builder.tiempoRespuesta;
|
||||
this.codFintech = builder.codFintech;
|
||||
this.nombreFintech = builder.nombreFintech;
|
||||
this.tipoDispositivo = builder.tipoDispositivo;
|
||||
this.desDispositivo = builder.desDispositivo;
|
||||
this.ipCli = builder.ipCli;
|
||||
this.sp = builder.sp;
|
||||
}
|
||||
|
||||
public String getCodBan() {
|
||||
return codBan;
|
||||
}
|
||||
|
||||
public String getCodMon() {
|
||||
return codMon;
|
||||
}
|
||||
|
||||
public String getCodEve() {
|
||||
return codEve;
|
||||
}
|
||||
|
||||
public String getCodEve2() {
|
||||
return codEve2;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public Date getFecHor() {
|
||||
return fecHor;
|
||||
}
|
||||
|
||||
public String getNacCli() {
|
||||
return nacCli;
|
||||
}
|
||||
|
||||
public Long getCedRifCli() {
|
||||
return cedRifCli;
|
||||
}
|
||||
|
||||
public String getObjeto() {
|
||||
return objeto;
|
||||
}
|
||||
|
||||
public Integer getTipoRespuesta() {
|
||||
return tipoRespuesta;
|
||||
}
|
||||
|
||||
public String getMsgRespuesta() {
|
||||
return msgRespuesta;
|
||||
}
|
||||
|
||||
public Integer getTiempoRespuesta() {
|
||||
return tiempoRespuesta;
|
||||
}
|
||||
|
||||
public String getCodFintech() {
|
||||
return codFintech;
|
||||
}
|
||||
|
||||
public String getNombreFintech() {
|
||||
return nombreFintech;
|
||||
}
|
||||
|
||||
public String getTipoDispositivo() {
|
||||
return tipoDispositivo;
|
||||
}
|
||||
|
||||
public String getDesDispositivo() {
|
||||
return desDispositivo;
|
||||
}
|
||||
|
||||
public String getIpCli() {
|
||||
return ipCli;
|
||||
}
|
||||
|
||||
public String getSp() {
|
||||
return sp;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String codBan;
|
||||
private String codMon;
|
||||
private String codEve;
|
||||
private String codEve2;
|
||||
private String login;
|
||||
private Date fecHor;
|
||||
private String nacCli;
|
||||
private Long cedRifCli;
|
||||
private String objeto;
|
||||
private Integer tipoRespuesta;
|
||||
private String msgRespuesta;
|
||||
private Integer tiempoRespuesta;
|
||||
private String codFintech;
|
||||
private String nombreFintech;
|
||||
private String tipoDispositivo;
|
||||
private String desDispositivo;
|
||||
private String ipCli;
|
||||
private String sp;
|
||||
|
||||
public Builder() {}
|
||||
|
||||
public Builder codBan(String codBan) {
|
||||
this.codBan = codBan;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder codMon(String codMon) {
|
||||
this.codMon = codMon;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder codEve(String codEve) {
|
||||
this.codEve = codEve;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder codEve2(String codEve2) {
|
||||
this.codEve2 = codEve2;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder login(String login) {
|
||||
this.login = login;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder fecHor(Date fecHor) {
|
||||
this.fecHor = fecHor;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder nacCli(String nacCli) {
|
||||
this.nacCli = nacCli;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder cedRifCli(Long cedRifCli) {
|
||||
this.cedRifCli = cedRifCli;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder objeto(String objeto) {
|
||||
this.objeto = objeto;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder tipoRespuesta(Integer tipoRespuesta) {
|
||||
this.tipoRespuesta = tipoRespuesta;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder msgRespuesta(String msgRespuesta) {
|
||||
this.msgRespuesta = msgRespuesta;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder tiempoRespuesta(Integer tiempoRespuesta) {
|
||||
this.tiempoRespuesta = tiempoRespuesta;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder codFintech(String codFintech) {
|
||||
this.codFintech = codFintech;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder nombreFintech(String nombreFintech) {
|
||||
this.nombreFintech = nombreFintech;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder tipoDispositivo(String tipoDispositivo) {
|
||||
this.tipoDispositivo = tipoDispositivo;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder desDispositivo(String desDispositivo) {
|
||||
this.desDispositivo = desDispositivo;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder ipCli(String ipCli) {
|
||||
this.ipCli = ipCli;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder sp(String sp) {
|
||||
this.sp = sp;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public RegisterSecurityRq build() {
|
||||
// Validaciones de ser necesario
|
||||
// if (attr == null || attr.isEmpty()) {
|
||||
// throw new IllegalStateException("El atributo1 no puede estar vacío");
|
||||
// }
|
||||
return new RegisterSecurityRq(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RegisterSecurityRq [codBan=" + codBan + ", codMon=" + codMon + ", codEve=" + codEve + ", codEve2="
|
||||
+ codEve2 + ", login=" + login + ", fecHor=" + fecHor + ", nacCli=" + nacCli + ", cedRifCli="
|
||||
+ cedRifCli + ", objeto=" + objeto + ", tipoRespuesta=" + tipoRespuesta + ", msgRespuesta="
|
||||
+ msgRespuesta + ", tiempoRespuesta=" + tiempoRespuesta + ", codFintech=" + codFintech
|
||||
+ ", nombreFintech=" + nombreFintech + ", tipoDispositivo=" + tipoDispositivo + ", desDispositivo="
|
||||
+ desDispositivo + ", ipCli=" + ipCli + ", sp=" + sp + "]";
|
||||
}
|
||||
|
||||
}
|
||||
61
src/main/java/com/banesco/domain/model/SecurityAuth.java
Normal file
61
src/main/java/com/banesco/domain/model/SecurityAuth.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.banesco.domain.model;
|
||||
|
||||
|
||||
public class SecurityAuth {
|
||||
private final String sessionId;
|
||||
private final String username;
|
||||
|
||||
private SecurityAuth(Builder builder) {
|
||||
this.sessionId = builder.sessionId;
|
||||
this.username = builder.username;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String sessionId;
|
||||
private String username;
|
||||
|
||||
public Builder() {}
|
||||
|
||||
public Builder sessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder username(String username) {
|
||||
this.username = username;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public SecurityAuth build() {
|
||||
// Validaciones de ser necesario
|
||||
// if (attr == null || attr.isEmpty()) {
|
||||
// throw new IllegalStateException("El atributo1 no puede estar vacío");
|
||||
// }
|
||||
return new SecurityAuth(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SecurityAuth{");
|
||||
sb.append("sessionId=").append(sessionId);
|
||||
sb.append(", username=").append(username);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
48
src/main/java/com/banesco/domain/model/StatusResponse.java
Normal file
48
src/main/java/com/banesco/domain/model/StatusResponse.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.banesco.domain.model;
|
||||
|
||||
|
||||
public class StatusResponse {
|
||||
private final String statusCode;
|
||||
private final String statusDesc;
|
||||
|
||||
private StatusResponse(Builder builder) {
|
||||
this.statusCode = builder.statusCode;
|
||||
this.statusDesc = builder.statusDesc;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String statusCode;
|
||||
private String statusDesc;
|
||||
|
||||
public Builder() {}
|
||||
|
||||
public Builder statusCode(String statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public Builder statusDesc(String statusDesc) {
|
||||
this.statusDesc = statusDesc;
|
||||
return Builder.this;
|
||||
}
|
||||
|
||||
public StatusResponse build() {
|
||||
// Validaciones de ser necesario
|
||||
// if (attr == null || attr.isEmpty()) {
|
||||
// throw new IllegalStateException("El atributo1 no puede estar vacío");
|
||||
// }
|
||||
return new StatusResponse(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StatusResponse [statusCode=" + statusCode + ", statusDesc=" + statusDesc + "]";
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user