001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016
017package com.echothree.control.user.purchase.server;
018
019import com.echothree.control.user.purchase.common.PurchaseRemote;
020import com.echothree.control.user.purchase.common.form.*;
021import com.echothree.control.user.purchase.server.command.*;
022import com.echothree.model.data.user.common.pk.UserVisitPK;
023import com.echothree.util.common.command.CommandResult;
024import javax.ejb.Stateless;
025
026@Stateless
027public class PurchaseBean
028        extends PurchaseFormsImpl
029        implements PurchaseRemote, PurchaseLocal {
030    
031    // -------------------------------------------------------------------------
032    //   Testing
033    // -------------------------------------------------------------------------
034    
035    @Override
036    public String ping() {
037        return "PurchaseBean is alive!";
038    }
039
040    // --------------------------------------------------------------------------------
041    //   Purchase Orders
042    // --------------------------------------------------------------------------------
043
044    @Override
045    public CommandResult createPurchaseOrder(UserVisitPK userVisitPK, CreatePurchaseOrderForm form) {
046        return new CreatePurchaseOrderCommand(userVisitPK, form).run();
047    }
048
049    @Override
050    public CommandResult getPurchaseOrderStatusChoices(UserVisitPK userVisitPK, GetPurchaseOrderStatusChoicesForm form) {
051        return new GetPurchaseOrderStatusChoicesCommand(userVisitPK, form).run();
052    }
053
054    @Override
055    public CommandResult setPurchaseOrderStatus(UserVisitPK userVisitPK, SetPurchaseOrderStatusForm form) {
056        return new SetPurchaseOrderStatusCommand(userVisitPK, form).run();
057    }
058
059    // --------------------------------------------------------------------------------
060    //   Purchase Invoices
061    // --------------------------------------------------------------------------------
062
063    @Override
064    public CommandResult createPurchaseInvoice(UserVisitPK userVisitPK, CreatePurchaseInvoiceForm form) {
065        return new CreatePurchaseInvoiceCommand(userVisitPK, form).run();
066    }
067
068    @Override
069    public CommandResult getPurchaseInvoiceStatusChoices(UserVisitPK userVisitPK, GetPurchaseInvoiceStatusChoicesForm form) {
070        return new GetPurchaseInvoiceStatusChoicesCommand(userVisitPK, form).run();
071    }
072
073    @Override
074    public CommandResult setPurchaseInvoiceStatus(UserVisitPK userVisitPK, SetPurchaseInvoiceStatusForm form) {
075        return new SetPurchaseInvoiceStatusCommand(userVisitPK, form).run();
076    }
077
078    // --------------------------------------------------------------------------------
079    //   Purchase Invoice Lines
080    // --------------------------------------------------------------------------------
081    
082    @Override
083    public CommandResult createPurchaseInvoiceLine(UserVisitPK userVisitPK, CreatePurchaseInvoiceLineForm form) {
084        return new CreatePurchaseInvoiceLineCommand(userVisitPK, form).run();
085    }
086
087}