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