1、
解壓
liferay-portal-src-
2、
打開
eclipse
,導入
liferay-portal-src-
3、 加入 maven 依賴
4、
在
eclipse
中修改
SpagoBI-src-
<
dependency
>
?????
<
groupId
>
liferay
</
groupId
>
?????
<
artifactId
>
liferay.portal-service
</
artifactId
>
?????
<
version
>
?????
<
scope
>
system
</
scope
>
?????
<
systemPath
>
${liferay.lib.dir}/portal-service.jar
</
systemPath
>
???
</
dependency
>
???
<
dependency
>
?
????
<
groupId
>
liferay
</
groupId
>
?????
<
artifactId
>
liferay.portal-kernel
</
artifactId
>
?????
<
version
>
?????
<
scope
>
system
</
scope
>
?????
<
systemPath
>
${liferay.lib.dir}/portal-kernel.jar
</
systemPath
>
</
dependency
>
???
將
<systemPath
路徑指為
liferay-portal-tomcat-5.5-jdk5-
例如:
<
dependency
>
?????
<
groupId
>
liferay
</
groupId
>
?????
<
artifactId
>
liferay.portal-service
</
artifactId
>
?????
<
version
>
?????
<
scope
>
system
</
scope
>
?????
<
systemPath
>
E:/workspacse_all/liferay-spagobi-
???
</
dependency
>
???
<
dependency
>
?????
<
groupId
>
liferay
</
groupId
>
?????
<
artifactId
>
liferay.portal-kernel
</
artifactId
>
?????
<
version
>
?????
<
scope
>
system
</
scope
>
?????
<
systemPath
>
E:/workspacse_all/liferay-spagobi-
???
</
dependency
>
這樣在
eclipse
保存后,代碼會根據
liferay
5、?
修改代碼
SpagoBI-src-
6、?
修改代碼
SpagoBI-src-
7、?
緊接著修改下面的
userAttributes.put(USER_ID,
user.getUserId());
為
userAttributes.put(USER_ID,
user.getUserId()+"");
修改
liferay-portal-src-
???
?
*
Terry
添加
???
?
*
@param
action
???
?
*
@param
windowState
???
?
*
@param
portletMode
???
?
*
@param
var
???
?
*
@param
varImpl
???
?
*
@param
secure
???
?
*
@param
portletName
???
?
*
@param
anchor
???
?
*
@param
encrypt
???
?
*
@param
doAsUserId
???
?
*
@param
portletConfiguration
???
?
*
@param
params
???
?
*
@param
writeOutput
???
?
*
@param
pageContext
???
?
*
@return
???
?
*
@throws
JspException
???
?
*/
???
public
static
String doEndTag(
??????????
boolean
action, String windowState, String portletMode, String var,
?????????? String varImpl, Boolean secure,
String portletName, Boolean anchor,
?????????? Boolean encrypt, String doAsUserId,
Boolean portletConfiguration,
?????????? Map params,
boolean
writeOutput, PageContext pageContext)
??????
throws
JspException {
??????
try
{
??????????
long
lDoAsUserId = 0;
??????????
if
(
null
!=
doAsUserId && !
""
.equals(doAsUserId)
&& Long.parseLong(doAsUserId)>0) {
?????????????
lDoAsUserId = Long.parseLong(doAsUserId);???????????
?????????? }
??????????
return
doEndTag(action,
windowState, portletMode, var,
????????????????? varImpl, secure, portletName,
anchor,
????????????????? encrypt, lDoAsUserId,
portletConfiguration,
????????????????? params, writeOutput,
pageContext);
?????? }
catch
(Exception e) {
??????????
_log
.error(e,
e);
??????????
throw
new
JspException(e);
?????? }
??????
8、?
}
9、?
到這里
spagobi
部分的代碼就修改完了。
10、?
將
liferay-portal-tomcat-5.5-jdk5-
11、?????????????
在
SpagoBI-src-
12、?????????????
13、?????????????
拷貝
SpagoBI-src-
14、?????????????
拷貝
SpagoBI-src-
15、?????????????
把
liferay-portal-tomcat-5.5-jdk5-
16、?????????????
拷貝
SpagoBI-src-
17、?????????????
修改
liferay-portal-tomcat-5.5-jdk5-
<PARAMETERS>
?????? ??????????? <PARAMETER name="repository_path" value="${SERVER_HOME}/sbidata/jcrRepositoryFS/" />
?????? ??????????? <PARAMETER name="conf_file_path" value="${SERVER_HOME}/sbidata/jcrRepositoryFS/repository.xml" />
?????? ??????? </PARAMETERS>
替換為
<PARAMETERS>
?????? ??????????? <PARAMETER name="repository_path" value="jcrRepositoryFS/" />
?????? ??????????? <PARAMETER name="conf_file_path" value="jcrRepositoryFS/repository.xml" />
?????? ??????? </PARAMETERS>????????
18、?????????????
在
liferay-portal-tomcat-5.5-jdk5-
19、????????????? 在 jcrRepositoryFS 文件夾下建立 repository 文件夾
20、?????????????
拷貝
SpagoBI-src-
21、?????????????
拷貝
SpagoBI-src-
22、?????????????
把
SpagoBI-src-
23、?????????????
啟動
liferay-portal-tomcat-5.5-jdk5-
24、?????????????
啟動
tomcat?? liferay-portal-tomcat-5.5-jdk5-
5.
更改liferay 和sapgoBI的數據庫
Liferay
和sapgoBI默認的數據庫都是內存數據庫HSQL,為了方便開發,我們需要更改為別的數據庫,下面一SQLserver為例來操作。
<
一>.更改liferay的數據庫
<1>.
在liferay官網上下載和所用liferay版本相同的SQL,例如我們現在的liferay版本是
<2>
更改tomcat-liferay
…
.
<Resource
?????? name="jdbc/LiferayPool"
?????? auth="Container"
?????? type="javax.sql.DataSource"
?????? driverClassName="org.hsqldb.jdbcDriver"
?????? url="jdbc:hsqldb:lportal"
?????? username="sa"
?????? password=""
?????? maxActive="20"
??? />
…
.
改為:
<Resource
?????? name="jdbc/LiferayPool"
?????? auth="Container"
?????? type="javax.sql.DataSource"
???????
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
???
???
username="sa"
???
???
password="bbbbb"
???
???
url="jdbc:sqlserver://localhost;DatabaseName=lportal"
???
???
maxActive="20"
??? />
<3>.
把sqljdbc的驅動包,拷貝到tomcat-liferay
<4>liferay
默認的數據庫名稱為lportal,如果需要自定義一個數據庫,那么需要將將上面的數據源名稱修改,還要把liferay-portal-tomcat-5.5-jdk5-
<HIBERNATE-CFGFILE>hibernate.cfg.sqlserver.xml</HIBERNATE-CFGFILE>
換為對應數據庫的hibernate配置文件連接。
下面把<SPAGOBI_CONTEXT_PATH>http://10.16.202.74:8080/spagobi</SPAGOBI_CONTEXT_PATH>修改
到此,liferay
<
二>更換SpagoBI
<1>.
從SpagoBI官網上下載sql,其名稱為:sqlserver-dbscript-
<2>.
解壓后執行其中的SQLServer_create.sql,SQLServer_create_fk.sql,SQLserver_create_quartz_schema.sql和SQLServer_insert.sql,此時就會在本地SQLserver中建立spagoBI
<3>.
修改tomcat-liferay
…
<Resource
???
??
name="jdbc/sbifoodmart"
???
??
auth="Container"
???
??
type="javax.sql.DataSource"
???
??
username="sa"
???
??
password=""
???
??
driverClassName="org.hsqldb.jdbcDriver"
???
??
url="jdbc:hsqldb:hsql://localhost:9001/foodmart"
??? />
…
..
改為:
<Resource
???
??
name="jdbc/sbifoodmart"
???
??
auth="Container"
???
??
type="javax.sql.DataSource"
???
??
username="sa"
???
??
password="bbbbb"
???
??
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
???
??
url="jdbc:sqlserver://localhost;DatabaseName=suggested"
??? />
其余依次類推
…
<4>.
把sqljdbc的驅動包,拷貝到tomcat-liferay
以上就是更換SpagoBI