Forums de discussion
Overriding Portal class through modules in liferay 7 is possible or not ?
lokesh gorrela, modifié il y a 7 années.
Overriding Portal class through modules in liferay 7 is possible or not ?
Regular Member Publications: 173 Date d'inscription: 09/03/16 Publications récentes
Hi Guys,
Overriding Portal class through modules in liferay 7 is possible or not ?
If it is possible, Could you please tell the process.
Thanks
Regards
Lokesh
Overriding Portal class through modules in liferay 7 is possible or not ?
If it is possible, Could you please tell the process.
Thanks
Regards
Lokesh
David H Nebinger, modifié il y a 7 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
Liferay Legend Publications: 14918 Date d'inscription: 02/09/06 Publications récentes
Which class?
lokesh gorrela, modifié il y a 7 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
Regular Member Publications: 173 Date d'inscription: 09/03/16 Publications récentes
Hello David H Nebinge
Thanks for your replay
I try to override "CreateAccountMVCActionCommand.java" class from below location.
D:\liferayupdatedsetup7\portal\modules\apps\foundation\login\login-web\src\main\java\com\liferay\login\web\portlet\actio\CreateAccountMVCActionCommand.java
Thanks
Regards
Lokesh
Thanks for your replay
I try to override "CreateAccountMVCActionCommand.java" class from below location.
D:\liferayupdatedsetup7\portal\modules\apps\foundation\login\login-web\src\main\java\com\liferay\login\web\portlet\actio\CreateAccountMVCActionCommand.java
Thanks
Regards
Lokesh
lokesh gorrela, modifié il y a 7 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
Regular Member Publications: 173 Date d'inscription: 09/03/16 Publications récentes
Hello David H Nebinge
I followed below process to overriden "CreateAccountMVCActionCommand.java" class through modules in liferay 7
1)I created new module project with name (blade.custom.account)
2)After that i created new class with name(CustomCreateAccountMVCActionCommand.java) in this location
/blade.custom.account/src/main/java/com/example/portlet/CustomCreateAccountMVCActionCommand.java
see the below code
3)After that i deployed this module by using gradle tool in liferay IDE
4)I get the build successful
5)copy jar file from this location "D:\liferayupdatedsetup7\OSGI\bundles\osgi\modules\blade.custom.account.jar" and placed to this location "D:\liferayupdatedsetup7\bundles\deploy"
6)After that i tested this functionality,but this class is not overriden existing class.
Could you please tell the correct process.This is greate help to me.
Thanks
Regards
Lokesh
I followed below process to overriden "CreateAccountMVCActionCommand.java" class through modules in liferay 7
1)I created new module project with name (blade.custom.account)
2)After that i created new class with name(CustomCreateAccountMVCActionCommand.java) in this location
/blade.custom.account/src/main/java/com/example/portlet/CustomCreateAccountMVCActionCommand.java
see the below code
package com.example.portlet;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;
@Component(
property = {
"javax.portlet.name=com_liferay_login_web_portlet_FastLoginPortlet",
"javax.portlet.name=com_liferay_login_web_portlet_LoginPortlet",
"mvc.command.name=/login/create_account",
"service.ranking:Integer=100"
},
service = MVCActionCommand.class)
public class CustomCreateAccountMVCActionCommand extends BaseMVCActionCommand {
@Reference(target =
"(&(mvc.command.name=/login/create_account)(javax.portlet.name= + LoginPortletKeys.LOGIN + ”))")
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
System.out.println("Enter into doProcessAction method");
}
}
3)After that i deployed this module by using gradle tool in liferay IDE
4)I get the build successful
5)copy jar file from this location "D:\liferayupdatedsetup7\OSGI\bundles\osgi\modules\blade.custom.account.jar" and placed to this location "D:\liferayupdatedsetup7\bundles\deploy"
6)After that i tested this functionality,but this class is not overriden existing class.
Could you please tell the correct process.This is greate help to me.
Thanks
Regards
Lokesh
Carlos Gonzalez, modifié il y a 7 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
New Member Publications: 9 Date d'inscription: 03/03/11 Publications récentes
This works fine, I tried the same with the calendar portlet and does not work, when I add the annotation @Reference stops working (does not run the code), but if I remove the annotation @reference (and mvcActionCommand variable) everything works properly.
This is my code:
This is my code:
@Component(
immediate = true, property = {
"javax.portlet.name=com_liferay_calendar_web_portlet_CalendarPortlet",
"mvc.command.name=updateFormCalendarBooking",
},
service = MVCActionCommand.class)
public class CustomCalendarMVCActionCommand extends BaseMVCActionCommand {
@Reference(target = "(&(mvc.command.name=updateFormCalendarBooking)"
+ "(javax.portlet.name=com_liferay_calendar_web_portlet_CalendarPortlet))")
public void setMvcActionCommand(MVCActionCommand mvcActionCommand) {
this.mvcActionCommand = mvcActionCommand;
}
public MVCActionCommand getMvcActionCommand() {
return this.mvcActionCommand;
}
protected MVCActionCommand mvcActionCommand;
@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
if (_log.isInfoEnabled()) {
_log.info("Update Calendar Booking");
}
getMvcActionCommand().processAction(actionRequest, actionResponse);
}
}
Kailash Yadav, modifié il y a 7 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
Regular Member Publications: 211 Date d'inscription: 18/10/11 Publications récentes
Hello Carlos Gonzalez, did you find any solution of it. I am facing same issue.
Carlos Gonzalez:
This works fine, I tried the same with the calendar portlet and does not work, when I add the annotation @Reference stops working (does not run the code), but if I remove the annotation @reference (and mvcActionCommand variable) everything works properly.
This is my code:@Component( immediate = true, property = { "javax.portlet.name=com_liferay_calendar_web_portlet_CalendarPortlet", "mvc.command.name=updateFormCalendarBooking", }, service = MVCActionCommand.class) public class CustomCalendarMVCActionCommand extends BaseMVCActionCommand { @Reference(target = "(&(mvc.command.name=updateFormCalendarBooking)" + "(javax.portlet.name=com_liferay_calendar_web_portlet_CalendarPortlet))") public void setMvcActionCommand(MVCActionCommand mvcActionCommand) { this.mvcActionCommand = mvcActionCommand; } public MVCActionCommand getMvcActionCommand() { return this.mvcActionCommand; } protected MVCActionCommand mvcActionCommand; @Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { if (_log.isInfoEnabled()) { _log.info("Update Calendar Booking"); } getMvcActionCommand().processAction(actionRequest, actionResponse); } }
luiz sergio resende ferreira, modifié il y a 7 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
New Member Publications: 11 Date d'inscription: 09/03/17 Publications récentes
I have the same issue
https://web.liferay.com/pt/community/forums/-/message_boards/message/88197849
https://web.liferay.com/pt/community/forums/-/message_boards/message/88197849
Daniele Zirpoli, modifié il y a 6 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
New Member Publications: 2 Date d'inscription: 12/07/17 Publications récentes
Hi| I am facing same issue. Anyone find any solution of it?
Carlos Gonzalez:
This works fine, I tried the same with the calendar portlet and does not work, when I add the annotation @Reference stops working (does not run the code), but if I remove the annotation @reference (and mvcActionCommand variable) everything works properly.
This is my code:@Component( immediate = true, property = { "javax.portlet.name=com_liferay_calendar_web_portlet_CalendarPortlet", "mvc.command.name=updateFormCalendarBooking", }, service = MVCActionCommand.class) public class CustomCalendarMVCActionCommand extends BaseMVCActionCommand { @Reference(target = "(&(mvc.command.name=updateFormCalendarBooking)" + "(javax.portlet.name=com_liferay_calendar_web_portlet_CalendarPortlet))") public void setMvcActionCommand(MVCActionCommand mvcActionCommand) { this.mvcActionCommand = mvcActionCommand; } public MVCActionCommand getMvcActionCommand() { return this.mvcActionCommand; } protected MVCActionCommand mvcActionCommand; @Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { if (_log.isInfoEnabled()) { _log.info("Update Calendar Booking"); } getMvcActionCommand().processAction(actionRequest, actionResponse); } }
paul shah, modifié il y a 6 années.
RE: Overriding Portal class through modules in liferay 7 is possible or not
New Member Publications: 4 Date d'inscription: 24/08/17 Publications récentes
it's due to not mentioned service.integer
@Component(
immediate = true,
property = {
"javax.portlet.name=com_liferay_calendar_web_internal_portlet_CalendarPortlet",
"mvc.command.name=updateFormCalendarBooking",
"service.ranking:Integer=1800"
},
service = MVCActionCommand.class
)
@Component(
immediate = true,
property = {
"javax.portlet.name=com_liferay_calendar_web_internal_portlet_CalendarPortlet",
"mvc.command.name=updateFormCalendarBooking",
"service.ranking:Integer=1800"
},
service = MVCActionCommand.class
)