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