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.license.server;
018
019import com.echothree.control.user.license.common.LicenseRemote;
020import com.echothree.control.user.license.common.form.*;
021import com.echothree.control.user.license.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 LicenseBean
028        extends LicenseFormsImpl
029        implements LicenseRemote, LicenseLocal {
030    
031    // -------------------------------------------------------------------------
032    //   Testing
033    // -------------------------------------------------------------------------
034    
035    @Override
036    public String ping() {
037        return "LicenseBean is alive!";
038    }
039    
040    // --------------------------------------------------------------------------------
041    //   License Types
042    // --------------------------------------------------------------------------------
043    
044    @Override
045    public CommandResult createLicenseType(UserVisitPK userVisitPK, CreateLicenseTypeForm form) {
046        return new CreateLicenseTypeCommand(userVisitPK, form).run();
047    }
048    
049    @Override
050    public CommandResult getLicenseTypeChoices(UserVisitPK userVisitPK, GetLicenseTypeChoicesForm form) {
051        return new GetLicenseTypeChoicesCommand(userVisitPK, form).run();
052    }
053    
054    @Override
055    public CommandResult getLicenseType(UserVisitPK userVisitPK, GetLicenseTypeForm form) {
056        return new GetLicenseTypeCommand(userVisitPK, form).run();
057    }
058    
059    @Override
060    public CommandResult getLicenseTypes(UserVisitPK userVisitPK, GetLicenseTypesForm form) {
061        return new GetLicenseTypesCommand(userVisitPK, form).run();
062    }
063    
064    @Override
065    public CommandResult setDefaultLicenseType(UserVisitPK userVisitPK, SetDefaultLicenseTypeForm form) {
066        return new SetDefaultLicenseTypeCommand(userVisitPK, form).run();
067    }
068    
069    @Override
070    public CommandResult editLicenseType(UserVisitPK userVisitPK, EditLicenseTypeForm form) {
071        return new EditLicenseTypeCommand(userVisitPK, form).run();
072    }
073    
074    @Override
075    public CommandResult deleteLicenseType(UserVisitPK userVisitPK, DeleteLicenseTypeForm form) {
076        return new DeleteLicenseTypeCommand(userVisitPK, form).run();
077    }
078    
079    // --------------------------------------------------------------------------------
080    //   License Type Descriptions
081    // --------------------------------------------------------------------------------
082    
083    @Override
084    public CommandResult createLicenseTypeDescription(UserVisitPK userVisitPK, CreateLicenseTypeDescriptionForm form) {
085        return new CreateLicenseTypeDescriptionCommand(userVisitPK, form).run();
086    }
087    
088    @Override
089    public CommandResult getLicenseTypeDescription(UserVisitPK userVisitPK, GetLicenseTypeDescriptionForm form) {
090        return new GetLicenseTypeDescriptionCommand(userVisitPK, form).run();
091    }
092    
093    @Override
094    public CommandResult getLicenseTypeDescriptions(UserVisitPK userVisitPK, GetLicenseTypeDescriptionsForm form) {
095        return new GetLicenseTypeDescriptionsCommand(userVisitPK, form).run();
096    }
097    
098    @Override
099    public CommandResult editLicenseTypeDescription(UserVisitPK userVisitPK, EditLicenseTypeDescriptionForm form) {
100        return new EditLicenseTypeDescriptionCommand(userVisitPK, form).run();
101    }
102    
103    @Override
104    public CommandResult deleteLicenseTypeDescription(UserVisitPK userVisitPK, DeleteLicenseTypeDescriptionForm form) {
105        return new DeleteLicenseTypeDescriptionCommand(userVisitPK, form).run();
106    }
107    
108    // --------------------------------------------------------------------------------
109    //   License Utilities
110    // --------------------------------------------------------------------------------
111    
112    @Override
113    public CommandResult updateLicense(UserVisitPK userVisitPK) {
114        return new UpdateLicenseCommand(userVisitPK).run();
115    }
116    
117}