当前位置: 首页>>代码示例>>Java>>正文


Java IContext.getSession方法代码示例

本文整理汇总了Java中com.mendix.systemwideinterfaces.core.IContext.getSession方法的典型用法代码示例。如果您正苦于以下问题:Java IContext.getSession方法的具体用法?Java IContext.getSession怎么用?Java IContext.getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mendix.systemwideinterfaces.core.IContext的用法示例。


在下文中一共展示了IContext.getSession方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: messageArrived

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
@Override
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
    try {
        logger.info(String.format("messageArrived: %s, %s, %s", topic, new String(mqttMessage.getPayload()), client.getClientId()));
        IContext ctx = Core.createSystemContext();
        ISession session = ctx.getSession();
        MqttSubscription subscription = getSubscriptionForTopic(topic);
        if (subscription != null) {
            String microflow = subscription.getOnMessageMicroflow();
            logger.info(String.format("Calling onMessage microflow: %s, %s", microflow, client.getClientId()));
            final ImmutableMap map = ImmutableMap.of("Topic", topic, "Payload", new String(mqttMessage.getPayload()));
            logger.info("Parameter map: " + map);
            //Core.execute(ctx, microflow, true, map);
            Core.executeAsync(ctx, microflow, true, map);
        } else {
            logger.error(String.format("Cannot find microflow for message received on topic %s", topic));
        }
    } catch (Exception e) {
        logger.error(e);
    }
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:22,代码来源:MxMqttCallback.java

示例2: getSessionTimeZone

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
public static TimeZone getSessionTimeZone( IContext context ) {
	ISession session = context.getSession();
	if ( session != null ) {
		TimeZone timeZone = session.getTimeZone();
		if ( timeZone != null )
			return timeZone;
		return getUTCTimeZone();
	}
	return getUTCTimeZone();
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:11,代码来源:DataParser.java

示例3: getSessionTimeZone

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
public static TimeZone getSessionTimeZone(IContext context) {
	ISession session = context.getSession();
	if (session != null) {
		TimeZone timeZone = session.getTimeZone();
		if (timeZone != null) {
			return timeZone;
		}
		return getUTCTimeZone();
	}
	return getUTCTimeZone();
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:12,代码来源:RedisConnector.java

示例4: runMicroflowInBackground

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
public static Boolean runMicroflowInBackground(final IContext context, final String microflowName,
		final IMendixObject paramObject)
{
	final ISession session = context.getSession();
	
	if (paramObject != null)
		session.retain(paramObject);
		
	MFSerialExecutor.instance().execute(new Runnable() {

		@Override
		public void run()
		{
			try
			{
				IContext c = Core.createSystemContext();
				if (paramObject != null) {
						Core.executeAsync(c, microflowName, true, paramObject).get(); //MWE: somehow, it only works with system context... well thats OK for now.						
				}
				else
					Core.executeAsync(c, microflowName, true, new HashMap<String,Object>()).get(); //MWE: somehow, it only works with system context... well thats OK for now.
			}
			catch (Exception e)
			{
				throw new RuntimeException("Failed to run Async: "+ microflowName + ": " + e.getMessage(), e);
			}
			
			finally {
				if (paramObject != null)
					session.release(paramObject.getId());
			}
		}
		
	});
	return true;
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:37,代码来源:Misc.java


注:本文中的com.mendix.systemwideinterfaces.core.IContext.getSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。