本文整理汇总了Java中com.mendix.systemwideinterfaces.core.ISession类的典型用法代码示例。如果您正苦于以下问题:Java ISession类的具体用法?Java ISession怎么用?Java ISession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISession类属于com.mendix.systemwideinterfaces.core包,在下文中一共展示了ISession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: messageArrived
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的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: getContextFor
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
public static IContext getContextFor(IContext context, String username, boolean sudoContext) {
if (username == null || username.isEmpty()) {
throw new RuntimeException("Assertion: No username provided");
}
ISession session = getSessionFor(context, username);
IContext c = session.createContext();
if (sudoContext) {
return c.getSudoContext();
}
return c;
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:15,代码来源:Misc.java
示例3: getSessionFor
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
private static ISession getSessionFor(IContext context, String username) {
ISession session = Core.getActiveSession(username);
if (session == null) {
IContext newContext = context.getSession().createContext().getSudoContext();
newContext.startTransaction();
try {
session = initializeSessionForUser(newContext, username);
} catch (CoreException e) {
newContext.rollbackTransAction();
throw new RuntimeException("Failed to initialize session for user: " + username + ": " + e.getMessage(), e);
} finally {
newContext.endTransaction();
}
}
return session;
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:20,代码来源:Misc.java
示例4: executeAction
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
ISession session = getContext().getSession();
IContext newContext = session.createContext();
Core.commit(newContext, mxObject);
newContext.endTransaction();
return true;
// END USER CODE
}
开发者ID:ako,项目名称:MqttClient,代码行数:12,代码来源:commitInSeparateDatabaseTransaction.java
示例5: getContextFor
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
public static IContext getContextFor(IContext context, String username, boolean sudoContext) {
if (username == null || username.isEmpty()) {
throw new RuntimeException("Assertion: No username provided");
}
if (username.equals(context.getSession().getUser().getName()))
{
return context;
}
else
{
ISession session = getSessionFor(context, username);
IContext c = session.createContext();
if (sudoContext) {
return c.getSudoContext();
}
return c;
}
}
开发者ID:joelvdgraaf,项目名称:OQLMapper,代码行数:22,代码来源:Misc.java
示例6: getContextFor
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
public static IContext getContextFor(IContext context, String username, boolean sudoContext) {
if (username == null || username.isEmpty()) {
throw new RuntimeException("Assertion: No username provided");
}
// Session does not have a user when it's a scheduled event.
if (context.getSession().getUser() != null && username.equals(context.getSession().getUser().getName()))
{
return context;
}
else
{
ISession session = getSessionFor(context, username);
IContext c = session.createContext();
if (sudoContext) {
return c.createSudoClone();
}
return c;
}
}
开发者ID:mendix,项目名称:RestServices,代码行数:23,代码来源:Misc.java
示例7: getSessionFor
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
private static ISession getSessionFor(IContext context, String username) {
ISession session = Core.getActiveSession(username);
if (session == null) {
IContext newContext = context.getSession().createContext().createSudoClone();
newContext.startTransaction();
try {
session = initializeSessionForUser(newContext, username);
} catch (CoreException e) {
newContext.rollbackTransAction();
throw new RuntimeException("Failed to initialize session for user: " + username + ": " + e.getMessage(), e);
} finally {
newContext.endTransaction();
}
}
return session;
}
开发者ID:mendix,项目名称:RestServices,代码行数:20,代码来源:Misc.java
示例8: getSessionTimeZone
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的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
示例9: getSessionTimeZone
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的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
示例10: initializeSessionForUser
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
private static ISession initializeSessionForUser(IContext context, String username) throws CoreException {
IUser user = Core.getUser(context, username);
if (user == null) {
throw new RuntimeException("Assertion: user with username '" + username + "' does not exist");
}
return Core.initializeSession(user, null);
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:10,代码来源:Misc.java
示例11: runMicroflowInBackground
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的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
示例12: executeAction
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
@Override
public Boolean executeAction() throws Exception
{
// BEGIN USER CODE
ISession session = getContext().getSession();
IContext newContext = session.createContext();
Core.commit(newContext, mxObject);
newContext.endTransaction();
return true;
// END USER CODE
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:12,代码来源:commitInSeparateDatabaseTransaction.java
示例13: sessionIsActive
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
private static boolean sessionIsActive(ISession session)
{
for (ISession s : Core.getActiveSessions())
if (s.equals(session))
return true;
return false;
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:8,代码来源:ORM.java
示例14: releaseOldLocks
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
public synchronized static void releaseOldLocks()
{
Set<ISession> activeSessions = new HashSet<ISession>(Core.getActiveSessions()); //Lookup with Ord(log(n)) instead of Ord(n).
List<Long> tbrm = new ArrayList<Long>();
for (Entry<Long, ISession> lock : locks.entrySet())
if (!activeSessions.contains(lock.getValue()))
tbrm.add(lock.getKey());
for(Long key : tbrm)
locks.remove(key);
}
开发者ID:appronto,项目名称:RedisConnector,代码行数:13,代码来源:ORM.java
示例15: getFingerPrint
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
public static String getFingerPrint(ISession session)
{
String agent = session.getUserAgent();
if (agent != null)
return base64Encode(agent.getBytes());
return "";
}
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:10,代码来源:OpenIDUtils.java
示例16: login
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
private void login(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception {
String continuation = req.getParameter(CONTINUATION_PARAM);
detectContinuationJsInjection(continuation);
//special case 1: already a valid session, do not bother with a new login
ISession session = this.getSessionFromRequest(req);
if (session != null && !session.getUser().isAnonymous()) {
//Logout old session and initialize new session. This will allow for role changes to take effect.
String userId = session.getUser().getName();
lockOpenID(userId);
try {
loginHandler.onCompleteLogin(userId, continuation, req, resp);
Core.logout(session);
} finally {
unlockOpenID(userId);
}
} else if (!started) {
//special case 2: no OpenID provider discovered
LOG.warn("OpenId handler is in state 'NOT STARTED'. Falling back to default login.html");
redirect(resp, FALLBACK_LOGINPAGE);
} else {
LOG.debug("Incoming login request, redirecting to OpenID provider");
AuthRequest authReq = manager.authenticate(discovered, OPENID_RETURN_URL);
authReq.setImmediate("true".equalsIgnoreCase(req.getParameter(IMMEDIATE_PARAM)));
String url = authReq.getDestinationUrl(true);
//MWE: publish the url which can be used to sign off
if (SINGLESIGNOFF_ENABLED)
url += "&mxid2.logoffcallback=" + OpenIDUtils.urlEncode(OPENID_LOGOFF_URL);
if (continuation != null)
url += "&mxid2.continuation=" + OpenIDUtils.urlEncode(continuation);
redirect(resp, url);
}
}
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:40,代码来源:OpenIDHandler.java
示例17: logoff
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
private void logoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws CoreException {
if (SINGLESIGNOFF_ENABLED) {
resp.addCookie(getSessionCookieName(), "", "/", "", 0, true);
resp.addCookie(SessionInitializer.XASID_COOKIE, "", "/", "", 0, true);
resp.setStatus(IMxRuntimeResponse.SEE_OTHER);
resp.addHeader("location", OPENID_PROVIDER + "/../" + LOGOFF);
} else {
ISession ses = this.getSessionFromRequest(req);
if (ses != null) {
Core.logout(ses);
}
redirect(resp, INDEX_PAGE);
}
}
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:15,代码来源:OpenIDHandler.java
示例18: executeAction
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
Collection<? extends ISession> activeSessions = Core.getActiveSessions();
for (ISession session : activeSessions) {
if(session.getUser() != null && session.getUser().getName().equals(openId)) {
Core.logout(session);
}
}
return true;
// END USER CODE
}
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:14,代码来源:LogOutUser.java
示例19: executeAction
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
ISession session = getContext().getSession();
IContext newContext = session.createContext();
Core.delete(newContext, objectList);
newContext.endTransaction();
return true;
// END USER CODE
}
开发者ID:ako,项目名称:MqttClient,代码行数:12,代码来源:deleteInSeparateTransaction.java
示例20: getSessionTimeZone
import com.mendix.systemwideinterfaces.core.ISession; //导入依赖的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:joelvdgraaf,项目名称:OQLMapper,代码行数:11,代码来源:DataParser.java
注:本文中的com.mendix.systemwideinterfaces.core.ISession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论