org.opentestsystem.authoring.testitembank.apipzip.domain.ApipItemContent.java Source code

Java tutorial

Introduction

Here is the source code for org.opentestsystem.authoring.testitembank.apipzip.domain.ApipItemContent.java

Source

/*******************************************************************************
 * Educational Online Test Delivery System 
 * Copyright (c) 2014 American Institutes for Research
 *   
 * Distributed under the AIR Open Source License, Version 1.0 
 * See accompanying file AIR-License-1_0.txt or at
 * http://www.smarterapp.org/documents/American_Institutes_for_Research_Open_Source_Software_License.pdf
 ******************************************************************************/
package org.opentestsystem.authoring.testitembank.apipzip.domain;

import org.apache.commons.lang.ArrayUtils;
import org.opentestsystem.authoring.testitembank.domain.Item;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
import org.springframework.validation.ObjectError;

/**
 * This is a wrapper object to hold the zip and the Item along with any errors
 * that may accrue during the import process.
 */
public class ApipItemContent {

    private BindException errors = new BindException("", "item");

    private Item item = null;

    private byte[] itemZip = null;

    public Errors getErrors() {
        return errors;
    }

    public final void addError(final String inErrorCode, final String[] inArgs) {
        this.errors.addError(new ObjectError("zip file", new String[] { inErrorCode }, inArgs, ""));
    }

    public final Item getItem() {
        return item;
    }

    public final void setItem(final Item inItem) {
        this.item = inItem;
    }

    public byte[] getItemZip() {
        return ArrayUtils.clone(itemZip);
    }

    public void setItemZip(final byte[] itemZipFile) {
        this.itemZip = ArrayUtils.clone(itemZipFile);
    }

}