Package com.sourcetap.sfa.ui

Source Code of com.sourcetap.sfa.ui.UIAccountTypeDropDown

/*
*
* Copyright (c) 2004 SourceTap - www.sourcetap.com
*
*  The contents of this file are subject to the SourceTap Public License
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
* Software distributed under the License is distributed on an  "AS IS"  basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*/

package com.sourcetap.sfa.ui;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityExpr;
import org.ofbiz.entity.condition.EntityOperator;

import com.sourcetap.sfa.util.UserInfo;


/**
* DOCUMENT ME!
*
*/
public class UIAccountTypeDropDown extends UIDropDown {
  public static final String module = UIAccountTypeDropDown.class.getName();
    public UIAccountTypeDropDown() {
    }

    /**
     * Return a list of values for a drop down using a UI Display Object defined in the data base.
     * This method overrides the parent class.  Note: This
     * method is only used when the screen is first drawn.  If the drop down list is updated dynamically, the
     * getDropDownValuesDynamic method is used.
     *
     * @see #getDropDownValuesDynamic(GenericDelegator, Map, UserInfo)
     *
     * @author John Nutting
     *
     * @param delegator Reference to the OFBIZ delegator being used to connect to the data base
     * @param uiDisplayObject Reference to a display object defined in the data base and attached to the field to be displayed by the UI builder
     * @param orderDef List of fields defining the sort order of the drop down values
     * @param entityDetailsVector Vector of generic values containing the values to be displayed on the screen for all fields
     * @param fieldInfo Reference to field info object containing attributes of the current field
     * @param userInfo Reference to user info object containing information about the currently logged-in user
     *
     * @return List of generic values to be displayed in the drop down.  This will be null if an error occurs.
     */
    public List getDropDownValues(GenericDelegator delegator,
        UIDisplayObject uiDisplayObject, ArrayList orderDef,
        Vector entityDetailsVector, UIFieldInfo fieldInfo, UserInfo userInfo) {

        try {
          EntityConditionList condition = new EntityConditionList( UtilMisc.toList(new EntityExpr("codeId", EntityOperator.NOT_EQUAL, "base"),
                                         new EntityExpr("codeTypeId", EntityOperator.EQUALS, "ACCOUNT_TYPE")),EntityOperator.AND);
          return delegator.findByCondition("Code", condition, null, UtilMisc.toList("codeValue"));
        } catch (GenericEntityException e) {
            Debug.logError(
                "[UIAccountTypeDropDown.getDropDownValues] Error retrieving the dropdown values: ", module);
            Debug.logError(e.getLocalizedMessage(), module);

            return new LinkedList();
        }
    }
}
TOP

Related Classes of com.sourcetap.sfa.ui.UIAccountTypeDropDown

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.