當前位置: 首頁>>代碼示例>>Java>>正文


Java RowCallbackHandler類代碼示例

本文整理匯總了Java中org.springframework.jdbc.core.RowCallbackHandler的典型用法代碼示例。如果您正苦於以下問題:Java RowCallbackHandler類的具體用法?Java RowCallbackHandler怎麽用?Java RowCallbackHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RowCallbackHandler類屬於org.springframework.jdbc.core包,在下文中一共展示了RowCallbackHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDomainDetails

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public DomainEntity getDomainDetails(String domainId) {
    DomainEntity domainEntity = new DomainEntity();
    jdbcTemplate.query(SqlDefine.sys_rdbms_084, new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet resultSet) throws SQLException {
            domainEntity.setDomain_id(domainId);
            domainEntity.setDomain_desc(resultSet.getString("domain_desc"));
            domainEntity.setDomain_status_desc(resultSet.getString("domain_status_desc"));
            domainEntity.setMaintance_date(resultSet.getString("maintance_date"));
            domainEntity.setCreate_user_id(resultSet.getString("create_user_id"));
            domainEntity.setDomain_modify_user(resultSet.getString("domain_modify_user"));
            domainEntity.setDomain_modify_date(resultSet.getString("domain_modify_date"));
        }
    }, domainId);
    return domainEntity;
}
 
開發者ID:hzwy23,項目名稱:hauth-java,代碼行數:18,代碼來源:DomainDaoImpl.java

示例2: getInformationForUsers

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public Map<String, UserBean> getInformationForUsers(final Collection<String> userIds)
{
	String sql = config.getUserInfo();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Map<String, UserBean> users = new HashMap<String, UserBean>();
	handleIn(sql, userIds, new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String username = set.getString(2);
			String fname = set.getString(3);
			String lname = set.getString(4);
			String email = set.getString(5);
			DefaultUserBean user = new DefaultUserBean(id, username, fname, lname, email);
			users.put(id, user);
		}
	});
	return users;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:27,代碼來源:ReplicatedUserPlugin.java

示例3: getRolesForUser

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public Pair<ChainResult, Collection<RoleBean>> getRolesForUser(final String userID)
{
	String sql = config.getUserRoles();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Collection<RoleBean> roles = new ArrayList<RoleBean>();
	executeSql(sql, getParamValues(sql, userID), new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			roles.add(new DefaultRoleBean(id, name));
		}
	});
	return new Pair<ChainResult, Collection<RoleBean>>(ChainResult.CONTINUE, roles);
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:ReplicatedUserPlugin.java

示例4: searchRoles

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public Collection<RoleBean> searchRoles(final String query)
{
	String sql = config.getSearchRoles();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Collection<RoleBean> roles = new ArrayList<RoleBean>();
	executeSql(sql, getParamValues(sql, query.replace('*', '%')), new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			roles.add(new DefaultRoleBean(id, name));
		}
	});
	return roles;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:ReplicatedUserPlugin.java

示例5: getInformationForRoles

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public Map<String, RoleBean> getInformationForRoles(final Collection<String> roleIds)
{
	String sql = config.getRoleInfo();
	if( Check.isEmpty(sql) )
	{
		return null;
	}

	final Map<String, RoleBean> roles = Maps.newHashMapWithExpectedSize(roleIds.size());
	handleIn(sql, roleIds, new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			roles.put(id, new DefaultRoleBean(id, name));
		}
	});
	return roles;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:ReplicatedUserPlugin.java

示例6: authenticate

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
private UserInfo authenticate(String username)
{
	String sql = config.getAuthenticate();

	final UserInfo user = new UserInfo();
	executeSql(sql, getParamValues(sql, username), new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			boolean suspended = set.getInt(3) > 0;
			if( suspended )
			{
				throw new DisabledException("User suspended");
			}
			String id = set.getString(1);
			String password = set.getString(2);

			user.setId(id);
			user.setPassword(password);
		}
	});
	return user;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:25,代碼來源:ReplicatedUserPlugin.java

示例7: getGroupInfo

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
private Map<String, GroupBean> getGroupInfo(Collection<String> ids)
{
	final Map<String, GroupBean> groupMap = new HashMap<String, GroupBean>();
	String sql = config.getGroupInfo();
	if( Check.isEmpty(sql) || Check.isEmpty(ids) )
	{
		return groupMap;
	}

	handleIn(sql, ids, new RowCallbackHandler()
	{
		@Override
		public void processRow(ResultSet set) throws SQLException
		{
			String id = set.getString(1);
			String name = set.getString(2);
			GroupBean group = new DefaultGroupBean(id, name);
			groupMap.put(id, group);
		}
	});
	return groupMap;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:ReplicatedUserPlugin.java

示例8: loadBeanDefinitions

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
/**
 * Load bean definitions from the database via the given SQL string.
 * @param sql SQL query to use for loading bean definitions.
 * The first three columns must be bean name, property name and value.
 * Any join and any other columns are permitted: e.g.
 * {@code SELECT BEAN_NAME, PROPERTY, VALUE FROM CONFIG WHERE CONFIG.APP_ID = 1}
 * It's also possible to perform a join. Column names are not significant --
 * only the ordering of these first three columns.
 */
public void loadBeanDefinitions(String sql) {
	Assert.notNull(this.jdbcTemplate, "Not fully configured - specify DataSource or JdbcTemplate");
	final Properties props = new Properties();
	this.jdbcTemplate.query(sql, new RowCallbackHandler() {
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			String beanName = rs.getString(1);
			String property = rs.getString(2);
			String value = rs.getString(3);
			// Make a properties entry by combining bean name and property.
			props.setProperty(beanName + "." + property, value);
		}
	});
	this.propReader.registerBeanDefinitions(props);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:JdbcBeanDefinitionReader.java

示例9: getJobList

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public List<GroupTaskEntity> getJobList(String groupId) {
    List<GroupTaskEntity> list = new ArrayList<>();
    jdbcTemplate.query(batchSqlText.getSql("sys_rdbms_133"), new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet resultSet) throws SQLException {
            GroupTaskEntity one = new GroupTaskEntity();
            one.setCodeNumber(resultSet.getString("code_number"));
            one.setDomainId(resultSet.getString("domain_id"));
            one.setGroupId(resultSet.getString("group_id"));
            one.setJobKey(resultSet.getString("job_key"));
            one.setPosTop(resultSet.getInt("pos_top"));
            one.setTaskId(resultSet.getString("task_id"));
            one.setTaskType(resultSet.getString("task_type"));
            one.setTaskTypeDesc(resultSet.getString("task_type_desc"));
            one.setTaskDesc(resultSet.getString("task_type_desc"));
            one.setPosLeft(resultSet.getInt("pos_left"));
            list.add(one);
        }
    }, groupId);
    logger.debug("group id is:{},result is:{}", groupId, list);
    return list;
}
 
開發者ID:hzwy23,項目名稱:batch-scheduler,代碼行數:24,代碼來源:GroupTaskDaoImpl.java

示例10: testQueryWithRowCallbackHandlerNoParameters

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Test
public void testQueryWithRowCallbackHandlerNoParameters() throws SQLException {
	given(resultSet.next()).willReturn(true, false);
	given(resultSet.getInt("id")).willReturn(1);
	given(resultSet.getString("forename")).willReturn("rod");

	final List<Customer> customers = new LinkedList<Customer>();
	namedParameterTemplate.query(SELECT_NO_PARAMETERS, new RowCallbackHandler() {
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			Customer cust = new Customer();
			cust.setId(rs.getInt(COLUMN_NAMES[0]));
			cust.setForename(rs.getString(COLUMN_NAMES[1]));
			customers.add(cust);
		}
	});

	assertEquals(1, customers.size());
	assertTrue("Customer id was assigned correctly", customers.get(0).getId() == 1);
	assertTrue("Customer forename was assigned correctly", customers.get(0).getForename().equals("rod"));
	verify(connection).prepareStatement(SELECT_NO_PARAMETERS);
	verify(preparedStatement).close();
	verify(connection).close();
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:25,代碼來源:NamedParameterJdbcTemplateTests.java

示例11: findOne

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public RegressionModel findOne(String id) {
  final List<RegressionModel> models = new ArrayList<>();
  jdbcTemplate.query(SELECT_MODEL.replaceFirst("@", id), new RowCallbackHandler() {
    
    @Override
    public void processRow(ResultSet rs) throws SQLException {
      RegressionModel m = new RegressionModel();
      try {
        m.deserializeClassifierFromJson(rs.getString(1));
        //m.setLongId(rs.getLong(2));
        m.setStringId(rs.getString(2));
        m.setGeneratedOn(rs.getDate(3).getTime());
        models.add(m);
      } catch (IOException e) {
        throw new SQLException("Unable to deserialze model from string", e);
      }
      
    }
  });
  return models.isEmpty() ? null : models.get(0);
}
 
開發者ID:javanotes,項目名稱:reactive-data,代碼行數:23,代碼來源:ModelJdbcRepository.java

示例12: findUserByUserName

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public UserInfo findUserByUserName(String userName) {
	// TODO Auto-generated method stub
	String sql = "select * from user_info where user_name = ?";
	final UserInfo user = new UserInfo();
	jdbcTemplate.query(sql, new Object[]{userName}, new RowCallbackHandler() {
		
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			// TODO Auto-generated method stub
			if (rs.next()) {
				user.setUserId(rs.getLong("user_id"));
				user.setUserName(rs.getString("user_name"));
			}
		}
	});
	
	if (user.getUserId() == 0) {
		return null;
	}
	
	return user;
}
 
開發者ID:hanwwh,項目名稱:xqres,代碼行數:24,代碼來源:UserInfoDAOImpl.java

示例13: queryOrderItems

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public List<OrderItem> queryOrderItems() {
	// TODO Auto-generated method stub
	String sql = "SELECT * FROM ORDER_ITEM";
	final List<OrderItem> list = new ArrayList<OrderItem>();
	jdbcTemplate.query(sql, new RowCallbackHandler() {
		
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			// TODO Auto-generated method stub
			OrderItem item = new OrderItem();
			item.setItemId(rs.getLong("ITEM_ID"));
			item.setGroupId(rs.getLong("GROUP_ID"));
			item.setStatus(rs.getInt("STATUS"));
			item.setItemCode(rs.getString("ITEM_CODE"));
			item.setItemName(rs.getString("ITEM_NAME"));
			item.setItemPrice(rs.getFloat("ITEM_PRICE"));
			item.setCreateDate(rs.getTimestamp("CREATE_DATE"));
			item.setItemPicurl(rs.getString("ITEM_PICURL"));
			item.setItemDetails(rs.getString("ITEM_DETAILS"));
			list.add(item);
		}
	});
	
	return list;
}
 
開發者ID:hanwwh,項目名稱:xqres,代碼行數:27,代碼來源:OrderItemDAOImpl.java

示例14: selectFoods

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public List<FoodInfo> selectFoods() {
	String sql = "select food_id, food_name, food_price from food_info";
	final List<FoodInfo> list = new ArrayList<FoodInfo>();
	jdbcTemplate.query(sql, new RowCallbackHandler() {
		@Override
		public void processRow(ResultSet rs) throws SQLException {
			FoodInfo info = new FoodInfo();
			info.setFoodId(rs.getLong("food_id"));
			info.setFoodName(rs.getString("food_name"));
			info.setFoodPrice(rs.getFloat("food_price"));
			list.add(info);
		}
	});

	return list;
}
 
開發者ID:hanwwh,項目名稱:xqres,代碼行數:18,代碼來源:OrderItemDAOImpl.java

示例15: getOrganisationUnitDataSetAssocationMap

import org.springframework.jdbc.core.RowCallbackHandler; //導入依賴的package包/類
@Override
public Map<String, Set<String>> getOrganisationUnitDataSetAssocationMap()
{
    final String sql = "select ds.uid as ds_uid, ou.uid as ou_uid from datasetsource d " +
        "left join organisationunit ou on ou.organisationunitid=d.sourceid " +
        "left join dataset ds on ds.datasetid=d.datasetid";

    final SetMap<String, String> map = new SetMap<>();

    jdbcTemplate.query( sql, new RowCallbackHandler()
    {
        @Override
        public void processRow( ResultSet rs ) throws SQLException
        {
            String dataSetId = rs.getString( "ds_uid" );
            String organisationUnitId = rs.getString( "ou_uid" );
            map.putValue( organisationUnitId, dataSetId );
        }
    } );

    return map;
}
 
開發者ID:dhis2,項目名稱:dhis2-core,代碼行數:23,代碼來源:HibernateOrganisationUnitStore.java


注:本文中的org.springframework.jdbc.core.RowCallbackHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。