001package org.kuali.ole.select.keyvalue;
002
003import org.apache.commons.lang.StringUtils;
004import org.kuali.ole.select.bo.OLEEResourceChangeDashBoard;
005import org.kuali.ole.select.form.OLEEResourceChangeDashboardForm;
006import org.kuali.ole.select.gokb.OleGokbReview;
007import org.kuali.rice.core.api.util.ConcreteKeyValue;
008import org.kuali.rice.core.api.util.KeyValue;
009import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
010import org.kuali.rice.krad.uif.view.ViewModel;
011
012import java.util.ArrayList;
013import java.util.List;
014
015/**
016 * Created by srirams on 29/9/14.
017 */
018public class OLEEResourceKeyValueFinder extends UifKeyValuesFinderBase {
019
020    @Override
021    public List getKeyValues(ViewModel viewModel) {
022        List<KeyValue> keyValues = new ArrayList<KeyValue>();
023        OLEEResourceChangeDashboardForm eResourceChangeDashboardForm = (OLEEResourceChangeDashboardForm) viewModel;
024        List<OleGokbReview> oleGokbReviews = eResourceChangeDashboardForm.getOleGokbReviewList();
025        for (OleGokbReview oleGokbReview : oleGokbReviews) {
026            String eresource = oleGokbReview.getOleERSIdentifier();
027            if (StringUtils.isNotEmpty(eresource))
028                keyValues.add(new ConcreteKeyValue(eresource, eresource));
029        }
030        keyValues.add(new ConcreteKeyValue("", ""));
031        return keyValues;
032    }
033
034}