use of org.kuali.kfs.krad.service.KeyValuesService in project cu-kfs by CU-CommunityApps.
the class PurchaseOrderTransmissionMethodValuesFinder method getKeyValues.
/*
* @see org.kuali.keyvalues.KeyValuesFinder#getKeyValues()
*/
public List getKeyValues() {
KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
Collection codes = boService.findAll(PurchaseOrderTransmissionMethod.class);
List labels = new ArrayList();
labels.add(new ConcreteKeyValue("", ""));
for (Iterator iter = codes.iterator(); iter.hasNext(); ) {
PurchaseOrderTransmissionMethod poTransmissionMethod = (PurchaseOrderTransmissionMethod) iter.next();
labels.add(new ConcreteKeyValue(poTransmissionMethod.getPurchaseOrderTransmissionMethodCode(), poTransmissionMethod.getPurchaseOrderTransmissionMethodDescription()));
}
return labels;
}
use of org.kuali.kfs.krad.service.KeyValuesService in project cu-kfs by CU-CommunityApps.
the class InvoiceTypeValuesFinder method getKeyValues.
public List<KeyValue> getKeyValues() {
KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
Collection<InvoiceType> invoiceTypeCodes = boService.findAll(InvoiceType.class);
List<KeyValue> invoiceTypeKeyLabels = new ArrayList<KeyValue>();
for (Iterator<InvoiceType> iter = invoiceTypeCodes.iterator(); iter.hasNext(); ) {
InvoiceType element = (InvoiceType) iter.next();
if (element.isActive()) {
// only show active invoice types
invoiceTypeKeyLabels.add(new ConcreteKeyValue(element.getInvoiceTypeCode(), element.getInvoiceTypeCode()));
}
}
return invoiceTypeKeyLabels;
}
use of org.kuali.kfs.krad.service.KeyValuesService in project cu-kfs by CU-CommunityApps.
the class CUSimpleChartValuesFinder method getKeyValues.
/**
* Creates a list of {@link Chart}s using their code as their key, and their code as the display value
*
* @see org.kuali.kfs.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
*/
public List<KeyValue> getKeyValues() {
parameterService = SpringContext.getBean(ParameterService.class);
String defaultChartCode = "";
String defaultChartCodeMethod = "";
try {
defaultChartCode = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE);
defaultChartCodeMethod = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE_METHOD);
} catch (Exception e) {
// Do nothing
}
KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
Collection<Chart> chartCodes = boService.findAll(Chart.class);
List<KeyValue> chartKeyLabels = new ArrayList<KeyValue>();
// If the DEFAULT_CHART_CODE_METHOD parameter DNE or has no value assigned to it, no default
if (defaultChartCodeMethod.equals("")) {
chartKeyLabels.add(new ConcreteKeyValue("", ""));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive()) {
// only show active charts
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
// populate with the default chart
if (defaultChartCodeMethod.equals("1")) {
chartKeyLabels.add(new ConcreteKeyValue(defaultChartCode, defaultChartCode));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive() && !element.getChartOfAccountsCode().equals(defaultChartCode)) {
// only show active charts
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
// populate with chart code of the user's primary department
if (defaultChartCodeMethod.equals("2")) {
Person currentUser = GlobalVariables.getUserSession().getPerson();
String primaryDepartmentChartCode = SpringContext.getBean(FinancialSystemUserService.class).getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
chartKeyLabels.add(new ConcreteKeyValue(primaryDepartmentChartCode, primaryDepartmentChartCode));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive() && !element.getChartOfAccountsCode().equals(primaryDepartmentChartCode)) {
// only show active charts
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
// populate with the default chart unless user's primary department has been defined
if (defaultChartCodeMethod.equals("3")) {
Person currentUser = GlobalVariables.getUserSession().getPerson();
String primaryDepartmentChartCode = SpringContext.getBean(FinancialSystemUserService.class).getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
String chartUsed = null;
if (primaryDepartmentChartCode != null && !primaryDepartmentChartCode.equals("")) {
chartUsed = primaryDepartmentChartCode;
} else {
chartUsed = defaultChartCode;
}
chartKeyLabels.add(new ConcreteKeyValue(chartUsed, chartUsed));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive() && !element.getChartOfAccountsCode().equals(chartUsed)) {
// only show active charts
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
return chartKeyLabels;
}
use of org.kuali.kfs.krad.service.KeyValuesService in project cu-kfs by CU-CommunityApps.
the class InvoiceFrequencyValuesFinder method getKeyValues.
public List<KeyValue> getKeyValues() {
KeyValuesService boService = SpringContext.getBean(KeyValuesService.class);
Collection<InvoiceFrequency> invoiceFrequencyCodes = boService.findAll(InvoiceFrequency.class);
List<KeyValue> invoiceFrequencyKeyLabels = new ArrayList<KeyValue>();
for (Iterator<InvoiceFrequency> iter = invoiceFrequencyCodes.iterator(); iter.hasNext(); ) {
InvoiceFrequency element = (InvoiceFrequency) iter.next();
if (element.isActive()) {
// only show active invoice types
invoiceFrequencyKeyLabels.add(new ConcreteKeyValue(element.getInvoiceFrequencyCode(), element.getInvoiceFrequencyCode()));
}
}
return invoiceFrequencyKeyLabels;
}
Aggregations