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