net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetMssCF.CFInternetMssCFBindISOLanguageISOCountryId.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetMssCF.CFInternetMssCFBindISOLanguageISOCountryId.java

Source

// Description: Java7 MSSCodeFactory Binding for ISOLanguage Column ISOCountryId.

/*
 *   CF Customer Information Managerment template model
 *
 *   Copyright (c) 2010-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.
 *   
 * ***********************************************************************
 *
 *   Author:   $Author$
 */

package net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetMssCF;

import java.math.*;
import java.sql.*;
import java.util.*;
import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*;
import net.sourceforge.msscodefactory.cfcore.v1_11.MssCF.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetObj.*;

/**
 *   CFInternetMssCFBindISOLanguageISOCountryId binds ISOLanguage.ISOCountryId
 *   as an instance of MssCFGenBindObj.
 */
public class CFInternetMssCFBindISOLanguageISOCountryId extends MssCFGenBindObj {
    private static final long serialVersionUID = 1L;

    public CFInternetMssCFBindISOLanguageISOCountryId() {
        super();
    }

    public CFInternetMssCFBindISOLanguageISOCountryId(MssCFEngine argEngine) {
        super(argEngine, "any", null, "ISOLanguage", "ISOCountryId");
    }

    public Object getValueObject(MssCFGenContext genContext) {
        final String S_ProcName = "CFInternetMssCFBindISOLanguageISOCountryId.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()");
        }

        Short iSOCountryId;
        if (genDef instanceof ICFInternetISOLanguageObj) {
            iSOCountryId = ((ICFInternetISOLanguageObj) genDef).getOptionalISOCountryId();
        } else {
            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                    "genContext.getGenDef()", genDef, "ICFInternetISOLanguageObj");
        }

        return (iSOCountryId);
    }

    public String expandBody(MssCFGenContext genContext) {
        final String S_ProcName = "CFInternetMssCFBindISOLanguageISOCountryId.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 ICFInternetISOLanguageObj) {
            Short iSOCountryId = ((ICFInternetISOLanguageObj) genDef).getOptionalISOCountryId();
            if (iSOCountryId == null) {
                ret = null;
            } else {
                ret = iSOCountryId.toString();
            }
        } else {
            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                    "genContext.getGenDef()", genDef, "ICFInternetISOLanguageObj");
        }

        return (ret);
    }

}