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.job.server;
018
019import com.echothree.control.user.job.common.JobRemote;
020import com.echothree.control.user.job.common.form.*;
021import com.echothree.control.user.job.common.result.*;
022import com.echothree.control.user.job.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 JobBean
031        extends JobFormsImpl
032        implements JobRemote, JobLocal {
033    
034    // -------------------------------------------------------------------------
035    //   Testing
036    // -------------------------------------------------------------------------
037    
038    @Override
039    public String ping() {
040        return "JobBean is alive!";
041    }
042    
043    // --------------------------------------------------------------------------------
044    //   Jobs
045    // --------------------------------------------------------------------------------
046    
047    @Override
048    public CommandResult<VoidResult> createJob(UserVisitPK userVisitPK, CreateJobForm form) {
049        return CDI.current().select(CreateJobCommand.class).get().run(userVisitPK, form);
050    }
051    
052    @Override
053    public CommandResult<GetJobResult> getJob(UserVisitPK userVisitPK, GetJobForm form) {
054        return CDI.current().select(GetJobCommand.class).get().run(userVisitPK, form);
055    }
056    
057    @Override
058    public CommandResult<GetJobsResult> getJobs(UserVisitPK userVisitPK, GetJobsForm form) {
059        return CDI.current().select(GetJobsCommand.class).get().run(userVisitPK, form);
060    }
061    
062    @Override
063    public CommandResult<GetJobStatusChoicesResult> getJobStatusChoices(UserVisitPK userVisitPK, GetJobStatusChoicesForm form) {
064        return CDI.current().select(GetJobStatusChoicesCommand.class).get().run(userVisitPK, form);
065    }
066    
067    @Override
068    public CommandResult<VoidResult> setJobStatus(UserVisitPK userVisitPK, SetJobStatusForm form) {
069        return CDI.current().select(SetJobStatusCommand.class).get().run(userVisitPK, form);
070    }
071    
072    @Override
073    public CommandResult<EditJobResult> editJob(UserVisitPK userVisitPK, EditJobForm form) {
074        return CDI.current().select(EditJobCommand.class).get().run(userVisitPK, form);
075    }
076    
077    @Override
078    public CommandResult<VoidResult> deleteJob(UserVisitPK userVisitPK, DeleteJobForm form) {
079        return CDI.current().select(DeleteJobCommand.class).get().run(userVisitPK, form);
080    }
081    
082    @Override
083    public CommandResult<VoidResult> startJob(UserVisitPK userVisitPK, StartJobForm form) {
084        return CDI.current().select(StartJobCommand.class).get().run(userVisitPK, form);
085    }
086    
087    @Override
088    public CommandResult<VoidResult> endJob(UserVisitPK userVisitPK, EndJobForm form) {
089        return CDI.current().select(EndJobCommand.class).get().run(userVisitPK, form);
090    }
091    
092    // --------------------------------------------------------------------------------
093    //   Job Descriptions
094    // --------------------------------------------------------------------------------
095    
096    @Override
097    public CommandResult<VoidResult> createJobDescription(UserVisitPK userVisitPK, CreateJobDescriptionForm form) {
098        return CDI.current().select(CreateJobDescriptionCommand.class).get().run(userVisitPK, form);
099    }
100    
101    @Override
102    public CommandResult<GetJobDescriptionsResult> getJobDescriptions(UserVisitPK userVisitPK, GetJobDescriptionsForm form) {
103        return CDI.current().select(GetJobDescriptionsCommand.class).get().run(userVisitPK, form);
104    }
105    
106    @Override
107    public CommandResult<EditJobDescriptionResult> editJobDescription(UserVisitPK userVisitPK, EditJobDescriptionForm form) {
108        return CDI.current().select(EditJobDescriptionCommand.class).get().run(userVisitPK, form);
109    }
110    
111    @Override
112    public CommandResult<VoidResult> deleteJobDescription(UserVisitPK userVisitPK, DeleteJobDescriptionForm form) {
113        return CDI.current().select(DeleteJobDescriptionCommand.class).get().run(userVisitPK, form);
114    }
115    
116}