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.term.server;
018
019import com.echothree.control.user.term.common.TermRemote;
020import com.echothree.control.user.term.common.form.*;
021import com.echothree.control.user.term.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 TermBean
029        extends TermFormsImpl
030        implements TermRemote, TermLocal {
031    
032    // -------------------------------------------------------------------------
033    //   Testing
034    // -------------------------------------------------------------------------
035    
036    @Override
037    public String ping() {
038        return "TermBean is alive!";
039    }
040    
041    // -------------------------------------------------------------------------
042    //   Term Types
043    // -------------------------------------------------------------------------
044    
045    @Override
046    public CommandResult createTermType(UserVisitPK userVisitPK, CreateTermTypeForm form) {
047        return CDI.current().select(CreateTermTypeCommand.class).get().run(userVisitPK, form);
048    }
049    
050    @Override
051    public CommandResult getTermTypes(UserVisitPK userVisitPK, GetTermTypesForm form) {
052        return CDI.current().select(GetTermTypesCommand.class).get().run(userVisitPK, form);
053    }
054    
055    @Override
056    public CommandResult getTermType(UserVisitPK userVisitPK, GetTermTypeForm form) {
057        return CDI.current().select(GetTermTypeCommand.class).get().run(userVisitPK, form);
058    }
059    
060    @Override
061    public CommandResult getTermTypeChoices(UserVisitPK userVisitPK, GetTermTypeChoicesForm form) {
062        return CDI.current().select(GetTermTypeChoicesCommand.class).get().run(userVisitPK, form);
063    }
064    
065    // -------------------------------------------------------------------------
066    //   Term Type Descriptions
067    // -------------------------------------------------------------------------
068    
069    @Override
070    public CommandResult createTermTypeDescription(UserVisitPK userVisitPK, CreateTermTypeDescriptionForm form) {
071        return CDI.current().select(CreateTermTypeDescriptionCommand.class).get().run(userVisitPK, form);
072    }
073    
074    // -------------------------------------------------------------------------
075    //   Terms
076    // -------------------------------------------------------------------------
077    
078    @Override
079    public CommandResult createTerm(UserVisitPK userVisitPK, CreateTermForm form) {
080        return CDI.current().select(CreateTermCommand.class).get().run(userVisitPK, form);
081    }
082    
083    @Override
084    public CommandResult getTerms(UserVisitPK userVisitPK, GetTermsForm form) {
085        return CDI.current().select(GetTermsCommand.class).get().run(userVisitPK, form);
086    }
087    
088    @Override
089    public CommandResult getTerm(UserVisitPK userVisitPK, GetTermForm form) {
090        return CDI.current().select(GetTermCommand.class).get().run(userVisitPK, form);
091    }
092    
093    @Override
094    public CommandResult getTermChoices(UserVisitPK userVisitPK, GetTermChoicesForm form) {
095        return CDI.current().select(GetTermChoicesCommand.class).get().run(userVisitPK, form);
096    }
097    
098    @Override
099    public CommandResult setDefaultTerm(UserVisitPK userVisitPK, SetDefaultTermForm form) {
100        return CDI.current().select(SetDefaultTermCommand.class).get().run(userVisitPK, form);
101    }
102    
103    @Override
104    public CommandResult deleteTerm(UserVisitPK userVisitPK, DeleteTermForm form) {
105        return CDI.current().select(DeleteTermCommand.class).get().run(userVisitPK, form);
106    }
107    
108    // -------------------------------------------------------------------------
109    //   Term Descriptions
110    // -------------------------------------------------------------------------
111    
112    @Override
113    public CommandResult createTermDescription(UserVisitPK userVisitPK, CreateTermDescriptionForm form) {
114        return CDI.current().select(CreateTermDescriptionCommand.class).get().run(userVisitPK, form);
115    }
116    
117    @Override
118    public CommandResult getTermDescriptions(UserVisitPK userVisitPK, GetTermDescriptionsForm form) {
119        return CDI.current().select(GetTermDescriptionsCommand.class).get().run(userVisitPK, form);
120    }
121    
122    @Override
123    public CommandResult editTermDescription(UserVisitPK userVisitPK, EditTermDescriptionForm form) {
124        return CDI.current().select(EditTermDescriptionCommand.class).get().run(userVisitPK, form);
125    }
126    
127    @Override
128    public CommandResult deleteTermDescription(UserVisitPK userVisitPK, DeleteTermDescriptionForm form) {
129        return CDI.current().select(DeleteTermDescriptionCommand.class).get().run(userVisitPK, form);
130    }
131    
132    // -------------------------------------------------------------------------
133    //   Customer Type Credit Limits
134    // -------------------------------------------------------------------------
135    
136    @Override
137    public CommandResult createCustomerTypeCreditLimit(UserVisitPK userVisitPK, CreateCustomerTypeCreditLimitForm form) {
138        return CDI.current().select(CreateCustomerTypeCreditLimitCommand.class).get().run(userVisitPK, form);
139    }
140    
141    @Override
142    public CommandResult editCustomerTypeCreditLimit(UserVisitPK userVisitPK, EditCustomerTypeCreditLimitForm form) {
143        return CDI.current().select(EditCustomerTypeCreditLimitCommand.class).get().run(userVisitPK, form);
144    }
145    
146    @Override
147    public CommandResult getCustomerTypeCreditLimits(UserVisitPK userVisitPK, GetCustomerTypeCreditLimitsForm form) {
148        return CDI.current().select(GetCustomerTypeCreditLimitsCommand.class).get().run(userVisitPK, form);
149    }
150    
151    @Override
152    public CommandResult deleteCustomerTypeCreditLimit(UserVisitPK userVisitPK, DeleteCustomerTypeCreditLimitForm form) {
153        return CDI.current().select(DeleteCustomerTypeCreditLimitCommand.class).get().run(userVisitPK, form);
154    }
155    
156    // -------------------------------------------------------------------------
157    //   Party Credit Limits
158    // -------------------------------------------------------------------------
159    
160    @Override
161    public CommandResult createPartyCreditLimit(UserVisitPK userVisitPK, CreatePartyCreditLimitForm form) {
162        return CDI.current().select(CreatePartyCreditLimitCommand.class).get().run(userVisitPK, form);
163    }
164    
165    @Override
166    public CommandResult editPartyCreditLimit(UserVisitPK userVisitPK, EditPartyCreditLimitForm form) {
167        return CDI.current().select(EditPartyCreditLimitCommand.class).get().run(userVisitPK, form);
168    }
169    
170    @Override
171    public CommandResult getPartyCreditLimits(UserVisitPK userVisitPK, GetPartyCreditLimitsForm form) {
172        return CDI.current().select(GetPartyCreditLimitsCommand.class).get().run(userVisitPK, form);
173    }
174    
175    @Override
176    public CommandResult deletePartyCreditLimit(UserVisitPK userVisitPK, DeletePartyCreditLimitForm form) {
177        return CDI.current().select(DeletePartyCreditLimitCommand.class).get().run(userVisitPK, form);
178    }
179    
180    // -------------------------------------------------------------------------
181    //   Party Terms
182    // -------------------------------------------------------------------------
183    
184    @Override
185    public CommandResult editPartyTerm(UserVisitPK userVisitPK, EditPartyTermForm form) {
186        return CDI.current().select(EditPartyTermCommand.class).get().run(userVisitPK, form);
187    }
188    
189}