All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.webcohesion.ofx4j.domain.data.investment.statements.InvestmentStatementResponseMessageSet Maven / Gradle / Ivy

Go to download

OFX4J is a Java implementation of Open Financial Exchange, which defines web service APIs for interfacing with financial institutions.

The newest version!
/*
 * Copyright 2010 Web Cohesion
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.webcohesion.ofx4j.domain.data.investment.statements;

import com.webcohesion.ofx4j.domain.data.MessageSetType;
import com.webcohesion.ofx4j.domain.data.ResponseMessage;
import com.webcohesion.ofx4j.domain.data.ResponseMessageSet;
import com.webcohesion.ofx4j.meta.Aggregate;
import com.webcohesion.ofx4j.meta.ChildAggregate;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Investment statement response message set.
 * @see "Section 13.7.1.2.2, OFX Spec"
 *
 * @author Jon Perlow
 */
@Aggregate( "INVSTMTMSGSRSV1" )
public class InvestmentStatementResponseMessageSet extends ResponseMessageSet {

  private List statementResponses;

  public MessageSetType getType() {
    return MessageSetType.investment;
  }

  /**
   * Gets the statement response list. Most OFX files have a single statement response.
   *
   * @return the statement response list
   */
  @ChildAggregate( order = 0 )
  public List getStatementResponses() {
    return statementResponses;
  }


  /**
   * Sets the statement reponse list. Most OFX files have a single statement response.
   *
   * @param statementResponses the statement response list
   */
  public void setStatementResponses(
      List statementResponses) {
    this.statementResponses = statementResponses;
  }


  /**
   * Gets the first statement response. Use getStatementResponses() if you are expecting multiple
   * responses.
   *
   * @return the first investment statement response.
   */
  public InvestmentStatementResponseTransaction getStatementResponse() {
    return statementResponses == null || statementResponses.isEmpty() ? null : statementResponses.get(0);
  }

  /**
   * Sets the statement response if there is a single response.
   *
   * @param statementResponse The statement response.
   */
  public void setStatementResponse(InvestmentStatementResponseTransaction statementResponse) {
    this.statementResponses = Collections.singletonList(statementResponse);
  }

  // Inherited.
  public List getResponseMessages() {
    return new ArrayList(statementResponses);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy