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.letter.server; 018 019import com.echothree.control.user.letter.common.LetterRemote; 020import com.echothree.control.user.letter.common.form.*; 021import com.echothree.control.user.letter.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 LetterBean 029 extends LetterFormsImpl 030 implements LetterRemote, LetterLocal { 031 032 // ------------------------------------------------------------------------- 033 // Testing 034 // ------------------------------------------------------------------------- 035 036 @Override 037 public String ping() { 038 return "LetterBean is alive!"; 039 } 040 041 // -------------------------------------------------------------------------------- 042 // Letter Sources 043 // -------------------------------------------------------------------------------- 044 045 @Override 046 public CommandResult createLetterSource(UserVisitPK userVisitPK, CreateLetterSourceForm form) { 047 return CDI.current().select(CreateLetterSourceCommand.class).get().run(userVisitPK, form); 048 } 049 050 @Override 051 public CommandResult getLetterSourceChoices(UserVisitPK userVisitPK, GetLetterSourceChoicesForm form) { 052 return CDI.current().select(GetLetterSourceChoicesCommand.class).get().run(userVisitPK, form); 053 } 054 055 @Override 056 public CommandResult getLetterSource(UserVisitPK userVisitPK, GetLetterSourceForm form) { 057 return CDI.current().select(GetLetterSourceCommand.class).get().run(userVisitPK, form); 058 } 059 060 @Override 061 public CommandResult getLetterSources(UserVisitPK userVisitPK, GetLetterSourcesForm form) { 062 return CDI.current().select(GetLetterSourcesCommand.class).get().run(userVisitPK, form); 063 } 064 065 @Override 066 public CommandResult setDefaultLetterSource(UserVisitPK userVisitPK, SetDefaultLetterSourceForm form) { 067 return CDI.current().select(SetDefaultLetterSourceCommand.class).get().run(userVisitPK, form); 068 } 069 070 @Override 071 public CommandResult editLetterSource(UserVisitPK userVisitPK, EditLetterSourceForm form) { 072 return CDI.current().select(EditLetterSourceCommand.class).get().run(userVisitPK, form); 073 } 074 075 @Override 076 public CommandResult deleteLetterSource(UserVisitPK userVisitPK, DeleteLetterSourceForm form) { 077 return CDI.current().select(DeleteLetterSourceCommand.class).get().run(userVisitPK, form); 078 } 079 080 // -------------------------------------------------------------------------------- 081 // Letter Source Descriptions 082 // -------------------------------------------------------------------------------- 083 084 @Override 085 public CommandResult createLetterSourceDescription(UserVisitPK userVisitPK, CreateLetterSourceDescriptionForm form) { 086 return CDI.current().select(CreateLetterSourceDescriptionCommand.class).get().run(userVisitPK, form); 087 } 088 089 @Override 090 public CommandResult getLetterSourceDescriptions(UserVisitPK userVisitPK, GetLetterSourceDescriptionsForm form) { 091 return CDI.current().select(GetLetterSourceDescriptionsCommand.class).get().run(userVisitPK, form); 092 } 093 094 @Override 095 public CommandResult editLetterSourceDescription(UserVisitPK userVisitPK, EditLetterSourceDescriptionForm form) { 096 return CDI.current().select(EditLetterSourceDescriptionCommand.class).get().run(userVisitPK, form); 097 } 098 099 @Override 100 public CommandResult deleteLetterSourceDescription(UserVisitPK userVisitPK, DeleteLetterSourceDescriptionForm form) { 101 return CDI.current().select(DeleteLetterSourceDescriptionCommand.class).get().run(userVisitPK, form); 102 } 103 104 // -------------------------------------------------------------------------------- 105 // Letters 106 // -------------------------------------------------------------------------------- 107 108 @Override 109 public CommandResult createLetter(UserVisitPK userVisitPK, CreateLetterForm form) { 110 return CDI.current().select(CreateLetterCommand.class).get().run(userVisitPK, form); 111 } 112 113 @Override 114 public CommandResult getLetterChoices(UserVisitPK userVisitPK, GetLetterChoicesForm form) { 115 return CDI.current().select(GetLetterChoicesCommand.class).get().run(userVisitPK, form); 116 } 117 118 @Override 119 public CommandResult getLetter(UserVisitPK userVisitPK, GetLetterForm form) { 120 return CDI.current().select(GetLetterCommand.class).get().run(userVisitPK, form); 121 } 122 123 @Override 124 public CommandResult getLetters(UserVisitPK userVisitPK, GetLettersForm form) { 125 return CDI.current().select(GetLettersCommand.class).get().run(userVisitPK, form); 126 } 127 128 @Override 129 public CommandResult setDefaultLetter(UserVisitPK userVisitPK, SetDefaultLetterForm form) { 130 return CDI.current().select(SetDefaultLetterCommand.class).get().run(userVisitPK, form); 131 } 132 133 @Override 134 public CommandResult editLetter(UserVisitPK userVisitPK, EditLetterForm form) { 135 return CDI.current().select(EditLetterCommand.class).get().run(userVisitPK, form); 136 } 137 138 @Override 139 public CommandResult deleteLetter(UserVisitPK userVisitPK, DeleteLetterForm form) { 140 return CDI.current().select(DeleteLetterCommand.class).get().run(userVisitPK, form); 141 } 142 143 // -------------------------------------------------------------------------------- 144 // Letter Descriptions 145 // -------------------------------------------------------------------------------- 146 147 @Override 148 public CommandResult createLetterDescription(UserVisitPK userVisitPK, CreateLetterDescriptionForm form) { 149 return CDI.current().select(CreateLetterDescriptionCommand.class).get().run(userVisitPK, form); 150 } 151 152 @Override 153 public CommandResult getLetterDescriptions(UserVisitPK userVisitPK, GetLetterDescriptionsForm form) { 154 return CDI.current().select(GetLetterDescriptionsCommand.class).get().run(userVisitPK, form); 155 } 156 157 @Override 158 public CommandResult editLetterDescription(UserVisitPK userVisitPK, EditLetterDescriptionForm form) { 159 return CDI.current().select(EditLetterDescriptionCommand.class).get().run(userVisitPK, form); 160 } 161 162 @Override 163 public CommandResult deleteLetterDescription(UserVisitPK userVisitPK, DeleteLetterDescriptionForm form) { 164 return CDI.current().select(DeleteLetterDescriptionCommand.class).get().run(userVisitPK, form); 165 } 166 167 // -------------------------------------------------------------------------------- 168 // Letter Contact Mechanism Purposes 169 // -------------------------------------------------------------------------------- 170 171 @Override 172 public CommandResult createLetterContactMechanismPurpose(UserVisitPK userVisitPK, CreateLetterContactMechanismPurposeForm form) { 173 return CDI.current().select(CreateLetterContactMechanismPurposeCommand.class).get().run(userVisitPK, form); 174 } 175 176 @Override 177 public CommandResult getLetterContactMechanismPurposes(UserVisitPK userVisitPK, GetLetterContactMechanismPurposesForm form) { 178 return CDI.current().select(GetLetterContactMechanismPurposesCommand.class).get().run(userVisitPK, form); 179 } 180 181 @Override 182 public CommandResult editLetterContactMechanismPurpose(UserVisitPK userVisitPK, EditLetterContactMechanismPurposeForm form) { 183 return CDI.current().select(EditLetterContactMechanismPurposeCommand.class).get().run(userVisitPK, form); 184 } 185 186 @Override 187 public CommandResult deleteLetterContactMechanismPurpose(UserVisitPK userVisitPK, DeleteLetterContactMechanismPurposeForm form) { 188 return CDI.current().select(DeleteLetterContactMechanismPurposeCommand.class).get().run(userVisitPK, form); 189 } 190 191 // -------------------------------------------------------------------------------- 192 // Queued Letters 193 // -------------------------------------------------------------------------------- 194 195 @Override 196 public CommandResult getQueuedLetter(UserVisitPK userVisitPK, GetQueuedLetterForm form) { 197 return CDI.current().select(GetQueuedLetterCommand.class).get().run(userVisitPK, form); 198 } 199 200 @Override 201 public CommandResult getQueuedLetters(UserVisitPK userVisitPK, GetQueuedLettersForm form) { 202 return CDI.current().select(GetQueuedLettersCommand.class).get().run(userVisitPK, form); 203 } 204 205 @Override 206 public CommandResult deleteQueuedLetter(UserVisitPK userVisitPK, DeleteQueuedLetterForm form) { 207 return CDI.current().select(DeleteQueuedLetterCommand.class).get().run(userVisitPK, form); 208 } 209 210}