• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InfrastructureUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.liferay.portal.kernel.util.InfrastructureUtil的典型用法代码示例。如果您正苦于以下问题:Java InfrastructureUtil类的具体用法?Java InfrastructureUtil怎么用?Java InfrastructureUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InfrastructureUtil类属于com.liferay.portal.kernel.util包,在下文中一共展示了InfrastructureUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSession

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
public static Session getSession(boolean cache) {
	Session session = null;

	try {
		session = MailServiceUtil.getSession();
	}
	catch (SystemException se) {
		if (_log.isWarnEnabled()) {
			_log.warn(se, se);
		}

		session = InfrastructureUtil.getMailSession();
	}

	if (_log.isDebugEnabled()) {
		session.setDebug(true);

		session.getProperties().list(System.out);
	}

	return session;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:23,代码来源:MailEngine.java


示例2: runSQL

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
/**
 * Performs an SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) throws SystemException {
	try {
		DataSource dataSource = InfrastructureUtil.getDataSource();

		SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
				sql, new int[0]);

		sqlUpdate.update();
	}
	catch (Exception e) {
		throw new SystemException(e);
	}
}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:19,代码来源:MqttLocalServiceBaseImpl.java


示例3: runSQL

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
/**
 * Performs an SQL query.
 *
 * @param sql the sql query
 */
protected void runSQL(String sql) throws SystemException {
    try {
        DataSource dataSource = InfrastructureUtil.getDataSource();

        SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                sql, new int[0]);

        sqlUpdate.update();
    } catch (Exception e) {
        throw new SystemException(e);
    }
}
 
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:18,代码来源:OGPD_EntityLocalServiceBaseImpl.java


示例4: getUsuariosPorUf

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
/**
 * Retorna os usuários por UF
 * 
 * @param companyId
 *            TODO
 * @param pais
 * 
 * @return
 */
@Transactional(readOnly = true)
public Map<String, Integer> getUsuariosPorUf(long companyId, Country pais) {

	long contactClassId = ClassNameLocalServiceUtil.getClassNameId(Contact.class.getName());
	long classId = pais.getCountryId();

	DataSource dataSource = InfrastructureUtil.getDataSource();
	String sql = "select reg.regionCode, count(*) from User_ u join Contact_ c on u.contactId = c.contactId "
			+ "left outer join "
			+ "Address ad on (c.contactId = ad.classPK and ad.classNameId = ? and ad.countryId = ? and ad.primary_ <> 0) "
			+ "left outer join Region reg on (ad.regionId = reg.regionId) where u.companyId = ? "
			+ "group by reg.regionCode order by reg.regionCode";

	MappingSqlQuery<UsuarioPorEstado> query = MappingSqlQueryFactoryUtil.getMappingSqlQuery(dataSource, sql, new int[] {
			Types.BIGINT, Types.BIGINT, Types.BIGINT }, new RowMapper<UsuarioPorEstado>() {

		@Override
		public UsuarioPorEstado mapRow(ResultSet rs, int rowNumber) throws SQLException {
			String uf = rs.getString(1);
			if (uf == null)
				uf = "N/D";
			return new UsuarioPorEstado(uf, rs.getInt(2));
		}
	});

	Map<String, Integer> retorno = new LinkedHashMap<String, Integer>();
	for (UsuarioPorEstado entrada : query.execute(contactClassId, classId, companyId)) {
		retorno.put(entrada.getUf(), entrada.getNumero());
	}
	return retorno;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:41,代码来源:GraficosLocalServiceImpl.java


示例5: buscaQuantidadePorData

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
private Map<String, Integer> buscaQuantidadePorData(long companyId, TimeZone tz, Date inicio, Date fim, String sql) {
	DataSource dataSource = InfrastructureUtil.getDataSource();

	// Corrige as datas de início e fim
	Calendar cal = Calendar.getInstance(tz);
	cal.setTime(inicio);
	inicio = CalendarUtil.getGTDate(cal);
	cal.setTime(fim);
	fim = CalendarUtil.getLTDate(cal);

	Map<String, Integer> retorno = new LinkedHashMap<String, Integer>();

	MappingSqlQuery<Date> mensagens = MappingSqlQueryFactoryUtil.getMappingSqlQuery(dataSource, sql, new int[] {
			Types.TIMESTAMP, Types.TIMESTAMP, Types.BIGINT }, new RowMapper<Date>() {

		@Override
		public Date mapRow(ResultSet rs, int rowNumber) throws SQLException {
			return rs.getTimestamp(1);
		}
	});

	SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
	sdf.setTimeZone(tz);
	for (Date data : mensagens.execute(inicio, fim, companyId)) {
		String dia = sdf.format(data);
		if (!retorno.containsKey(dia))
			retorno.put(dia, 1);
		else
			retorno.put(dia, retorno.get(dia) + 1);
	}

	return retorno;
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:34,代码来源:GraficosLocalServiceImpl.java


示例6: runSQL

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
/**
 * Performs an SQL query.
 *
 * @param sql the sql query to perform
 */
protected void runSQL(String sql) throws SystemException {
	try {
		DataSource dataSource = InfrastructureUtil.getDataSource();

		SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
				sql, new int[0]);

		sqlUpdate.update();
	}
	catch (Exception e) {
		throw new SystemException(e);
	}
}
 
开发者ID:SmartInfrastructures,项目名称:xipi,代码行数:19,代码来源:InfrastructureServiceBaseImpl.java


示例7: createRunner

import com.liferay.portal.kernel.util.InfrastructureUtil; //导入依赖的package包/类
private QueryRunner createRunner(){
	final DataSource dataSource = InfrastructureUtil.getDataSource();
	return new QueryRunner(dataSource);
}
 
开发者ID:jpenren,项目名称:latch-plugin-liferay,代码行数:5,代码来源:UserLatchRepository.java



注:本文中的com.liferay.portal.kernel.util.InfrastructureUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JobStateProto类代码示例发布时间:2022-05-22
下一篇:
Java EnumMapSerializer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap