Example usage for org.apache.commons.lang3.mutable MutableInt toInteger

List of usage examples for org.apache.commons.lang3.mutable MutableInt toInteger

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable MutableInt toInteger.

Prototype

public Integer toInteger() 

Source Link

Document

Gets this mutable as an instance of Integer.

Usage

From source file:com.quinsoft.zeidon.zeidonoperations.KZOEP1AA.java

protected int CreateTemporalMetaEntity(View vSubtask, View lpView, String szEntityName, int nPosition) {
    View vTZCMREPO;//from w ww.ja va  2 s  . c om
    MutableInt plWKS_Id = new MutableInt();
    MutableInt plWkZKey = new MutableInt();
    int lWKS_Id;
    int lWkZKey;
    int ulMaxZKey;

    View vZeidonCM = task.getViewByName("ZeidonCM"); // zLEVEL_APPLICATION
    if (isValid(vZeidonCM) == false) {
        return -1;
    }

    View WKS_View = vZeidonCM.getViewByName("TZCMWKSO"); // zLEVEL_SUBTASK
    // GetViewByName( &WKS_View, "TZCMWKSO", vZeidonCM, zLEVEL_SUBTASK );
    if (isValid(WKS_View) == false) // View isn't there
    {
        MessageSend(lpView, "CM00462", "Configuration Management", "The RepositoryClient View ID was not found",
                zMSGQ_OBJECT_CONSTRAINT_ERROR, 0);
        return -1;
    }

    ulMaxZKey = GetIntegerFromAttribute(WKS_View, "RepositoryClient", "MaxZKey");

    // PETTIT  Add this code when we have a CPL to work with!!!!!!
    fnBreakDownZKey(ulMaxZKey, plWKS_Id, plWkZKey);
    // lWKS_Id = plWKS_Id.toInteger();
    lWkZKey = plWkZKey.toInteger();
    if (ulMaxZKey < 1000000 || // the lowest ZKey is 1 million
            lWkZKey > 999999) {
        vTZCMREPO = task.getViewByName("TZCMREPO"); // zLEVEL_TASK
        if (isValid(vTZCMREPO) == false) {
            vTZCMREPO = lpView.activateObjectInstance("TZCMREPO", null, ActivateFlags.SINGLE);
            if (isValid(vTZCMREPO) == false) {
                MessageSend(lpView, "CM00463", "Configuration Management",
                        "MaxZKey limit exceeded, unable to access Installation object to assign new WKS_Id",
                        zMSGQ_OBJECT_CONSTRAINT_ERROR, 0);
                // return -1;
            }
        }

        if (ulMaxZKey < 1000000) // the lowest ZKey is 1 million
        {
            MessageSend(lpView, "CM00472", "Configuration Management",
                    "Resetting Workstation Generated Key\nPlease check with system administrator",
                    zMSGQ_OBJECT_CONSTRAINT_ERROR, 0);
        }

        if (isValid(vTZCMREPO)) {
            GetIntegerFromAttribute(plWKS_Id, vTZCMREPO, "Installation", "NextWKS_Id");
            lWKS_Id = plWKS_Id.toInteger();
            SetAttributeFromInteger(WKS_View, "RepositoryClient", "WKS_Id", lWKS_Id);
        } else {
            lWKS_Id = 92;
        }

        ulMaxZKey = lWKS_Id * 1000000;
        lWKS_Id++;
        if (isValid(vTZCMREPO)) {
            SetAttributeFromInteger(vTZCMREPO, "Installation", "NextWKS_Id", lWKS_Id);
            CommitObjectInstance(vTZCMREPO);
        }

        CommitWorkstation(WKS_View);
    }

    ulMaxZKey++;
    if (CreateTemporalEntity(lpView, szEntityName, nPosition) < 0) {
        return -1;
    }

    if (SetAttributeFromInteger(lpView, szEntityName, "ZKey", ulMaxZKey) != 0) {
        DeleteEntity(lpView, szEntityName, zREPOS_NONE);
        MessageSend(lpView, "CM00464", "Configuration Management",
                "Unable to set MaxZKey in operation CreateMetaEntity", zMSGQ_OBJECT_CONSTRAINT_ERROR, 0);
        return -1;
    }

    SetAttributeFromInteger(WKS_View, "RepositoryClient", "MaxZKey", ulMaxZKey);
    return 0;
}