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.comment.server;
018
019import com.echothree.control.user.comment.common.CommentRemote;
020import com.echothree.control.user.comment.common.form.*;
021import com.echothree.control.user.comment.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 CommentBean
029        extends CommentFormsImpl
030        implements CommentRemote, CommentLocal {
031    
032    // -------------------------------------------------------------------------
033    //   Testing
034    // -------------------------------------------------------------------------
035    
036    @Override
037    public String ping() {
038        return "CommentBean is alive!";
039    }
040    
041    // -------------------------------------------------------------------------
042    //   Comment Types
043    // -------------------------------------------------------------------------
044    
045    @Override
046    public CommandResult createCommentType(UserVisitPK userVisitPK, CreateCommentTypeForm form) {
047        return CDI.current().select(CreateCommentTypeCommand.class).get().run(userVisitPK, form);
048    }
049    
050    @Override
051    public CommandResult getCommentType(UserVisitPK userVisitPK, GetCommentTypeForm form) {
052        return CDI.current().select(GetCommentTypeCommand.class).get().run(userVisitPK, form);
053    }
054    
055    @Override
056    public CommandResult getCommentTypes(UserVisitPK userVisitPK, GetCommentTypesForm form) {
057        return CDI.current().select(GetCommentTypesCommand.class).get().run(userVisitPK, form);
058    }
059    
060    @Override
061    public CommandResult editCommentType(UserVisitPK userVisitPK, EditCommentTypeForm form) {
062        return CDI.current().select(EditCommentTypeCommand.class).get().run(userVisitPK, form);
063    }
064    
065    @Override
066    public CommandResult deleteCommentType(UserVisitPK userVisitPK, DeleteCommentTypeForm form) {
067        return CDI.current().select(DeleteCommentTypeCommand.class).get().run(userVisitPK, form);
068    }
069    
070    // -------------------------------------------------------------------------
071    //   Comment Type Descriptions
072    // -------------------------------------------------------------------------
073    
074    @Override
075    public CommandResult createCommentTypeDescription(UserVisitPK userVisitPK, CreateCommentTypeDescriptionForm form) {
076        return CDI.current().select(CreateCommentTypeDescriptionCommand.class).get().run(userVisitPK, form);
077    }
078    
079    @Override
080    public CommandResult getCommentTypeDescriptions(UserVisitPK userVisitPK, GetCommentTypeDescriptionsForm form) {
081        return CDI.current().select(GetCommentTypeDescriptionsCommand.class).get().run(userVisitPK, form);
082    }
083    
084    @Override
085    public CommandResult editCommentTypeDescription(UserVisitPK userVisitPK, EditCommentTypeDescriptionForm form) {
086        return CDI.current().select(EditCommentTypeDescriptionCommand.class).get().run(userVisitPK, form);
087    }
088    
089    @Override
090    public CommandResult deleteCommentTypeDescription(UserVisitPK userVisitPK, DeleteCommentTypeDescriptionForm form) {
091        return CDI.current().select(DeleteCommentTypeDescriptionCommand.class).get().run(userVisitPK, form);
092    }
093    
094    // -------------------------------------------------------------------------
095    //   Comment Usage Types
096    // -------------------------------------------------------------------------
097    
098    @Override
099    public CommandResult createCommentUsageType(UserVisitPK userVisitPK, CreateCommentUsageTypeForm form) {
100        return CDI.current().select(CreateCommentUsageTypeCommand.class).get().run(userVisitPK, form);
101    }
102    
103    @Override
104    public CommandResult getCommentUsageType(UserVisitPK userVisitPK, GetCommentUsageTypeForm form) {
105        return CDI.current().select(GetCommentUsageTypeCommand.class).get().run(userVisitPK, form);
106    }
107    
108    @Override
109    public CommandResult getCommentUsageTypes(UserVisitPK userVisitPK, GetCommentUsageTypesForm form) {
110        return CDI.current().select(GetCommentUsageTypesCommand.class).get().run(userVisitPK, form);
111    }
112    
113    @Override
114    public CommandResult editCommentUsageType(UserVisitPK userVisitPK, EditCommentUsageTypeForm form) {
115        return CDI.current().select(EditCommentUsageTypeCommand.class).get().run(userVisitPK, form);
116    }
117    
118    @Override
119    public CommandResult deleteCommentUsageType(UserVisitPK userVisitPK, DeleteCommentUsageTypeForm form) {
120        return CDI.current().select(DeleteCommentUsageTypeCommand.class).get().run(userVisitPK, form);
121    }
122    
123    // -------------------------------------------------------------------------
124    //   Comment Usage Type Descriptions
125    // -------------------------------------------------------------------------
126    
127    @Override
128    public CommandResult createCommentUsageTypeDescription(UserVisitPK userVisitPK, CreateCommentUsageTypeDescriptionForm form) {
129        return CDI.current().select(CreateCommentUsageTypeDescriptionCommand.class).get().run(userVisitPK, form);
130    }
131    
132    @Override
133    public CommandResult getCommentUsageTypeDescriptions(UserVisitPK userVisitPK, GetCommentUsageTypeDescriptionsForm form) {
134        return CDI.current().select(GetCommentUsageTypeDescriptionsCommand.class).get().run(userVisitPK, form);
135    }
136    
137    @Override
138    public CommandResult editCommentUsageTypeDescription(UserVisitPK userVisitPK, EditCommentUsageTypeDescriptionForm form) {
139        return CDI.current().select(EditCommentUsageTypeDescriptionCommand.class).get().run(userVisitPK, form);
140    }
141    
142    @Override
143    public CommandResult deleteCommentUsageTypeDescription(UserVisitPK userVisitPK, DeleteCommentUsageTypeDescriptionForm form) {
144        return CDI.current().select(DeleteCommentUsageTypeDescriptionCommand.class).get().run(userVisitPK, form);
145    }
146    
147    // -------------------------------------------------------------------------
148    //   Comments
149    // -------------------------------------------------------------------------
150    
151    @Override
152    public CommandResult createComment(UserVisitPK userVisitPK, CreateCommentForm form) {
153        return CDI.current().select(CreateCommentCommand.class).get().run(userVisitPK, form);
154    }
155    
156    @Override
157    public CommandResult editComment(UserVisitPK userVisitPK, EditCommentForm form) {
158        return CDI.current().select(EditCommentCommand.class).get().run(userVisitPK, form);
159    }
160    
161    @Override
162    public CommandResult getCommentStatusChoices(UserVisitPK userVisitPK, GetCommentStatusChoicesForm form) {
163        return CDI.current().select(GetCommentStatusChoicesCommand.class).get().run(userVisitPK, form);
164    }
165    
166    @Override
167    public CommandResult setCommentStatus(UserVisitPK userVisitPK, SetCommentStatusForm form) {
168        return CDI.current().select(SetCommentStatusCommand.class).get().run(userVisitPK, form);
169    }
170    
171    @Override
172    public CommandResult getComment(UserVisitPK userVisitPK, GetCommentForm form) {
173        return CDI.current().select(GetCommentCommand.class).get().run(userVisitPK, form);
174    }
175    
176    @Override
177    public CommandResult deleteComment(UserVisitPK userVisitPK, DeleteCommentForm form) {
178        return CDI.current().select(DeleteCommentCommand.class).get().run(userVisitPK, form);
179    }
180    
181    // -------------------------------------------------------------------------
182    //   Comment Usages
183    // -------------------------------------------------------------------------
184    
185    @Override
186    public CommandResult createCommentUsage(UserVisitPK userVisitPK, CreateCommentUsageForm form) {
187        return CDI.current().select(CreateCommentUsageCommand.class).get().run(userVisitPK, form);
188    }
189    
190    @Override
191    public CommandResult deleteCommentUsage(UserVisitPK userVisitPK, DeleteCommentUsageForm form) {
192        return CDI.current().select(DeleteCommentUsageCommand.class).get().run(userVisitPK, form);
193    }
194    
195}