/* * @(#)CreateRefundInvoiceActivityInformation.java * * Copyright 2009 Instituto Superior Tecnico * Founding Authors: Luis Cruz, Nuno Ochoa, Paulo Abrantes * * https://fenix-ashes.ist.utl.pt/ * * This file is part of the Expenditure Tracking Module. * * The Expenditure Tracking Module is free software: you can * redistribute it and/or modify it under the terms of the GNU Lesser General * Public License as published by the Free Software Foundation, either version * 3 of the License, or (at your option) any later version. * * The Expenditure Tracking Module is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the Expenditure Tracking Module. If not, see <http://www.gnu.org/licenses/>. * */ package pt.ist.expenditureTrackingSystem.domain.acquisitions.refund.activities; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import module.finance.util.Money; import module.workflow.activities.ActivityInformation; import module.workflow.activities.WorkflowActivity; import module.workflow.domain.WorkflowProcess; import org.joda.time.LocalDate; import pt.ist.expenditureTrackingSystem.domain.acquisitions.refund.RefundItem; import pt.ist.expenditureTrackingSystem.domain.acquisitions.refund.RefundProcess; import pt.ist.expenditureTrackingSystem.domain.organization.Supplier; import com.google.common.io.ByteStreams; /** * * @author Paulo Abrantes * */ public class CreateRefundInvoiceActivityInformation extends ActivityInformation<RefundProcess> { private String invoiceNumber; private LocalDate invoiceDate; private Money value; private BigDecimal vatValue; private Money refundableValue; private RefundItem item; private Supplier supplier; private transient InputStream inputStream; private String filename; private String displayName; private byte[] bytes; public InputStream getInputStream() { return inputStream; } public void setInputStream(InputStream inputStream) { this.inputStream = inputStream; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public byte[] getBytes() { if (bytes == null) { try { bytes = ByteStreams.toByteArray(getInputStream()); } catch (final IOException e) { throw new Error(e); } } return bytes; } public CreateRefundInvoiceActivityInformation(RefundProcess process, WorkflowActivity<? extends WorkflowProcess, ? extends ActivityInformation> activity) { super(process, activity); bytes = null; } public String getInvoiceNumber() { return invoiceNumber; } public void setInvoiceNumber(String invoiceNumber) { this.invoiceNumber = invoiceNumber; } public LocalDate getInvoiceDate() { return invoiceDate; } public void setInvoiceDate(LocalDate invoiceDate) { this.invoiceDate = invoiceDate; } public Money getValue() { return value; } public void setValue(Money value) { this.value = value; } public BigDecimal getVatValue() { return vatValue; } public void setVatValue(BigDecimal vatValue) { this.vatValue = vatValue; } public Money getRefundableValue() { return refundableValue; } public void setRefundableValue(Money refundableValue) { this.refundableValue = refundableValue; } public RefundItem getItem() { return item; } public void setItem(RefundItem item) { this.item = item; } public Supplier getSupplier() { return supplier; } public void setSupplier(Supplier supplier) { this.supplier = supplier; } @Override public boolean hasAllneededInfo() { return isForwardedFromInput() && getInvoiceDate() != null && getInvoiceNumber() != null && getValue() != null && getVatValue() != null && getRefundableValue() != null && getItem() != null && getSupplier() != null && getInputStream() != null; } }