Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.commons.lang.StringUtils;
- import java.io.Serializable;
- import java.sql.SQLData;
- import java.sql.SQLException;
- import java.sql.SQLInput;
- import java.sql.SQLOutput;
- public class PositionEntryItem implements Serializable, SQLData {
- private static final long serialVersionUID = -773499731171578088L;
- private Integer numberRow;
- private String code;
- private Integer id;
- private String clientCode;
- private String vendorCode;
- private String etmCode;
- private String selectedUomCode;
- private int quantity = 1;
- private boolean hasError;
- private String errorMsg;
- public Integer getId() {
- return id;
- }
- public void setId(final Integer id) {
- this.id = id;
- }
- public boolean isHasError() {
- return hasError;
- }
- public void setHasError(final boolean hasError) {
- this.hasError = hasError;
- }
- public String getErrorMsg() {
- return errorMsg;
- }
- public void setErrorMsg(final String errorMsg) {
- this.errorMsg = errorMsg;
- }
- public Integer getNumberRow() {
- return numberRow;
- }
- public void setNumberRow(final Integer numberRow) {
- this.numberRow = numberRow;
- }
- public String getCode() {
- return code;
- }
- public void setCode(final String code) {
- this.code = code;
- }
- public String getClientCode() {
- return clientCode;
- }
- public void setClientCode(final String clientCode) {
- this.clientCode = clientCode;
- }
- public String getVendorCode() {
- return vendorCode;
- }
- public void setVendorCode(final String vendorCode) {
- this.vendorCode = vendorCode;
- }
- public String getEtmCode() {
- return etmCode;
- }
- public void setEtmCode(final String etmCode) {
- this.etmCode = etmCode;
- }
- public String getSelectedUomCode() {
- return selectedUomCode;
- }
- public void setSelectedUomCode(final String selectedUomCode) {
- this.selectedUomCode = selectedUomCode;
- }
- public int getQuantity() {
- return quantity;
- }
- public void setQuantity(final int quantity) {
- if (quantity <= 0) {
- this.quantity = 1;
- } else {
- this.quantity = quantity;
- }
- }
- @Override
- public String toString() {
- return "PositionEntryItem{" +
- "numberRow=" + numberRow +
- ", code='" + code + '\'' +
- ", id=" + id +
- ", clientCode='" + clientCode + '\'' +
- ", vendorCode='" + vendorCode + '\'' +
- ", etmCode='" + etmCode + '\'' +
- ", selectedUomCode='" + selectedUomCode + '\'' +
- ", quantity=" + quantity +
- ", hasError=" + hasError +
- ", errorMsg='" + errorMsg + '\'' +
- '}';
- }
- @Override
- public String getSQLTypeName() throws SQLException {
- return "XXRSV_PE_ITEM_REC";
- }
- @Override
- public void readSQL(final SQLInput stream, final String typeName) throws SQLException {
- this.numberRow = stream.readInt();
- this.code = stream.readString();
- this.clientCode = stream.readString();
- this.vendorCode = stream.readString();
- this.etmCode = stream.readString();
- this.selectedUomCode = stream.readString();
- this.quantity = stream.readInt();
- }
- @Override
- public void writeSQL(final SQLOutput stream) throws SQLException {
- stream.writeInt(this.numberRow);
- stream.writeString(this.code);
- stream.writeString(this.clientCode);
- stream.writeString(this.vendorCode);
- stream.writeString(validateEtmCode(this.etmCode));
- stream.writeString(this.selectedUomCode);
- stream.writeInt(this.quantity);
- }
- private String validateEtmCode(final String value) {
- if (StringUtils.isNotEmpty(value)) {
- return etmCode.replaceAll("[^\\p{Digit}]", "").trim();
- }
- return value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement