IDEMPIERE-2740 Webservice without session causing no changelog

This commit is contained in:
sauljabin 2015-07-27 15:34:56 -05:00
parent fad1e4e34b
commit f419cad4f8
1 changed files with 13 additions and 0 deletions

View File

@ -17,9 +17,11 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Properties;
import java.util.UUID;
import java.util.logging.Level;
import org.adempiere.util.ServerContext;
import org.compiere.model.MSession;
import org.compiere.model.MUser;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
@ -135,6 +137,7 @@ public class CompiereService {
{
if (m_connected)
{
Env.logout();
ServerContext.dispose();
m_ctx = null;
m_loggedin = false;
@ -274,6 +277,16 @@ public class CompiereService {
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
Env.setContext(m_ctx, Env.LANGUAGE, m_language.getAD_Language());
// Create session
MSession session = MSession.get (getCtx(), false);
if (session == null){
log.fine("No Session found");
session = MSession.get (getCtx(), true);
}
session.setWebSession(UUID.randomUUID().toString());
session.setDescription(session.getDescription() + " WebService" );
session.saveEx();
m_loggedin = true;
return true;
}