001/*
002 * The Kuali Financial System, a comprehensive financial management system for higher education.
003 * 
004 * Copyright 2005-2014 The Kuali Foundation
005 * 
006 * This program is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU Affero General Public License as
008 * published by the Free Software Foundation, either version 3 of the
009 * License, or (at your option) any later version.
010 * 
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU Affero General Public License for more details.
015 * 
016 * You should have received a copy of the GNU Affero General Public License
017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package org.kuali.kfs.vnd.fixture;
020
021import org.kuali.kfs.vnd.businessobject.CommodityCode;
022import org.kuali.kfs.vnd.businessobject.VendorCommodityCode;
023
024public enum VendorCommodityCodeFixture {
025
026    DEFAULT_VENDOR_COMMODITY_CODE_ACTIVE (1000, 0, true, true, CommodityCodeFixture.COMMODITY_CODE_BASIC_ACTIVE_2),;
027
028    private Integer vendorHeaderGeneratedIdentifier;
029    private Integer vendorDetailAssignedIdentifier;
030    private boolean commodityDefaultIndicator;
031    private boolean active;
032
033    private CommodityCodeFixture commodityCodeFixture;
034    private VendorCommodityCodeFixture(Integer vendorHeaderGeneratedIdentifier, Integer vendorDetailAssignedIdentifier, boolean commodityDefaultIndicator, boolean active, CommodityCodeFixture commodityCodeFixture) {
035        this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
036        this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
037        this.commodityDefaultIndicator = commodityDefaultIndicator;
038        this.active = active;
039        this.commodityCodeFixture = commodityCodeFixture;
040    }
041
042    public VendorCommodityCode createVendorCommodityCode() {
043        VendorCommodityCode vcc = new VendorCommodityCode();
044        vcc.setVendorHeaderGeneratedIdentifier(this.vendorHeaderGeneratedIdentifier);
045        vcc.setVendorDetailAssignedIdentifier(this.vendorDetailAssignedIdentifier);
046        vcc.setCommodityDefaultIndicator(this.commodityDefaultIndicator);
047        vcc.setActive(this.active);
048        if (commodityCodeFixture != null) {
049            CommodityCode cc = commodityCodeFixture.createCommodityCode();
050            vcc.setCommodityCode(cc);
051            vcc.setPurchasingCommodityCode(cc.getPurchasingCommodityCode());
052        }
053        return vcc;
054    }
055
056}