Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * ************************************************************************
- * Copyright (C) Wolters Kluwer Financial Services. All rights reserved.
- *
- * This computer program is protected by copyright law and international
- * treaties. Unauthorized reproduction or distribution of this program,
- * or any portion of it, may result in severe civil and criminal penalties,
- * and will be prosecuted to the maximum extent possible under the law.
- * ************************************************************************
- */
- package com.wolterskluwer.reg.reporting.datasets.model;
- import java.time.LocalDate;
- import java.util.Objects;
- public class DataSetBO {
- private final Long id;
- private final String dataSetName;
- private final DataSetType dataSetType;
- private final Long dataLot;
- private final LocalDate referenceDate;
- private final Long inputDataReference;
- private final int assignedSubmissions;
- private final int allocatedSubmissions;
- private DataSetBO(final DataSetBOBuilder dataSetBOBuilder) {
- this.id = dataSetBOBuilder.id;
- this.dataSetName = dataSetBOBuilder.dataSetName;
- this.dataSetType = dataSetBOBuilder.dataSetType;
- this.dataLot = dataSetBOBuilder.dataLot;
- this.referenceDate = dataSetBOBuilder.referenceDate;
- this.inputDataReference = dataSetBOBuilder.inputDataReference;
- this.assignedSubmissions = dataSetBOBuilder.assignedSubmissions;
- this.allocatedSubmissions = dataSetBOBuilder.allocatedSubmissions;
- }
- public Long getId() {
- return this.id;
- }
- public String getDataSetName() {
- return this.dataSetName;
- }
- public DataSetType getDataSetType() {
- return this.dataSetType;
- }
- public Long getDataLot() {
- return this.dataLot;
- }
- public LocalDate getReferenceDate() {
- return this.referenceDate;
- }
- public Long getInputDataReference() {
- return this.inputDataReference;
- }
- public int getAssignedSubmissions() {
- return this.assignedSubmissions;
- }
- public int getAllocatedSubmissions() {
- return this.allocatedSubmissions;
- }
- public DataSetBOBuilder toBuilder() {
- return new DataSetBOBuilder().withId(this.id)
- .withDataSetName(this.dataSetName)
- .withDataSetType(this.dataSetType)
- .withDataLot(this.dataLot)
- .withReferenceDate(this.referenceDate)
- .withInputDataReference(this.inputDataReference)
- .withAssignedSubmissions(this.assignedSubmissions)
- .withAllocatedSubmissions(this.allocatedSubmissions);
- }
- public static final class DataSetBOBuilder {
- private String dataSetName;
- private Long id;
- private DataSetType dataSetType;
- private Long dataLot;
- private LocalDate referenceDate;
- private Long inputDataReference;
- private int assignedSubmissions;
- private int allocatedSubmissions;
- public DataSetBOBuilder withDataSetName(final String dataSetName) {
- this.dataSetName = dataSetName;
- return this;
- }
- public DataSetBOBuilder withId(final Long id) {
- this.id = id;
- return this;
- }
- public DataSetBOBuilder withDataSetType(final String dataSetType) {
- this.dataSetType = DataSetType.valueOf(dataSetType.toUpperCase());
- return this;
- }
- public DataSetBOBuilder withDataSetType(final DataSetType dataSetType) {
- this.dataSetType = dataSetType;
- return this;
- }
- public DataSetBOBuilder withDataLot(final Long dataLot) {
- this.dataLot = dataLot;
- return this;
- }
- public DataSetBOBuilder withReferenceDate(final LocalDate referenceDate) {
- this.referenceDate = referenceDate;
- return this;
- }
- public DataSetBOBuilder withInputDataReference(final Long inputDataReference) {
- this.inputDataReference = inputDataReference;
- return this;
- }
- public DataSetBOBuilder withAssignedSubmissions(final int assignedSubmissions) {
- this.assignedSubmissions = assignedSubmissions;
- return this;
- }
- public DataSetBOBuilder withAllocatedSubmissions(final int allocatedSubmissions) {
- this.allocatedSubmissions = allocatedSubmissions;
- return this;
- }
- public DataSetBO build() {
- if (Objects.isNull(this.dataSetType)) {
- this.dataSetType = Objects.isNull(this.inputDataReference) ? DataSetType.INPUT : DataSetType.ENRICHED;
- }
- return new DataSetBO(this);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement