掲示板
Liferay 7.0 JSP module hook has no effect
7年前 に Marco Endres によって更新されました。
Liferay 7.0 JSP module hook has no effect
Regular Member 投稿: 112 参加年月日: 12/08/22 最新の投稿
Hello Guys
I tried to overwrite a JSP via Module. The module is deployt but it doesnt take any effect. I try to overwrite the create_account.jsp. My bnd.bnd looks like this:
My Module is synchronized with the server. I use the developper-mode and Liferay 7.0.1 GA2.
The create_account.jsp is under the following path:
/test-module/src/main/resources/META-INF/resources/create_account.jsp
Any ideas why it's not working?
Thanks Marco
I tried to overwrite a JSP via Module. The module is deployt but it doesnt take any effect. I try to overwrite the create_account.jsp. My bnd.bnd looks like this:
Bundle-Version: 1.0.0
Fragment-Host: com.liferay.login.web;bundle-version="1.0.6"
-sources: true
My Module is synchronized with the server. I use the developper-mode and Liferay 7.0.1 GA2.
The create_account.jsp is under the following path:
/test-module/src/main/resources/META-INF/resources/create_account.jsp
Any ideas why it's not working?
Thanks Marco
7年前 に Jamie Sammons によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Expert 投稿: 301 参加年月日: 14/09/05 最新の投稿
Hello Marco,
Try changing your Fragment-Host entry to:
The easiest way to check module versions is to use the Gogo shell by running: telnet 11311 and then lb | grep Login
-Jamie
Try changing your Fragment-Host entry to:
Fragment-Host: com.liferay.login.web;bundle-version="1.0.5"
The easiest way to check module versions is to use the Gogo shell by running: telnet 11311 and then lb | grep Login
-Jamie
7年前 に Marco Endres によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Regular Member 投稿: 112 参加年月日: 12/08/22 最新の投稿
Hallo Jamie
Thank you for your great response. It looks like it's 1.0.5. .
The state of my portlet is installed. I can do the compileJSP taks and it changes to resolved. I think it should be active like all the other modules.
Do i even have to run one of these tasks?
I also can't resolve the variables from the JSP, which are in other JSP-files. As example: PropsValues. Can it be, that there are wrong/missing dependencies in the build.gradle?
i builded the hole project again without IDE and i get the same problem. When i try to deploy it a error happens. But it's still deployt on the server with the state installed.
When i copy the JAR after the blade deploy into the deploy folder, the state changes to resolved.
It's the same problem as here:
http://stackoverflow.com/questions/36157832/deploying-an-osgi-bundle-jsp-hook-in-liferay-7/36180179#36180179
Marco
Thank you for your great response. It looks like it's 1.0.5. .
The state of my portlet is installed. I can do the compileJSP taks and it changes to resolved. I think it should be active like all the other modules.
Do i even have to run one of these tasks?
I also can't resolve the variables from the JSP, which are in other JSP-files. As example: PropsValues. Can it be, that there are wrong/missing dependencies in the build.gradle?
dependencies {
compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compile group: "javax.portlet", name: "portlet-api", version: "2.0"
compile group: "javax.servlet", name: "servlet-api", version: "2.5"
compile group: "jstl", name: "jstl", version: "1.2"
compile group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
}
i builded the hole project again without IDE and i get the same problem. When i try to deploy it a error happens. But it's still deployt on the server with the state installed.
PS C:\DEV\Git\faberplace-workspace\modules\com.clavisit.registration.hook.jsp> blade deploy
:modules:com.clavisit.registration.hook.jsp:compileJava UP-TO-DATE
:modules:com.clavisit.registration.hook.jsp:buildCSS UP-TO-DATE
:modules:com.clavisit.registration.hook.jsp:processResources UP-TO-DATE
:modules:com.clavisit.registration.hook.jsp:transpileJS SKIPPED
:modules:com.clavisit.registration.hook.jsp:configJSModules SKIPPED
:modules:com.clavisit.registration.hook.jsp:classes UP-TO-DATE
:modules:com.clavisit.registration.hook.jsp:jar
:modules:com.clavisit.registration.hook.jsp:assemble
:modules:com.clavisit.registration.hook.jsp:build
BUILD SUCCESSFUL
Total time: 5.486 secs
stop 482
org.osgi.framework.BundleException: Invalid operation on a fragment.
update 482 file:/C:/DEV/Git/faberplace-workspace/modules/com.clavisit.registration.hook.jsp/build/libs/com.clavisit.regi
stration.hook.jsp-1.0.4.jar
Updated bundle 482
start 482
org.osgi.framework.BundleException: Invalid operation on a fragment.
Error
0. [DeployCommand.installOrUpdate] aQute/bnd/header/Parameters
When i copy the JAR after the blade deploy into the deploy folder, the state changes to resolved.
It's the same problem as here:
http://stackoverflow.com/questions/36157832/deploying-an-osgi-bundle-jsp-hook-in-liferay-7/36180179#36180179
Marco
7年前 に Marco Endres によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Regular Member 投稿: 112 参加年月日: 12/08/22 最新の投稿
I tested the hole thing on a Liferay 7.0.0 GA 1.
I found out on a Liferay 7.0.1 GA 2 it doesn't work, but it works on a GA 1. The only thing i changed was the com.liferay.login.web version in the bnd.bnd file from 1.0.5 to 1.0.3.
I found out on a Liferay 7.0.1 GA 2 it doesn't work, but it works on a GA 1. The only thing i changed was the com.liferay.login.web version in the bnd.bnd file from 1.0.5 to 1.0.3.
7年前 に Ravi Darji によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 56 参加年月日: 14/05/14 最新の投稿Marco Endres:
Hallo Jamie
Thank you for your great response. It looks like it's 1.0.5. .
The state of my portlet is installed. I can do the compileJSP taks and it changes to resolved. I think it should be active like all the other modules.
Do i even have to run one of these tasks?
I also can't resolve the variables from the JSP, which are in other JSP-files. As example: PropsValues. Can it be, that there are wrong/missing dependencies in the build.gradle?dependencies { compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0" compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0" compile group: "javax.portlet", name: "portlet-api", version: "2.0" compile group: "javax.servlet", name: "servlet-api", version: "2.5" compile group: "jstl", name: "jstl", version: "1.2" compile group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0" }
i builded the hole project again without IDE and i get the same problem. When i try to deploy it a error happens. But it's still deployt on the server with the state installed.PS C:\DEV\Git\faberplace-workspace\modules\com.clavisit.registration.hook.jsp> blade deploy :modules:com.clavisit.registration.hook.jsp:compileJava UP-TO-DATE :modules:com.clavisit.registration.hook.jsp:buildCSS UP-TO-DATE :modules:com.clavisit.registration.hook.jsp:processResources UP-TO-DATE :modules:com.clavisit.registration.hook.jsp:transpileJS SKIPPED :modules:com.clavisit.registration.hook.jsp:configJSModules SKIPPED :modules:com.clavisit.registration.hook.jsp:classes UP-TO-DATE :modules:com.clavisit.registration.hook.jsp:jar :modules:com.clavisit.registration.hook.jsp:assemble :modules:com.clavisit.registration.hook.jsp:build BUILD SUCCESSFUL Total time: 5.486 secs stop 482 org.osgi.framework.BundleException: Invalid operation on a fragment. update 482 file:/C:/DEV/Git/faberplace-workspace/modules/com.clavisit.registration.hook.jsp/build/libs/com.clavisit.regi stration.hook.jsp-1.0.4.jar Updated bundle 482 start 482 org.osgi.framework.BundleException: Invalid operation on a fragment. Error 0. [DeployCommand.installOrUpdate] aQute/bnd/header/Parameters
When i copy the JAR after the blade deploy into the deploy folder, the state changes to resolved.
It's the same problem as here:
http://stackoverflow.com/questions/36157832/deploying-an-osgi-bundle-jsp-hook-in-liferay-7/36180179#36180179
Marco
Hi Marco,
I am also facing problem same like you.
Did you got any solution? if yes, can you please share?
Regards,
Ravi Darji
7年前 に Mohammad Azharuddin によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿Jamie Sammons:
Hello Marco,
Try changing your Fragment-Host entry to:Fragment-Host: com.liferay.login.web;bundle-version="1.0.5"
The easiest way to check module versions is to use the Gogo shell by running: telnet 11311 and then lb | grep Login
-Jamie
Is there way to check module version in eclipse..? And can you please help me to identify Fragment-Host and bundle-version for different liferay portlets....?
7年前 に Mohammad Azharuddin によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Expert 投稿: 492 参加年月日: 12/09/17 最新の投稿Mohammad Azharuddin:
Jamie Sammons:Hello Marco,
Try changing your Fragment-Host entry to:Fragment-Host: com.liferay.login.web;bundle-version="1.0.5"
The easiest way to check module versions is to use the Gogo shell by running: telnet 11311 and then lb | grep Login
-Jamie
Is there way to check module version in eclipse..? And can you please help me to identify Fragment-Host and bundle-version for different liferay portlets....?
Below is the bnd.bnd of login-web portlet
Bundle-Name: Liferay Login Web
Bundle-SymbolicName: com.liferay.login.web
Bundle-Version: 1.0.6
Liferay-Releng-Module-Group-Description:
Liferay-Releng-Module-Group-Title: So to override login.jsp as in this post do i need to update the bundle version to 1.0.7[Fragment-Host: com.liferay.login.web;bundle-version="1.0.7"] ..?
7年前 に Jamie Sammons によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Expert 投稿: 301 参加年月日: 14/09/05 最新の投稿
Since the version in bnd.bnd is 1.0.6 you would override it with the Fragment bundle with: Fragment-Host: com.liferay.login.web;bundle-version="1.0.6"
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi
I have the same problem ,I tried to overwrite a JSP via Module. The module is deployt but it doesnt take any effect. I try to overwrite the create_account.jsp. My bnd.bnd looks like this:
1Bundle-Version: 1.0.0
2Fragment-Host: com.liferay.login.web;bundle-version="1.0.5"
3-sources: true
My Module is synchronized with the server. I use the developper-mode and Liferay 7.0.1 GA2.
the staus of bundle blade-hook-jsp is "resolved" and it's not like other module "Active".
please help me !!!
I have the same problem ,I tried to overwrite a JSP via Module. The module is deployt but it doesnt take any effect. I try to overwrite the create_account.jsp. My bnd.bnd looks like this:
1Bundle-Version: 1.0.0
2Fragment-Host: com.liferay.login.web;bundle-version="1.0.5"
3-sources: true
My Module is synchronized with the server. I use the developper-mode and Liferay 7.0.1 GA2.
the staus of bundle blade-hook-jsp is "resolved" and it's not like other module "Active".
please help me !!!
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿
Hi sedki jdaida,
If you are using windows, then there is an LPS listed for this LPS-66814.
Regards,
Gaurav
If you are using windows, then there is an LPS listed for this LPS-66814.
Regards,
Gaurav
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi ,
yes i use windows ? exucuse me i don't understand this solution : https://issues.liferay.com/browse/LPS-66814
help me please !
yes i use windows ? exucuse me i don't understand this solution : https://issues.liferay.com/browse/LPS-66814
help me please !
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿sedki jdaida:
i don't understand this solution : https://issues.liferay.com/browse/LPS-66814
If you want to use jsp fragment. You need to use LR Version 7.0.0 CE GA3.
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi,
excume i used liferay 7.0 CE GA3. but the same problem persist the bundle of hook named blade.hook.jsp is "Resolved" and not "Active".
excume i used liferay 7.0 CE GA3. but the same problem persist the bundle of hook named blade.hook.jsp is "Resolved" and not "Active".
添付ファイル:
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿
Hi sedki jdaida,
A fragment is never Active, as it just gets attached with fragment host. So successfully deployed fragment will remain in Resolved status.
If you are using liferay 7.0 CE GA3 on windows your modifications must be displayed on applied jsp.
If no effects are there, check if location of your create_account.jsp is correct or not. This file must be inside blade-hook-jsp/src/main/resources/META-INF/resources/
A fragment is never Active, as it just gets attached with fragment host. So successfully deployed fragment will remain in Resolved status.
If you are using liferay 7.0 CE GA3 on windows your modifications must be displayed on applied jsp.
If no effects are there, check if location of your create_account.jsp is correct or not. This file must be inside blade-hook-jsp/src/main/resources/META-INF/resources/
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi Gaurav Jain,
thanks very mush it work sucesfull , i like to ask you question . i want to overide the page of create account . I don't find the page of create_account in liferay 7.
And thanks for advance.
thanks very mush it work sucesfull , i like to ask you question . i want to overide the page of create account . I don't find the page of create_account in liferay 7.
And thanks for advance.
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿sedki jdaida:
I don't find the page of create_account in liferay 7.
you should either have source(portal-master) of LR7 or you can get it from git hub repository of LR7 create_account.jsp
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi Gaurav Jain,
Thanks very mush for response it's work sucessful.
Thanks very mush for response it's work sucessful.
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi Gaurav Jain,
Thanks for all response
I have one more question
I need to override a "CreateAccountMVCActionCommand" class from my portal code through modules in liferay-7.0.1 GA2. Here provided process of override portal class https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/develop/tutorials/-/knowledge_base/7-0/mvc-actioncommand. I followed this way but i did not get any changes.
see the below steps:
1) I created one new module project with name (create.account)
2)I created one class with the name (CustomCreateAccountMVCActionCommand) in this location "/create.account/src/main/java/com/example/portlet/CustomCreateAccountMVCActionCommand.java"
3)I written code like this in overriden class
package com.example.portlet;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import org.osgi.service.component.annotations.Component;
import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;
/**
* @author Brian Wing Shun Chan
* @author Amos Fong
* @author Daniel Sanz
* @author Sergio González
* @author Peter Fellwock
*/
@Component(
property = {
"javax.portlet.name=com_example_portlet_CreateAccountmvcportletPortlet", -> here i con't understand which portlet name mentioned
and how to give that name
"mvc.command.name=/login/create_account"
},
service = MVCActionCommand.class
)
public class CustomCreateAccountMVCActionCommand extends BaseMVCActionCommand {
protected void addUser(
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
System.out.println("Enter into addUSer method");
}
@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
// TODO Auto-generated method stub
}
}
4) I deployed that module and get build success
5)I copied create.account.jar file from this location "D:\liferayupdatedsetup7\OSGI\bundles\osgi\modules\create.account.jar" and placed in this location "D:\liferayupdatedsetup7\bundles\deploy"
6)I tested that module.
Thanks for all response
I have one more question
I need to override a "CreateAccountMVCActionCommand" class from my portal code through modules in liferay-7.0.1 GA2. Here provided process of override portal class https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/develop/tutorials/-/knowledge_base/7-0/mvc-actioncommand. I followed this way but i did not get any changes.
see the below steps:
1) I created one new module project with name (create.account)
2)I created one class with the name (CustomCreateAccountMVCActionCommand) in this location "/create.account/src/main/java/com/example/portlet/CustomCreateAccountMVCActionCommand.java"
3)I written code like this in overriden class
package com.example.portlet;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import org.osgi.service.component.annotations.Component;
import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;
/**
* @author Brian Wing Shun Chan
* @author Amos Fong
* @author Daniel Sanz
* @author Sergio González
* @author Peter Fellwock
*/
@Component(
property = {
"javax.portlet.name=com_example_portlet_CreateAccountmvcportletPortlet", -> here i con't understand which portlet name mentioned
and how to give that name
"mvc.command.name=/login/create_account"
},
service = MVCActionCommand.class
)
public class CustomCreateAccountMVCActionCommand extends BaseMVCActionCommand {
protected void addUser(
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
System.out.println("Enter into addUSer method");
}
@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
// TODO Auto-generated method stub
}
}
4) I deployed that module and get build success
5)I copied create.account.jar file from this location "D:\liferayupdatedsetup7\OSGI\bundles\osgi\modules\create.account.jar" and placed in this location "D:\liferayupdatedsetup7\bundles\deploy"
6)I tested that module.
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿
Hi sedki jdaida,
You might find a solution at this post.
Go through this post and let me know if it was helpful for you.
Regards,
Gaurav
You might find a solution at this post.
Go through this post and let me know if it was helpful for you.
Regards,
Gaurav
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
HI Gaurav Jain,
i like to add new field in table "user_" with java code and not from the portal (control panel -> configuration->custom field-> add new filed)
in liferay 6.2 i find a class responsible from adding new field witch is "CustomFieldDemo.java".
the code of this class is below :
public class CustomFieldDemo extends MVCPortlet{
@ProcessAction(name="updateUserCustomeField")
public void updateUserCustomeField(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException,
PortletException, PortalException, SystemException {
System.err.println("__________________________!!!updateUserCustomeField________________!!!!!");
ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);
User user = PortalUtil.getUser(actionRequest);
user.setExpandoBridgeAttributes(serviceContext);
UserLocalServiceUtil.updateUser(user);
}
@ProcessAction(name="addUserCustomeField")
public void addUserCustomeField(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException,
PortletException, PortalException, SystemException {
System.err.println("__________________________!!!addUserCustomeField________________!!!!!");
String customField = ParamUtil.getString(actionRequest, "customField","");
User user = PortalUtil.getUser(actionRequest);
user.getExpandoBridge().addAttribute(customField);
}
}
but when i adding this class in module hook and when deplying this module in lifeay 7 there is no effect
so i think that is not the java class responsible from adding new field.
help me to find the class responsible .
i like to add new field in table "user_" with java code and not from the portal (control panel -> configuration->custom field-> add new filed)
in liferay 6.2 i find a class responsible from adding new field witch is "CustomFieldDemo.java".
the code of this class is below :
public class CustomFieldDemo extends MVCPortlet{
@ProcessAction(name="updateUserCustomeField")
public void updateUserCustomeField(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException,
PortletException, PortalException, SystemException {
System.err.println("__________________________!!!updateUserCustomeField________________!!!!!");
ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);
User user = PortalUtil.getUser(actionRequest);
user.setExpandoBridgeAttributes(serviceContext);
UserLocalServiceUtil.updateUser(user);
}
@ProcessAction(name="addUserCustomeField")
public void addUserCustomeField(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException,
PortletException, PortalException, SystemException {
System.err.println("__________________________!!!addUserCustomeField________________!!!!!");
String customField = ParamUtil.getString(actionRequest, "customField","");
User user = PortalUtil.getUser(actionRequest);
user.getExpandoBridge().addAttribute(customField);
}
}
but when i adding this class in module hook and when deplying this module in lifeay 7 there is no effect
so i think that is not the java class responsible from adding new field.
help me to find the class responsible .
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
Hi Gaurav Jain ,
i like to add new column in table user . i go to controle panel --> custom_field -> user --> add new filed after that with update the permission on the filed and check the option update and delete and it's work succefull .
the problem is when i like to add new column in table "expandocloumn" using java code , and liferay 7.
i create a module (bundle ) in order to overide this section in witch i create a class extend the class "SimpleAction"
the code class is like this :
package com.liferay.login.field.custom;
import org.osgi.service.component.annotations.Component;
import com.liferay.expando.kernel.exception.NoSuchTableException;
import com.liferay.expando.kernel.model.ExpandoColumn;
import com.liferay.expando.kernel.model.ExpandoColumnConstants;
import com.liferay.expando.kernel.model.ExpandoTable;
import com.liferay.expando.kernel.model.ExpandoTableConstants;
import com.liferay.expando.kernel.service.ExpandoColumnLocalServiceUtil;
import com.liferay.expando.kernel.service.ExpandoTableLocalServiceUtil;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.LifecycleAction;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.security.auth.CompanyThreadLocal;
@Component(
immediate = true, property = {"key=application.startup.events"},
service = LifecycleAction.class
)
public class CustemFiledsCreations extends SimpleAction {
public void run(String[] ids) throws ActionException {
String columnName = "married";
long companyId = CompanyThreadLocal.getCompanyId(); //or use ids[0]
String className = User.class.getName(); //com.liferay.portal.model.User
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; //CUSTOM_FIELDS . Here you can give any name by Default is CUSTOM_FIELDS
ExpandoTable expandoTable = addExpandoTable(companyId, className, tableName);
if(expandoTable!=null){
addExpandoColumn(companyId, className, tableName, columnName, expandoTable);
}
}
/*
* This method first check that there is expandotable exist with name CUSTOM_FIELDS(for user)
* if present it returns otherwise add the table entry in expandotable
* */
public ExpandoTable addExpandoTable(long companyId,String className,String tableName){
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getDefaultTable(companyId,className);
} catch (NoSuchTableException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId,className, tableName);
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return expandoTable;
}
/*
* This method first check if there is column married in CUSTOM_FIELDS table
* if present it returns otherwise add married column in expandoColumn
* */
public ExpandoColumn addExpandoColumn(long companyId,String className,String tableName,String columnName,ExpandoTable expandoTable){
ExpandoColumn exandoColumn = null;
try {
exandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId, className,tableName,columnName);
if (exandoColumn ==null)
{
exandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(),columnName,ExpandoColumnConstants.BOOLEAN ,false);
}
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
System.out.println("Expando Column==>"+exandoColumn.getColumnId());
return exandoColumn;
}
}
this class normaly create a column named "married".
when i deploy this on server . there is no effect on table "expandocolumn"
if any one have solution please tell me and thanks.
i like to add new column in table user . i go to controle panel --> custom_field -> user --> add new filed after that with update the permission on the filed and check the option update and delete and it's work succefull .
the problem is when i like to add new column in table "expandocloumn" using java code , and liferay 7.
i create a module (bundle ) in order to overide this section in witch i create a class extend the class "SimpleAction"
the code class is like this :
package com.liferay.login.field.custom;
import org.osgi.service.component.annotations.Component;
import com.liferay.expando.kernel.exception.NoSuchTableException;
import com.liferay.expando.kernel.model.ExpandoColumn;
import com.liferay.expando.kernel.model.ExpandoColumnConstants;
import com.liferay.expando.kernel.model.ExpandoTable;
import com.liferay.expando.kernel.model.ExpandoTableConstants;
import com.liferay.expando.kernel.service.ExpandoColumnLocalServiceUtil;
import com.liferay.expando.kernel.service.ExpandoTableLocalServiceUtil;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.events.LifecycleAction;
import com.liferay.portal.kernel.events.SimpleAction;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.security.auth.CompanyThreadLocal;
@Component(
immediate = true, property = {"key=application.startup.events"},
service = LifecycleAction.class
)
public class CustemFiledsCreations extends SimpleAction {
public void run(String[] ids) throws ActionException {
String columnName = "married";
long companyId = CompanyThreadLocal.getCompanyId(); //or use ids[0]
String className = User.class.getName(); //com.liferay.portal.model.User
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; //CUSTOM_FIELDS . Here you can give any name by Default is CUSTOM_FIELDS
ExpandoTable expandoTable = addExpandoTable(companyId, className, tableName);
if(expandoTable!=null){
addExpandoColumn(companyId, className, tableName, columnName, expandoTable);
}
}
/*
* This method first check that there is expandotable exist with name CUSTOM_FIELDS(for user)
* if present it returns otherwise add the table entry in expandotable
* */
public ExpandoTable addExpandoTable(long companyId,String className,String tableName){
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getDefaultTable(companyId,className);
} catch (NoSuchTableException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId,className, tableName);
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return expandoTable;
}
/*
* This method first check if there is column married in CUSTOM_FIELDS table
* if present it returns otherwise add married column in expandoColumn
* */
public ExpandoColumn addExpandoColumn(long companyId,String className,String tableName,String columnName,ExpandoTable expandoTable){
ExpandoColumn exandoColumn = null;
try {
exandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId, className,tableName,columnName);
if (exandoColumn ==null)
{
exandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(),columnName,ExpandoColumnConstants.BOOLEAN ,false);
}
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
System.out.println("Expando Column==>"+exandoColumn.getColumnId());
return exandoColumn;
}
}
this class normaly create a column named "married".
when i deploy this on server . there is no effect on table "expandocolumn"
if any one have solution please tell me and thanks.
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿
Hi sedki jdaida,
I have used your code completely as it is. And it is reflecting in table expandocolumn.
Try debugging your code if it is being even hit or not?
I have used your code completely as it is. And it is reflecting in table expandocolumn.
Try debugging your code if it is being even hit or not?
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
hi Gaurav Jain ,
Thanks i find the problem . it 's not on code it's that the add of column is when the server is app.
when deploying the module you should restart the server.
Thanks i find the problem . it 's not on code it's that the add of column is when the server is app.
when deploying the module you should restart the server.
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
hi Gaurav Jain ,
i have a problem in depoyment. i create a bundle hook action commande in witch i create a classe to add new column in expandoColumn table
this is the class of creating new column in ExpandoColumn
@Component(
immediate = true, property = {"key=application.startup.events"},
service = LifecycleAction.class
)
public class CustemFiledsCreations extends SimpleAction {
public void run(String[] ids) throws ActionException {
String columnName = "personeleeq";
long companyId = CompanyThreadLocal.getCompanyId(); //or use ids[0]
String className = User.class.getName(); //com.liferay.portal.model.User
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; //CUSTOM_FIELDS . Here you can give any name by Default is CUSTOM_FIELDS
ExpandoTable expandoTable = addExpandoTable(companyId, className, tableName);
if(expandoTable!=null){
addExpandoColumn(companyId, className, tableName, columnName, expandoTable);
}
}
public ExpandoTable addExpandoTable(long companyId,String className,String tableName){
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getDefaultTable(companyId,className);
} catch (NoSuchTableException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId,className, tableName);
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return expandoTable;
}
public ExpandoColumn addExpandoColumn(long companyId,String className,String tableName,String columnName,ExpandoTable expandoTable){
ExpandoColumn exandoColumn = null;
try {
exandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId, className,tableName,columnName);
if (exandoColumn ==null)
{
exandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(),columnName,ExpandoColumnConstants.STRING ,"");
setExpandoPermissions(companyId, exandoColumn);
}
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
return exandoColumn;
}
private static void setExpandoPermissions(long companyId, ExpandoColumn column) {
try {
Role guestUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
if (guestUserRole != null) {
// define actions
String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.UPDATE };
// set the permission
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(column.getColumnId()), guestUserRole.getRoleId(), actionIds);
}
} catch (PortalException pe) {
pe.printStackTrace();
}
}
}
when a generate the bundle and deplyed it in liferay . the server does not take effect in the first deployment, by against it to take effect from the second deployment
help me please.
i have a problem in depoyment. i create a bundle hook action commande in witch i create a classe to add new column in expandoColumn table
this is the class of creating new column in ExpandoColumn
@Component(
immediate = true, property = {"key=application.startup.events"},
service = LifecycleAction.class
)
public class CustemFiledsCreations extends SimpleAction {
public void run(String[] ids) throws ActionException {
String columnName = "personeleeq";
long companyId = CompanyThreadLocal.getCompanyId(); //or use ids[0]
String className = User.class.getName(); //com.liferay.portal.model.User
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; //CUSTOM_FIELDS . Here you can give any name by Default is CUSTOM_FIELDS
ExpandoTable expandoTable = addExpandoTable(companyId, className, tableName);
if(expandoTable!=null){
addExpandoColumn(companyId, className, tableName, columnName, expandoTable);
}
}
public ExpandoTable addExpandoTable(long companyId,String className,String tableName){
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getDefaultTable(companyId,className);
} catch (NoSuchTableException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId,className, tableName);
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return expandoTable;
}
public ExpandoColumn addExpandoColumn(long companyId,String className,String tableName,String columnName,ExpandoTable expandoTable){
ExpandoColumn exandoColumn = null;
try {
exandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId, className,tableName,columnName);
if (exandoColumn ==null)
{
exandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(),columnName,ExpandoColumnConstants.STRING ,"");
setExpandoPermissions(companyId, exandoColumn);
}
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
return exandoColumn;
}
private static void setExpandoPermissions(long companyId, ExpandoColumn column) {
try {
Role guestUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
if (guestUserRole != null) {
// define actions
String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.UPDATE };
// set the permission
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(column.getColumnId()), guestUserRole.getRoleId(), actionIds);
}
} catch (PortalException pe) {
pe.printStackTrace();
}
}
}
when a generate the bundle and deplyed it in liferay . the server does not take effect in the first deployment, by against it to take effect from the second deployment
help me please.
7年前 に sedki jdaida によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 25 参加年月日: 16/09/08 最新の投稿
hi Gaurav Jain ,
i have a problem in depoyment. i create a bundle hook action commande in witch i create a classe to add new column in expandoColumn table
this is the class of creating new column in ExpandoColumn
@Component(
immediate = true, property = {"key=application.startup.events"},
service = LifecycleAction.class
)
public class CustemFiledsCreations extends SimpleAction {
public void run(String[] ids) throws ActionException {
String columnName = "personeleeq";
long companyId = CompanyThreadLocal.getCompanyId(); //or use ids[0]
String className = User.class.getName(); //com.liferay.portal.model.User
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; //CUSTOM_FIELDS . Here you can give any name by Default is CUSTOM_FIELDS
ExpandoTable expandoTable = addExpandoTable(companyId, className, tableName);
if(expandoTable!=null){
addExpandoColumn(companyId, className, tableName, columnName, expandoTable);
}
}
public ExpandoTable addExpandoTable(long companyId,String className,String tableName){
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getDefaultTable(companyId,className);
} catch (NoSuchTableException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId,className, tableName);
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return expandoTable;
}
public ExpandoColumn addExpandoColumn(long companyId,String className,String tableName,String columnName,ExpandoTable expandoTable){
ExpandoColumn exandoColumn = null;
try {
exandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId, className,tableName,columnName);
if (exandoColumn ==null)
{
exandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(),columnName,ExpandoColumnConstants.STRING ,"");
setExpandoPermissions(companyId, exandoColumn);
}
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
return exandoColumn;
}
private static void setExpandoPermissions(long companyId, ExpandoColumn column) {
try {
Role guestUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
if (guestUserRole != null) {
// define actions
String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.UPDATE };
// set the permission
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(column.getColumnId()), guestUserRole.getRoleId(), actionIds);
}
} catch (PortalException pe) {
pe.printStackTrace();
}
}
}
when a generate the bundle and deplyed it in liferay . the server does not take effect in the first deployment, by against it to take effect from the second deployment
help me please.
i have a problem in depoyment. i create a bundle hook action commande in witch i create a classe to add new column in expandoColumn table
this is the class of creating new column in ExpandoColumn
@Component(
immediate = true, property = {"key=application.startup.events"},
service = LifecycleAction.class
)
public class CustemFiledsCreations extends SimpleAction {
public void run(String[] ids) throws ActionException {
String columnName = "personeleeq";
long companyId = CompanyThreadLocal.getCompanyId(); //or use ids[0]
String className = User.class.getName(); //com.liferay.portal.model.User
String tableName = ExpandoTableConstants.DEFAULT_TABLE_NAME; //CUSTOM_FIELDS . Here you can give any name by Default is CUSTOM_FIELDS
ExpandoTable expandoTable = addExpandoTable(companyId, className, tableName);
if(expandoTable!=null){
addExpandoColumn(companyId, className, tableName, columnName, expandoTable);
}
}
public ExpandoTable addExpandoTable(long companyId,String className,String tableName){
ExpandoTable expandoTable = null;
try {
expandoTable = ExpandoTableLocalServiceUtil.getDefaultTable(companyId,className);
} catch (NoSuchTableException e) {
try {
expandoTable = ExpandoTableLocalServiceUtil.addTable(companyId,className, tableName);
} catch (Exception e1) {
e1.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
return expandoTable;
}
public ExpandoColumn addExpandoColumn(long companyId,String className,String tableName,String columnName,ExpandoTable expandoTable){
ExpandoColumn exandoColumn = null;
try {
exandoColumn = ExpandoColumnLocalServiceUtil.getColumn(companyId, className,tableName,columnName);
if (exandoColumn ==null)
{
exandoColumn = ExpandoColumnLocalServiceUtil.addColumn(expandoTable.getTableId(),columnName,ExpandoColumnConstants.STRING ,"");
setExpandoPermissions(companyId, exandoColumn);
}
} catch (SystemException | PortalException e) {
e.printStackTrace();
}
return exandoColumn;
}
private static void setExpandoPermissions(long companyId, ExpandoColumn column) {
try {
Role guestUserRole = RoleLocalServiceUtil.getRole(companyId, RoleConstants.GUEST);
if (guestUserRole != null) {
// define actions
String[] actionIds = new String[] { ActionKeys.VIEW, ActionKeys.UPDATE };
// set the permission
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
String.valueOf(column.getColumnId()), guestUserRole.getRoleId(), actionIds);
}
} catch (PortalException pe) {
pe.printStackTrace();
}
}
}
when a generate the bundle and deplyed it in liferay . the server does not take effect in the first deployment, by against it to take effect from the second deployment
help me please.
7年前 に Gaurav Jain によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Junior Member 投稿: 85 参加年月日: 16/07/12 最新の投稿sedki jdaida:
when a generate the bundle and deplyed it in liferay . the server does not take effect in the first deployment, by against it to take effect from the second deployment
Hi sedki jdaida,
Can you specify, if there is any error during build-deploy on console, in the first deployment ?
7年前 に Jamie Sammons によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
Expert 投稿: 301 参加年月日: 14/09/05 最新の投稿
There isn't a way to identify the bundle version in Eclipse at this time. Creating Fragment Bundles should be way easier in Liferay IDE 3.1 once it comes out. For now the easiest way is to still use the console. You can use lb -s which will list the bundles by their module names such as: lb -s | grep com.liferay.login.web
7年前 に Pranav Parmar によって更新されました。
RE: Liferay 7.0 JSP module hook has no effect
New Member 投稿: 10 参加年月日: 16/07/27 最新の投稿
can you provide solution for this ?
https://web.liferay.com/community/forums/-/message_boards/message/77383716
https://web.liferay.com/community/forums/-/message_boards/message/77383716