/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package leigh.eo.schema.dao;

import leigh.eo.EO;
import leigh.eo.EOLoop;

/**
 * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class
 * has been generated by <code>DAOGenerator</code> and should not be modified.
 *
 * @author DAOGenerator (synthetically generated class)
 */
public final class ProcedureElementDAO {
    public static final String API_TYPE = "Procedure";

    public static EO create() {
        EO eo = new EO(API_TYPE);
        return eo;
    }

    public static boolean assertType(final EO eo) {
        return eo.getApiType().equals(API_TYPE);
    }

    public static final String KEY_APINAME = "apiName";
    public static final String KEY_LABEL = "label";
    public static final String KEY_ENGINE = "engine";
    public static final String KEY_SCRIPT = "script";

    public static String apiType(final EO eo) {
        return eo.getApiType();
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=apiName, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=API Name, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@134dd9f0]} org.a6v.esp.eo.EOLoop@134dda0f, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@33b498 */


    public static java.lang.String getApiName(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_APINAME);

    }

    public static void setApiName(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_APINAME, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Loop', data={acceptTypes=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.AcceptType', data={elementApiName=org.a6v.esp.eo.schema.Text}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@d962a4a2]} org.a6v.esp.eo.EOLoop@d962a4c1, apiName=label, label=Label}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@c6fa5811 */

    public static void appendLabel(EO eo, EO label) {
        EOLoop loop = eo.getValueLoop(KEY_LABEL);
        loop.add(label);
    }

    public static EOLoop getLabel(EO eo) {
        EOLoop o = eo.getValueLoop(KEY_LABEL);
        if (o == null) {
            o = new EOLoop();
            eo.setValue(KEY_LABEL, o);
        }
        return o;

    }

    public static void setLabel(final EO eo, EOLoop value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_LABEL, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=engine, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@64a48200]} org.a6v.esp.eo.EOLoop@64a4821f, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Script Engine, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@837317ce]} org.a6v.esp.eo.EOLoop@837317ed, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@6ce187bb */


    public static java.lang.String getEngine(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_ENGINE);

    }

    public static void setEngine(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_ENGINE, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=script, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@64a48200]} org.a6v.esp.eo.EOLoop@64a4821f, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Code, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@acb578d4]} org.a6v.esp.eo.EOLoop@acb578f3, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@48f10e30 */


    public static java.lang.String getScript(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_SCRIPT);

    }

    public static void setScript(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_SCRIPT, value);
    }


}