Example usage for org.apache.commons.collections ListUtils lazyList

List of usage examples for org.apache.commons.collections ListUtils lazyList

Introduction

In this page you can find the example usage for org.apache.commons.collections ListUtils lazyList.

Prototype

public static List lazyList(List list, Factory factory) 

Source Link

Document

Returns a "lazy" list whose elements will be created on demand.

Usage

From source file:com.tecapro.inventory.common.bean.ItemCheckInfoValue.java

/**
 * get properties of area data//from   w  ww.j  av a 2 s .  com
 * @param key
 *      area data
 * @return
 *      object contain properties of area data
 */
@SuppressWarnings("unchecked")
public List<HashMap<String, Boolean>> getAreaList(String key) {
    if (checkList.get(key) == null) {
        checkList.put(key, ListUtils.lazyList(new ArrayList<String>(), new ValueFactory(null)));
    }
    return checkList.get(key);
}

From source file:org.openmrs.web.controller.patient.ShortPatientModel.java

/**
 * Constructor that creates a shortPatientModel object from a given patient object
 *
 * @param patient/* ww w  .  j a  va  2  s. c  o m*/
 */
@SuppressWarnings("unchecked")
public ShortPatientModel(Patient patient) {
    if (patient != null) {
        this.patient = patient;
        this.personName = patient.getPersonName();
        this.personAddress = patient.getPersonAddress();
        List<PatientIdentifier> activeIdentifiers = patient.getActiveIdentifiers();
        if (activeIdentifiers.isEmpty()) {
            final PatientIdentifierType defaultIdentifierType = getDefaultIdentifierType();
            activeIdentifiers.add(new PatientIdentifier(null, defaultIdentifierType,
                    (LocationUtility.getUserDefaultLocation() != null)
                            ? LocationUtility.getUserDefaultLocation()
                            : LocationUtility.getDefaultLocation()));
        }

        identifiers = ListUtils.lazyList(new ArrayList<PatientIdentifier>(activeIdentifiers),
                FactoryUtils.instantiateFactory(PatientIdentifier.class));

        List<PersonAttributeType> viewableAttributeTypes = Context.getPersonService()
                .getPersonAttributeTypes(PERSON_TYPE.PATIENT, ATTR_VIEW_TYPE.VIEWING);

        personAttributes = new ArrayList<PersonAttribute>();
        if (!CollectionUtils.isEmpty(viewableAttributeTypes)) {
            for (PersonAttributeType personAttributeType : viewableAttributeTypes) {
                PersonAttribute persistedAttribute = patient.getAttribute(personAttributeType);
                //This ensures that empty attributes are added for those we want to display 
                //in the view, but have no values
                PersonAttribute formAttribute = new PersonAttribute(personAttributeType, null);

                //send a clone to the form so that we can use the original to track changes in the values
                if (persistedAttribute != null) {
                    BeanUtils.copyProperties(persistedAttribute, formAttribute);
                }

                personAttributes.add(formAttribute);
            }
        }
    }
}

From source file:oscar.form.pharmaForms.formBPMH.bean.BpmhFormBean.java

@Override
@SuppressWarnings("unchecked")
public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);

    this.drugs = ListUtils.lazyList(new ArrayList<BpmhDrug>(), new Factory() {
        public BpmhDrug create() {
            return new BpmhDrug();
        }/*from   w  ww.j av  a  2s.co m*/
    });

    setConfirm(false);
}