Foren

Liferay 7.0 JSP module hook has no effect

thumbnail
Marco Endres, geändert vor 7 Jahren.

Liferay 7.0 JSP module hook has no effect

Regular Member Beiträge: 112 Beitrittsdatum: 22.08.12 Neueste Beiträge
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:

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
thumbnail
Jamie Sammons, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Expert Beiträge: 297 Beitrittsdatum: 05.09.14 Neueste Beiträge
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
thumbnail
Marco Endres, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Regular Member Beiträge: 112 Beitrittsdatum: 22.08.12 Neueste Beiträge
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
thumbnail
Marco Endres, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Regular Member Beiträge: 112 Beitrittsdatum: 22.08.12 Neueste Beiträge
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.
thumbnail
Ravi Darji, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 56 Beitrittsdatum: 14.05.14 Neueste Beiträge
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
thumbnail
Mohammad Azharuddin, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Expert Beiträge: 492 Beitrittsdatum: 17.09.12 Neueste Beiträge
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....?
thumbnail
Mohammad Azharuddin, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Expert Beiträge: 492 Beitrittsdatum: 17.09.12 Neueste Beiträge
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"] ..?
thumbnail
Jamie Sammons, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Expert Beiträge: 297 Beitrittsdatum: 05.09.14 Neueste Beiträge
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"
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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 !!!
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
Hi sedki jdaida,

If you are using windows, then there is an LPS listed for this LPS-66814.


Regards,
Gaurav
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
Hi ,
yes i use windows ? exucuse me i don't understand this solution : https://issues.liferay.com/browse/LPS-66814

help me please !
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
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.
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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".
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
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/
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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.
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
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
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
Hi Gaurav Jain,
Thanks very mush for response it's work sucessful.
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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.
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
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
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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 .
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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.
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
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?
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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.

emoticon
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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.
sedki jdaida, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 25 Beitrittsdatum: 08.09.16 Neueste Beiträge
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.
thumbnail
Gaurav Jain, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Junior Member Beiträge: 85 Beitrittsdatum: 12.07.16 Neueste Beiträge
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 ?
thumbnail
Jamie Sammons, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

Expert Beiträge: 297 Beitrittsdatum: 05.09.14 Neueste Beiträge
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
Pranav Parmar, geändert vor 7 Jahren.

RE: Liferay 7.0 JSP module hook has no effect

New Member Beiträge: 10 Beitrittsdatum: 27.07.16 Neueste Beiträge
can you provide solution for this ?

https://web.liferay.com/community/forums/-/message_boards/message/77383716