net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMssCF.CFCrmMssCFBindSecDeviceSecUserId.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMssCF.CFCrmMssCFBindSecDeviceSecUserId.java

Source

// Description: Java7 MSSCodeFactory Binding for SecDevice Column SecUserId.

/*
 *   CF Customer Relations Management model
 *
 *   Copyright (c) 2014 Mark Sobkow
 *   
 *      Licensed under the Apache License, Version 2.0 (the "License");
 *      you may not use this file except in compliance with the License.
 *      You may obtain a copy of the License at
 *   
 *          http://www.apache.org/licenses/LICENSE-2.0
 *   
 *      Unless required by applicable law or agreed to in writing, software
 *      distributed under the License is distributed on an "AS IS" BASIS,
 *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *      See the License for the specific language governing permissions and
 *      limitations under the License.
 *   
 */

package net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmMssCF;

import java.math.*;
import java.sql.*;
import java.util.*;
import net.sourceforge.msscodefactory.cflib.v2_1.CFLib.*;
import net.sourceforge.msscodefactory.cfcore.v2_1.MssCF.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmObj.*;

/**
 *   CFCrmMssCFBindSecDeviceSecUserId binds SecDevice.SecUserId
 *   as an instance of MssCFGenBindObj.
 */
public class CFCrmMssCFBindSecDeviceSecUserId extends MssCFGenBindObj {
    private static final long serialVersionUID = 1L;

    public CFCrmMssCFBindSecDeviceSecUserId() {
        super();
    }

    public CFCrmMssCFBindSecDeviceSecUserId(MssCFEngine argEngine) {
        super(argEngine, "any", null, "SecDevice", "SecUserId");
    }

    public Object getValueObject(MssCFGenContext genContext) {
        final String S_ProcName = "CFCrmMssCFBindSecDeviceSecUserId.getValueObject() ";

        if (genContext == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                    "genContext");
        }

        ICFLibAnyObj genDef = genContext.getGenDef();
        if (genDef == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                    "genContext.getGenDef()");
        }

        UUID secUserId;
        if (genDef instanceof ICFCrmSecDeviceObj) {
            secUserId = ((ICFCrmSecDeviceObj) genDef).getRequiredSecUserId();
        } else {
            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                    "genContext.getGenDef()", genDef, "ICFCrmSecDeviceObj");
        }

        return (secUserId);
    }

    public String expandBody(MssCFGenContext genContext) {
        final String S_ProcName = "CFCrmMssCFBindSecDeviceSecUserId.expandBody() ";

        if (genContext == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                    "genContext");
        }

        ICFLibAnyObj genDef = genContext.getGenDef();
        if (genDef == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                    "genContext.getGenDef()");
        }

        String ret;

        if (genDef instanceof ICFCrmSecDeviceObj) {
            UUID secUserId = ((ICFCrmSecDeviceObj) genDef).getRequiredSecUserId();
            if (secUserId == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 0,
                        "Value");
            }
            ret = secUserId.toString();
        } else {
            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                    "genContext.getGenDef()", genDef, "ICFCrmSecDeviceObj");
        }

        return (ret);
    }

}