IDEMPIERE-2740 Webservice without session causing no changelog
This commit is contained in:
parent
fad1e4e34b
commit
f419cad4f8
|
@ -17,9 +17,11 @@ import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.util.ServerContext;
|
import org.adempiere.util.ServerContext;
|
||||||
|
import org.compiere.model.MSession;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -135,6 +137,7 @@ public class CompiereService {
|
||||||
{
|
{
|
||||||
if (m_connected)
|
if (m_connected)
|
||||||
{
|
{
|
||||||
|
Env.logout();
|
||||||
ServerContext.dispose();
|
ServerContext.dispose();
|
||||||
m_ctx = null;
|
m_ctx = null;
|
||||||
m_loggedin = false;
|
m_loggedin = false;
|
||||||
|
@ -274,6 +277,16 @@ public class CompiereService {
|
||||||
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
|
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
|
||||||
Env.setContext(m_ctx, Env.LANGUAGE, m_language.getAD_Language());
|
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;
|
m_loggedin = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue