1 /**
2 * Copyright 2005-2016 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.kcb.service.impl;
17
18 import java.util.Collection;
19
20 import javax.sql.DataSource;
21
22 import org.kuali.rice.kcb.service.KENIntegrationService;
23 import org.springframework.beans.factory.annotation.Required;
24 import org.springframework.jdbc.core.JdbcTemplate;
25
26 /**
27 * Implements KEN integration by querying the database tables directly. This avoids
28 * a runtime dependence on KEN.
29 *
30 * @author Kuali Rice Team (rice.collab@kuali.org)
31 */
32 public class KENIntegrationServiceDirectImpl implements KENIntegrationService {
33 private DataSource datasource;
34
35 /**
36 * Sets the DataSource to query against
37 * @param ds the DataSource to query against
38 */
39 @Required
40 public void setDataSource(DataSource ds) {
41 this.datasource = ds;
42 }
43
44 /**
45 * @see org.kuali.rice.kcb.service.KENIntegrationService#getAllChannelNames()
46 */
47 public Collection<String> getAllChannelNames() {
48 return new JdbcTemplate(datasource).queryForList("select distinct NM from KREN_CHNL_T", String.class);
49 }
50 }