001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 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.shipping.server;
018
019import com.echothree.control.user.shipping.common.ShippingRemote;
020import com.echothree.control.user.shipping.common.form.*;
021import com.echothree.control.user.shipping.server.command.*;
022import com.echothree.model.data.user.common.pk.UserVisitPK;
023import com.echothree.util.common.command.CommandResult;
024import javax.ejb.Stateless;
025import javax.enterprise.inject.spi.CDI;
026
027@Stateless
028public class ShippingBean
029        extends ShippingFormsImpl
030        implements ShippingRemote, ShippingLocal {
031    
032    // -------------------------------------------------------------------------
033    //   Testing
034    // -------------------------------------------------------------------------
035    
036    @Override
037    public String ping() {
038        return "ShippingBean is alive!";
039    }
040    
041    // -------------------------------------------------------------------------
042    //   Shipping Methods
043    // -------------------------------------------------------------------------
044    
045    @Override
046    public CommandResult createShippingMethod(UserVisitPK userVisitPK, CreateShippingMethodForm form) {
047        return CDI.current().select(CreateShippingMethodCommand.class).get().run(userVisitPK, form);
048    }
049    
050    @Override
051    public CommandResult getShippingMethod(UserVisitPK userVisitPK, GetShippingMethodForm form) {
052        return CDI.current().select(GetShippingMethodCommand.class).get().run(userVisitPK, form);
053    }
054    
055    @Override
056    public CommandResult getShippingMethods(UserVisitPK userVisitPK, GetShippingMethodsForm form) {
057        return CDI.current().select(GetShippingMethodsCommand.class).get().run(userVisitPK, form);
058    }
059    
060    @Override
061    public CommandResult getShippingMethodChoices(UserVisitPK userVisitPK, GetShippingMethodChoicesForm form) {
062        return CDI.current().select(GetShippingMethodChoicesCommand.class).get().run(userVisitPK, form);
063    }
064    
065    @Override
066    public CommandResult editShippingMethod(UserVisitPK userVisitPK, EditShippingMethodForm form) {
067        return CDI.current().select(EditShippingMethodCommand.class).get().run(userVisitPK, form);
068    }
069    
070    @Override
071    public CommandResult deleteShippingMethod(UserVisitPK userVisitPK, DeleteShippingMethodForm form) {
072        return CDI.current().select(DeleteShippingMethodCommand.class).get().run(userVisitPK, form);
073    }
074    
075    // -------------------------------------------------------------------------
076    //   Shipping Method Descriptions
077    // -------------------------------------------------------------------------
078    
079    @Override
080    public CommandResult createShippingMethodDescription(UserVisitPK userVisitPK, CreateShippingMethodDescriptionForm form) {
081        return CDI.current().select(CreateShippingMethodDescriptionCommand.class).get().run(userVisitPK, form);
082    }
083    
084    @Override
085    public CommandResult getShippingMethodDescription(UserVisitPK userVisitPK, GetShippingMethodDescriptionForm form) {
086        return CDI.current().select(GetShippingMethodDescriptionCommand.class).get().run(userVisitPK, form);
087    }
088
089    @Override
090    public CommandResult getShippingMethodDescriptions(UserVisitPK userVisitPK, GetShippingMethodDescriptionsForm form) {
091        return CDI.current().select(GetShippingMethodDescriptionsCommand.class).get().run(userVisitPK, form);
092    }
093
094    @Override
095    public CommandResult editShippingMethodDescription(UserVisitPK userVisitPK, EditShippingMethodDescriptionForm form) {
096        return CDI.current().select(EditShippingMethodDescriptionCommand.class).get().run(userVisitPK, form);
097    }
098    
099    @Override
100    public CommandResult deleteShippingMethodDescription(UserVisitPK userVisitPK, DeleteShippingMethodDescriptionForm form) {
101        return CDI.current().select(DeleteShippingMethodDescriptionCommand.class).get().run(userVisitPK, form);
102    }
103    
104    // -------------------------------------------------------------------------
105    //   Shipping Method Carrier Services
106    // -------------------------------------------------------------------------
107    
108    @Override
109    public CommandResult createShippingMethodCarrierService(UserVisitPK userVisitPK, CreateShippingMethodCarrierServiceForm form) {
110        return CDI.current().select(CreateShippingMethodCarrierServiceCommand.class).get().run(userVisitPK, form);
111    }
112    
113    @Override
114    public CommandResult getShippingMethodCarrierService(UserVisitPK userVisitPK, GetShippingMethodCarrierServiceForm form) {
115        return CDI.current().select(GetShippingMethodCarrierServiceCommand.class).get().run(userVisitPK, form);
116    }
117
118    @Override
119    public CommandResult getShippingMethodCarrierServices(UserVisitPK userVisitPK, GetShippingMethodCarrierServicesForm form) {
120        return CDI.current().select(GetShippingMethodCarrierServicesCommand.class).get().run(userVisitPK, form);
121    }
122
123    @Override
124    public CommandResult deleteShippingMethodCarrierService(UserVisitPK userVisitPK, DeleteShippingMethodCarrierServiceForm form) {
125        return CDI.current().select(DeleteShippingMethodCarrierServiceCommand.class).get().run(userVisitPK, form);
126    }
127    
128}