Adempiere 3.1.2
This commit is contained in:
parent
64eca30fca
commit
43c7859095
|
|
@ -31,6 +31,10 @@ public class AdRedirector extends HttpServletCM
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Get request
|
* Process the HTTP Get request
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
|
|
@ -52,6 +56,10 @@ public class AdRedirector extends HttpServletCM
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Post request
|
* Process the HTTP Post request
|
||||||
* to simplify we reuse the doGet functionality
|
* to simplify we reuse the doGet functionality
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,8 @@ public class Broadcast extends HttpServletCM
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
StringBuffer output = new StringBuffer ();
|
StringBuffer output = new StringBuffer ();
|
||||||
// Check whether internalMediaURL is build up, otherwise create it. (can
|
// We will reset the Media URL for each request. Should be moved in the session.
|
||||||
// be started only from a servlet!)
|
resetInternalMediaURL (request);
|
||||||
if (getInternalMediaURL () == null)
|
|
||||||
setInternalMediaURL (request);
|
|
||||||
if (configLoaded && !fatalError)
|
if (configLoaded && !fatalError)
|
||||||
{
|
{
|
||||||
String acceptLanguage = request.getHeader ("Accept-Language");
|
String acceptLanguage = request.getHeader ("Accept-Language");
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class Community extends HttpServletCM
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
|
|
||||||
Properties ctx = getCtx();
|
ctx = getCtx();
|
||||||
|
|
||||||
if (sess.getAttribute ("ctx")!=null)
|
if (sess.getAttribute ("ctx")!=null)
|
||||||
ctx = (Properties) sess.getAttribute ("ctx");
|
ctx = (Properties) sess.getAttribute ("ctx");
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,9 @@ public abstract class Extend implements Serializable
|
||||||
private String e_redirectURL;
|
private String e_redirectURL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend
|
* Extend
|
||||||
* @param request
|
* @param request
|
||||||
|
* @param t_ctx
|
||||||
*/
|
*/
|
||||||
public Extend (HttpServletRequest request, Properties t_ctx) {
|
public Extend (HttpServletRequest request, Properties t_ctx) {
|
||||||
ctx = t_ctx;
|
ctx = t_ctx;
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ public class HttpServletCM extends HttpServlet
|
||||||
* page deployment) the normal broadcaster will replace this URL with the
|
* page deployment) the normal broadcaster will replace this URL with the
|
||||||
* correct media server for this client
|
* correct media server for this client
|
||||||
*/
|
*/
|
||||||
protected static String internalMediaURL = null;
|
protected String internalMediaURL = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String containing the external media URL
|
* String containing the external media URL
|
||||||
|
|
@ -307,17 +307,14 @@ public class HttpServletCM extends HttpServlet
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
*/
|
*/
|
||||||
public void setInternalMediaURL (HttpServletRequest request)
|
public void resetInternalMediaURL (HttpServletRequest request)
|
||||||
{
|
{
|
||||||
if (internalMediaURL == null)
|
internalMediaURL = request.getRequestURL ().toString ().substring (
|
||||||
{
|
0,
|
||||||
internalMediaURL = request.getRequestURL ().toString ().substring (
|
request.getRequestURL ().toString ().indexOf (
|
||||||
0,
|
request.getServerName ())
|
||||||
request.getRequestURL ().toString ().indexOf (
|
+ request.getServerName ().length ())
|
||||||
request.getServerName ())
|
+ request.getContextPath () + "/media/";
|
||||||
+ request.getServerName ().length ())
|
|
||||||
+ request.getContextPath () + "/media/";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Compiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
@ -39,6 +39,10 @@ public class MediaBroadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Get request
|
* Process the HTTP Get request
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
|
|
@ -113,7 +117,11 @@ public class MediaBroadcast extends HttpServletCM
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the HTTP Post request
|
* Process the HTTP Post request
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.compiere.cm.request.Request;
|
import org.compiere.cm.request.Request;
|
||||||
import org.compiere.util.CLogger;
|
|
||||||
import org.compiere.util.WebEnv;
|
import org.compiere.util.WebEnv;
|
||||||
import org.compiere.util.WebSessionCtx;
|
import org.compiere.util.WebSessionCtx;
|
||||||
import org.compiere.util.WebUtil;
|
import org.compiere.util.WebUtil;
|
||||||
|
|
@ -36,8 +35,8 @@ import org.compiere.util.WebUtil;
|
||||||
* @version $Id: RequestServlet.java,v 1.1 2006/10/11 06:30:11 comdivision Exp $
|
* @version $Id: RequestServlet.java,v 1.1 2006/10/11 06:30:11 comdivision Exp $
|
||||||
*/
|
*/
|
||||||
public class RequestServlet extends HttpServletCM {
|
public class RequestServlet extends HttpServletCM {
|
||||||
/** Logging */
|
/** serialVersionUID */
|
||||||
private CLogger log = CLogger.getCLogger(getClass());
|
private static final long serialVersionUID = 6979583935052312291L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Get Request
|
* Process Get Request
|
||||||
|
|
@ -53,7 +52,7 @@ public class RequestServlet extends HttpServletCM {
|
||||||
HttpSession sess = request.getSession (true);
|
HttpSession sess = request.getSession (true);
|
||||||
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
sess.setMaxInactiveInterval (WebEnv.TIMEOUT);
|
||||||
|
|
||||||
Properties ctx = getCtx();
|
ctx = getCtx();
|
||||||
|
|
||||||
if (sess.getAttribute ("ctx")!=null)
|
if (sess.getAttribute ("ctx")!=null)
|
||||||
ctx = (Properties) sess.getAttribute ("ctx");
|
ctx = (Properties) sess.getAttribute ("ctx");
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,9 @@
|
||||||
package org.compiere.cm;
|
package org.compiere.cm;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.http.*;
|
import javax.servlet.http.*;
|
||||||
import org.compiere.Adempiere;
|
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import org.compiere.model.*;
|
|
||||||
import org.compiere.cm.utils.*;
|
import org.compiere.cm.utils.*;
|
||||||
import org.compiere.cm.xml.*;
|
import org.compiere.cm.xml.*;
|
||||||
|
|
||||||
|
|
@ -35,6 +32,9 @@ import org.compiere.cm.xml.*;
|
||||||
public class StageBroadcast extends HttpServletCM
|
public class StageBroadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** serialVersionUID */
|
||||||
|
private static final long serialVersionUID = 7348394433516908807L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Get Request
|
* Handle Get Request
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,9 @@ import org.compiere.cm.xml.Generator;
|
||||||
*/
|
*/
|
||||||
public class XMLBroadcast extends HttpServletCM
|
public class XMLBroadcast extends HttpServletCM
|
||||||
{
|
{
|
||||||
|
/** serialVersionUID */
|
||||||
|
private static final long serialVersionUID = -1280320974132533949L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get
|
* Get
|
||||||
* @param request
|
* @param request
|
||||||
|
|
@ -43,8 +46,7 @@ public class XMLBroadcast extends HttpServletCM
|
||||||
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
RequestAnalyzer thisRequest = new RequestAnalyzer (this, request,
|
||||||
false, "/xml");
|
false, "/xml");
|
||||||
// Even if we will only display the XML tree we are forced to build the Media URLs
|
// Even if we will only display the XML tree we are forced to build the Media URLs
|
||||||
if (getInternalMediaURL () == null)
|
resetInternalMediaURL (request);
|
||||||
setInternalMediaURL (request);
|
|
||||||
if (externalMediaURL == null) {
|
if (externalMediaURL == null) {
|
||||||
if (thisRequest.getWebProject()!=null)
|
if (thisRequest.getWebProject()!=null)
|
||||||
externalMediaURL = getExternalMediaURL (thisRequest
|
externalMediaURL = getExternalMediaURL (thisRequest
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package org.compiere.cm.cache;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.compiere.model.*;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -38,17 +37,33 @@ public class CO {
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger(this.getClass());
|
protected CLogger log = CLogger.getCLogger(this.getClass());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Object
|
||||||
|
*/
|
||||||
public CO () {
|
public CO () {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set Context
|
||||||
|
* @param thisCtx
|
||||||
|
*/
|
||||||
public void setCtx(Properties thisCtx) {
|
public void setCtx(Properties thisCtx) {
|
||||||
ctx = thisCtx;
|
ctx = thisCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get Context
|
||||||
|
* @return Context
|
||||||
|
*/
|
||||||
public Properties getCtx() {
|
public Properties getCtx() {
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* put
|
||||||
|
* @param ID
|
||||||
|
* @param thisObject
|
||||||
|
*/
|
||||||
public void put(String ID, Object thisObject) {
|
public void put(String ID, Object thisObject) {
|
||||||
cache.put(ID,thisObject);
|
cache.put(ID,thisObject);
|
||||||
Long thisLong = new Long(new Date().getTime());
|
Long thisLong = new Long(new Date().getTime());
|
||||||
|
|
@ -58,15 +73,27 @@ public class CO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* remove
|
||||||
|
* @param ID
|
||||||
|
*/
|
||||||
public void remove(String ID) {
|
public void remove(String ID) {
|
||||||
cache.remove(ID);
|
cache.remove(ID);
|
||||||
cacheUsage.remove(ID);
|
cacheUsage.remove(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getSize of current cache
|
||||||
|
* @return number of cache entries
|
||||||
|
*/
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return cache.size();
|
return cache.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get key enumeration
|
||||||
|
* @return key enumeration
|
||||||
|
*/
|
||||||
public Enumeration getKeys() {
|
public Enumeration getKeys() {
|
||||||
return cache.keys();
|
return cache.keys();
|
||||||
}
|
}
|
||||||
|
|
@ -108,17 +135,37 @@ public class CO {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Usage value for cache optimization
|
||||||
|
* @param ID
|
||||||
|
*/
|
||||||
|
public void use(int ID) {
|
||||||
|
Long thisLong = new Long(new java.util.Date().getTime());
|
||||||
|
cacheUsage.put("" + ID, thisLong);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Usage value for cache optimization
|
||||||
|
* @param ID
|
||||||
|
*/
|
||||||
public void use(String ID) {
|
public void use(String ID) {
|
||||||
Long thisLong = new Long(new java.util.Date().getTime());
|
Long thisLong = new Long(new java.util.Date().getTime());
|
||||||
cacheUsage.put(ID, thisLong);
|
cacheUsage.put(ID, thisLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* empty complete Cache
|
||||||
|
*/
|
||||||
public void empty() {
|
public void empty() {
|
||||||
cache = new Hashtable(cacheSize);
|
cache = new Hashtable(cacheSize);
|
||||||
cacheUsage = new Hashtable(cacheSize);
|
cacheUsage = new Hashtable(cacheSize);
|
||||||
log.fine("Cache: " + this.getClass().getName() + " was cleared.");
|
log.fine("Cache: " + this.getClass().getName() + " was cleared.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show Cache Content
|
||||||
|
* @return XML String with CacheContent
|
||||||
|
*/
|
||||||
public String show() {
|
public String show() {
|
||||||
StringBuffer tStrHTML = new StringBuffer();
|
StringBuffer tStrHTML = new StringBuffer();
|
||||||
Enumeration thisEnum = null;
|
Enumeration thisEnum = null;
|
||||||
|
|
|
||||||
|
|
@ -17,27 +17,43 @@
|
||||||
package org.compiere.cm.cache;
|
package org.compiere.cm.cache;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.compiere.model.X_CM_Chat;
|
import org.compiere.model.MChat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chat Cache Object
|
||||||
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
public class Chat extends CO {
|
public class Chat extends CO {
|
||||||
|
|
||||||
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
||||||
|
|
||||||
public X_CM_Chat getCM_Chat(int ID) {
|
/**
|
||||||
|
* getCM_Chat
|
||||||
|
* @param ID
|
||||||
|
* @return Chat
|
||||||
|
*/
|
||||||
|
public MChat getCM_Chat(int ID) {
|
||||||
return getCM_Chat(""+ ID);
|
return getCM_Chat(""+ ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public X_CM_Chat getCM_Chat(String ID) {
|
/**
|
||||||
|
* getCM_Chat
|
||||||
|
* @param ID
|
||||||
|
* @return Chat
|
||||||
|
*/
|
||||||
|
public MChat getCM_Chat(String ID) {
|
||||||
if (cache.containsKey(ID)) {
|
if (cache.containsKey(ID)) {
|
||||||
use(ID);
|
use(ID);
|
||||||
return (X_CM_Chat) cache.get(ID);
|
return (MChat) cache.get(ID);
|
||||||
} else {
|
} else {
|
||||||
int[] tableKeys = X_CM_Chat.getAllIDs("CM_Chat", "CM_Chat_ID=" + ID, "WebCM");
|
int[] tableKeys = MChat.getAllIDs("CM_Chat", "CM_Chat_ID=" + ID, "WebCM");
|
||||||
if (tableKeys.length==0) {
|
if (tableKeys.length==0) {
|
||||||
// No Chat entry
|
// No Chat entry
|
||||||
return null;
|
return null;
|
||||||
} else if (tableKeys.length==1) {
|
} else if (tableKeys.length==1) {
|
||||||
X_CM_Chat thisChat = new X_CM_Chat(ctx, tableKeys[0], "WebCM");
|
MChat thisChat = new MChat(ctx, tableKeys[0], "WebCM");
|
||||||
put ("" + thisChat.get_ID(),thisChat);
|
put ("" + thisChat.get_ID(),thisChat);
|
||||||
return thisChat;
|
return thisChat;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ public class Container extends CO {
|
||||||
* @param CM_WebProject_ID Web Project
|
* @param CM_WebProject_ID Web Project
|
||||||
* @return Container
|
* @return Container
|
||||||
*/
|
*/
|
||||||
public MContainer getCM_Container(int ID, int CM_WebProject_ID) {
|
public MContainer getCM_Container(String ID, int CM_WebProject_ID) {
|
||||||
return getCM_Container(""+ ID, CM_WebProject_ID);
|
return getCM_Container(Integer.parseInt(ID), CM_WebProject_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,22 +45,21 @@ public class Container extends CO {
|
||||||
* @param CM_WebProject_ID Web Project
|
* @param CM_WebProject_ID Web Project
|
||||||
* @return Container
|
* @return Container
|
||||||
*/
|
*/
|
||||||
public MContainer getCM_Container(String ID, int CM_WebProject_ID) {
|
public MContainer getCM_Container(int ID, int CM_WebProject_ID) {
|
||||||
if (cache.containsKey(ID)) {
|
if (cache.containsKey(ID)) {
|
||||||
use(ID);
|
use(ID);
|
||||||
return (MContainer) cache.get(ID);
|
return (MContainer) cache.get(ID);
|
||||||
} else {
|
} else {
|
||||||
int[] tableKeys = MContainer.getAllIDs("CM_Container", "CM_Container_ID=" + ID + " AND CM_WebProject_ID=" + CM_WebProject_ID, "WebCM");
|
MContainer thisContainer = MContainer.get(ctx, ID, CM_WebProject_ID, "WebCM");
|
||||||
if (tableKeys.length==0) {
|
if (thisContainer==null)
|
||||||
|
{
|
||||||
return getCM_ContainerByURL("/error404.html", CM_WebProject_ID, true);
|
return getCM_ContainerByURL("/error404.html", CM_WebProject_ID, true);
|
||||||
} else if (tableKeys.length==1) {
|
}
|
||||||
MContainer thisContainer = new MContainer(ctx, tableKeys[0], "WebCM");
|
else
|
||||||
|
{
|
||||||
put ("" + thisContainer.getCM_Container_ID(),thisContainer);
|
put ("" + thisContainer.getCM_Container_ID(),thisContainer);
|
||||||
cacheContainerURL.put (CM_WebProject_ID + "-" + thisContainer.getRelativeURL(),"" + thisContainer.getCM_Container_ID());
|
cacheContainerURL.put (CM_WebProject_ID + "-" + thisContainer.getRelativeURL(),"" + thisContainer.getCM_Container_ID());
|
||||||
return thisContainer;
|
return thisContainer;
|
||||||
} else {
|
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,6 +68,7 @@ public class Container extends CO {
|
||||||
* Get Container from cache by URL
|
* Get Container from cache by URL
|
||||||
* @param URL URL to look for
|
* @param URL URL to look for
|
||||||
* @param CM_WebProject_ID Web Project
|
* @param CM_WebProject_ID Web Project
|
||||||
|
* @param resolveURLErrors
|
||||||
* @return Container
|
* @return Container
|
||||||
*/
|
*/
|
||||||
public MContainer getCM_ContainerByURL(String URL, int CM_WebProject_ID, boolean resolveURLErrors) {
|
public MContainer getCM_ContainerByURL(String URL, int CM_WebProject_ID, boolean resolveURLErrors) {
|
||||||
|
|
@ -82,8 +82,8 @@ public class Container extends CO {
|
||||||
return thisContainer;
|
return thisContainer;
|
||||||
} else {
|
} else {
|
||||||
// Let's try to find the URL...
|
// Let's try to find the URL...
|
||||||
int[] tableKeys = MContainer.getAllIDs("CM_Container", "(RelativeURL LIKE '" + URL + "' OR RelativeURL LIKE '" + URL + "/') AND CM_WebProject_ID=" + CM_WebProject_ID, "WebCM");
|
MContainer thisContainer = MContainer.get (ctx, URL, CM_WebProject_ID, "WebCM");
|
||||||
if (tableKeys==null || tableKeys.length==0) {
|
if (thisContainer==null) {
|
||||||
if (resolveURLErrors) {
|
if (resolveURLErrors) {
|
||||||
if (URL.equals("/error404.html")) {
|
if (URL.equals("/error404.html")) {
|
||||||
// Okay we are already been requested as the error message, so we try the index.html
|
// Okay we are already been requested as the error message, so we try the index.html
|
||||||
|
|
@ -98,16 +98,12 @@ public class Container extends CO {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (tableKeys.length==1) {
|
} else {
|
||||||
// Found exactly one record, so we return it
|
// Found exactly one record, so we return it
|
||||||
MContainer thisContainer = getCM_Container("" + tableKeys[0], CM_WebProject_ID);
|
|
||||||
if (thisContainer.isSummary ()) {
|
if (thisContainer.isSummary ()) {
|
||||||
thisContainer = getCM_ContainerByURL(URL + "/index.html", CM_WebProject_ID, resolveURLErrors);
|
thisContainer = getCM_ContainerByURL(URL + "/index.html", CM_WebProject_ID, resolveURLErrors);
|
||||||
}
|
}
|
||||||
return thisContainer;
|
return thisContainer;
|
||||||
} else {
|
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,29 +16,43 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.cm.cache;
|
package org.compiere.cm.cache;
|
||||||
|
|
||||||
import org.compiere.model.X_CM_Container_Element;
|
import org.compiere.model.MContainerElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container Element Cache
|
||||||
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
public class ContainerElement extends CO {
|
public class ContainerElement extends CO {
|
||||||
public X_CM_Container_Element getCM_Container_Element(int ID, int CM_WebProject_ID) {
|
/**
|
||||||
return getCM_Container_Element(""+ ID, CM_WebProject_ID);
|
* getCM_Container_Element
|
||||||
|
* @param ID
|
||||||
|
* @param CM_WebProject_ID
|
||||||
|
* @return Container Element
|
||||||
|
*/
|
||||||
|
public MContainerElement getCM_Container_Element(String ID, int CM_WebProject_ID) {
|
||||||
|
return getCM_Container_Element(Integer.parseInt(ID), CM_WebProject_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public X_CM_Container_Element getCM_Container_Element(String ID, int CM_WebProject_ID) {
|
/**
|
||||||
|
* getCM_Container_Element
|
||||||
|
* @param ID
|
||||||
|
* @param CM_WebProject_ID
|
||||||
|
* @return Container Element
|
||||||
|
*/
|
||||||
|
public MContainerElement getCM_Container_Element(int ID, int CM_WebProject_ID) {
|
||||||
if (cache.containsKey(ID)) {
|
if (cache.containsKey(ID)) {
|
||||||
use(ID);
|
use(ID);
|
||||||
return (X_CM_Container_Element) cache.get(ID);
|
return (MContainerElement) cache.get(ID);
|
||||||
} else {
|
} else {
|
||||||
int[] tableKeys = X_CM_Container_Element.getAllIDs("CM_Container_Element", "CM_Container_Element_ID=" + ID, "WebCM");
|
MContainerElement thisContainerElement = MContainerElement.get(ctx, ID, "WebCM");
|
||||||
if (tableKeys==null || tableKeys.length==0) {
|
if (thisContainerElement==null) {
|
||||||
// No Elements in DB found, needs to get handled
|
// No Elements in DB found, needs to get handled
|
||||||
return null;
|
return null;
|
||||||
} else if (tableKeys.length==1) {
|
} else {
|
||||||
X_CM_Container_Element thisContainerElement = new X_CM_Container_Element(ctx, tableKeys[0], "WebCM");
|
|
||||||
put ("" + thisContainerElement.get_ID(),thisContainerElement);
|
put ("" + thisContainerElement.get_ID(),thisContainerElement);
|
||||||
return thisContainerElement;
|
return thisContainerElement;
|
||||||
} else {
|
|
||||||
// More than one result, this is funny, normally this is not possible :-/
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,23 @@ import java.util.*;
|
||||||
import org.compiere.cm.utils.TreeXML;
|
import org.compiere.cm.utils.TreeXML;
|
||||||
import org.compiere.model.MWebProject;
|
import org.compiere.model.MWebProject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container Tree Cache
|
||||||
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
public class ContainerTree extends CO {
|
public class ContainerTree extends CO {
|
||||||
|
|
||||||
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
protected Hashtable cacheContainerURL = new Hashtable(cacheSize);
|
||||||
|
|
||||||
public StringBuffer getContainerTree(Properties ctx, int ID, String trxName) {
|
/**
|
||||||
|
* getContainerTree
|
||||||
|
* @param ID
|
||||||
|
* @param trxName
|
||||||
|
* @return XML StringBuffer
|
||||||
|
*/
|
||||||
|
public StringBuffer getContainerTree(int ID, String trxName) {
|
||||||
StringBuffer xmlCode = new StringBuffer();
|
StringBuffer xmlCode = new StringBuffer();
|
||||||
if (cache.containsKey("" + ID)) {
|
if (cache.containsKey("" + ID)) {
|
||||||
use("" + ID);
|
use("" + ID);
|
||||||
|
|
|
||||||
|
|
@ -38,47 +38,17 @@ public class Domain extends CO
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int[] tableKeys = MWebProjectDomain.getAllIDs (
|
MWebProjectDomain thisWebProjectDomain = MWebProjectDomain.get(ctx, serverName, "WebCM");
|
||||||
"CM_WebProject_Domain",
|
if (thisWebProjectDomain==null)
|
||||||
"lower(FQDN) LIKE '" + serverName + "'", "WebCM");
|
|
||||||
if (tableKeys==null || tableKeys.length == 0)
|
|
||||||
{
|
{
|
||||||
// HardCoded to deliver the GardenWorld Site as default
|
// HardCoded to deliver the GardenWorld Site as default
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (tableKeys.length == 1)
|
|
||||||
{
|
|
||||||
MWebProjectDomain thisDomain = new MWebProjectDomain (
|
|
||||||
ctx, tableKeys[0], "WebCM");
|
|
||||||
put (thisDomain.getFQDN (), thisDomain);
|
|
||||||
return thisDomain;
|
|
||||||
}
|
|
||||||
// We found more than one hit, this is bad, so we will try to use the first non system / gardenworld one
|
|
||||||
else if (tableKeys.length>1)
|
|
||||||
{
|
|
||||||
for (int i=0;i<tableKeys.length;i++) {
|
|
||||||
if (tableKeys[i]>=1000000) {
|
|
||||||
MWebProjectDomain thisDomain = new MWebProjectDomain (
|
|
||||||
ctx, tableKeys[i], "WebCM");
|
|
||||||
put (thisDomain.getFQDN (), thisDomain);
|
|
||||||
return thisDomain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// We can't find any non system/gardenworld hit, so we will try the first one
|
|
||||||
for (int i=0;i<tableKeys.length;i++) {
|
|
||||||
MWebProjectDomain thisDomain = new MWebProjectDomain (
|
|
||||||
ctx, tableKeys[0], "WebCM");
|
|
||||||
put (thisDomain.getFQDN (), thisDomain);
|
|
||||||
return thisDomain;
|
|
||||||
}
|
|
||||||
// As even this doesn't work we return null
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return null;
|
put (thisWebProjectDomain.getFQDN (), thisWebProjectDomain);
|
||||||
|
return thisWebProjectDomain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // getWebProjectDomain
|
} // getWebProjectDomain
|
||||||
|
|
||||||
} // Domain
|
} // Domain
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,24 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.compiere.cm.*;
|
import org.compiere.cm.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache Object Service classes
|
||||||
|
*
|
||||||
|
* @author Yves Sandfort
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
public class Service extends HttpServletCM {
|
public class Service extends HttpServletCM {
|
||||||
|
/** serialVersionUID */
|
||||||
|
private static final long serialVersionUID = 167843885331587478L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doGet
|
||||||
|
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @throws ServletException
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException
|
throws ServletException, IOException
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,9 @@ import java.sql.SQLException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
|
||||||
|
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.cm.HttpServletCM;
|
import org.compiere.cm.HttpServletCM;
|
||||||
|
|
@ -111,7 +107,7 @@ public class Generator
|
||||||
private void generateSystemHeader (HttpServletCM thisServlet)
|
private void generateSystemHeader (HttpServletCM thisServlet)
|
||||||
{
|
{
|
||||||
xmlCode.append ("<system>\n");
|
xmlCode.append ("<system>\n");
|
||||||
xmlCode.append ("<adempiere>\n");
|
xmlCode.append ("<compiere>\n");
|
||||||
xmlCode.append ("<mainversion>" + Adempiere.MAIN_VERSION
|
xmlCode.append ("<mainversion>" + Adempiere.MAIN_VERSION
|
||||||
+ "</mainversion>\n");
|
+ "</mainversion>\n");
|
||||||
xmlCode.append ("<dateversion>" + Adempiere.DATE_VERSION
|
xmlCode.append ("<dateversion>" + Adempiere.DATE_VERSION
|
||||||
|
|
@ -238,7 +234,7 @@ public class Generator
|
||||||
//genTable("AD_Role", "AD_Role.IsActive='Y' AND AD_Role.AD_Client_ID=" + l_nClientID + " ORDER BY AD_Role.AD_Role_ID", false, ctx, wi);
|
//genTable("AD_Role", "AD_Role.IsActive='Y' AND AD_Role.AD_Client_ID=" + l_nClientID + " ORDER BY AD_Role.AD_Role_ID", false, ctx, wi);
|
||||||
genTable("C_Activity", "C_Activity.IsActive='Y' AND C_Activity.AD_Client_ID=" + l_nClientID + " ORDER BY C_Activity.C_Activity_ID", false, ctx, wi);
|
genTable("C_Activity", "C_Activity.IsActive='Y' AND C_Activity.AD_Client_ID=" + l_nClientID + " ORDER BY C_Activity.C_Activity_ID", false, ctx, wi);
|
||||||
genTable("C_Campaign", "C_Campaign.IsActive='Y' AND C_Campaign.AD_Client_ID=" + l_nClientID + " ORDER BY C_Campaign.C_Campaign_ID", false, ctx, wi);
|
genTable("C_Campaign", "C_Campaign.IsActive='Y' AND C_Campaign.AD_Client_ID=" + l_nClientID + " ORDER BY C_Campaign.C_Campaign_ID", false, ctx, wi);
|
||||||
genTable("M_Product", "M_Product.IsActive='Y' AND M_Product.AD_Client_ID=" + l_nClientID + " ORDER BY M_Product.M_Product_ID", false, ctx, wi);
|
genTable("M_Product", "M_Product.IsActive='Y' AND M_Product.AD_Client_ID=" + l_nClientID + " AND M_Product.Value like 'cd_%' ORDER BY M_Product.M_Product_ID", false, ctx, wi);
|
||||||
genTable("M_RMA", "M_RMA.IsActive='Y' AND M_RMA.AD_Client_ID=" + l_nClientID + " ORDER BY M_RMA.M_RMA_ID", false, ctx, wi);
|
genTable("M_RMA", "M_RMA.IsActive='Y' AND M_RMA.AD_Client_ID=" + l_nClientID + " ORDER BY M_RMA.M_RMA_ID", false, ctx, wi);
|
||||||
genTable("R_Category", "R_Category.IsActive='Y' AND R_Category.AD_Client_ID=" + l_nClientID + " ORDER BY R_Category.R_Category_ID", false, ctx, wi);
|
genTable("R_Category", "R_Category.IsActive='Y' AND R_Category.AD_Client_ID=" + l_nClientID + " ORDER BY R_Category.R_Category_ID", false, ctx, wi);
|
||||||
genTable("R_Group", "R_Group.IsActive='Y' AND R_Group.AD_Client_ID=" + l_nClientID + " ORDER BY R_Group.R_Group_ID", false, ctx, wi);
|
genTable("R_Group", "R_Group.IsActive='Y' AND R_Group.AD_Client_ID=" + l_nClientID + " ORDER BY R_Group.R_Group_ID", false, ctx, wi);
|
||||||
|
|
@ -465,8 +461,10 @@ public class Generator
|
||||||
|
|
||||||
private void generateContainerTree (ContainerTree containerTreeCache)
|
private void generateContainerTree (ContainerTree containerTreeCache)
|
||||||
{
|
{
|
||||||
xmlCode.append (containerTreeCache.getContainerTree (containerTreeCache
|
/* xmlCode.append (containerTreeCache.getContainerTree (containerTreeCache
|
||||||
.getCtx (), thisRequest.getWebProject ().get_ID (), null));
|
.getCtx (), thisRequest.getWebProject ().get_ID (), null));*/
|
||||||
|
xmlCode.append (containerTreeCache.getContainerTree (
|
||||||
|
thisRequest.getWebProject ().get_ID (), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue