Fórum
How to add custom settings in control panel's system settings
Gaurav Jain, modificado 6 Anos atrás.
How to add custom settings in control panel's system settings
Junior Member Postagens: 85 Data de Entrada: 12/07/16 Postagens Recentes
Hi Everyone
I have a custom module, which has some settings, I want to keep these settings in Liferay system settings, And want to use them in my custom module. How can this be done.
Thanks in advance.
Gaurav
I have a custom module, which has some settings, I want to keep these settings in Liferay system settings, And want to use them in my custom module. How can this be done.
Thanks in advance.
Gaurav
Gaurav Jain, modificado 6 Anos atrás.
RE: How to add custom settings in control panel's system settings
Junior Member Postagens: 85 Data de Entrada: 12/07/16 Postagens Recentes
Hi everyone,
I am able to move these settings to Liferay System settings. But not able to read those values. For reading the values I am doing following
I also tried
XXXConfiguration class has methods and declarations for Liferay system settings.
I am able to move these settings to Liferay System settings. But not able to read those values. For reading the values I am doing following
ConfigurationProviderUtil.getConfigurationProvider().getCompanyConfiguration(XXXConfiguration.class,
PortalUtil.getDefaultCompanyId());
I also tried
ConfigurationProviderUtil.getCompanyConfiguration(XXXConfiguration.class,
PortalUtil.getDefaultCompanyId());
XXXConfiguration class has methods and declarations for Liferay system settings.
Russell Bohl, modificado 6 Anos atrás.
RE: How to add custom settings in control panel's system settings (Resposta)
Expert Postagens: 291 Data de Entrada: 13/02/13 Postagens Recentes
As a start, have you read this tutorial?
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/making-your-applications-configurable
Along those lines, do you have a MyServiceConfigurationBeanDeclaration class?
And how is your call to getCompanyConfiguration failing? Any exceptions?
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/making-your-applications-configurable
Along those lines, do you have a MyServiceConfigurationBeanDeclaration class?
And how is your call to getCompanyConfiguration failing? Any exceptions?
Gaurav Jain, modificado 6 Anos atrás.
RE: How to add custom settings in control panel's system settings
Junior Member Postagens: 85 Data de Entrada: 12/07/16 Postagens Recentes
Hi Russell Bohl,
Thanks for your reply.
yes, I have.
yes, in following manner
And in my Component class I am trying to access it something like this
No exceptions are there in console or front end but no values are being returned from the configuration object, not even default values of configuration. One more thing configuration is also not null.
Thanks for your reply.
have you read this tutorial?
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/making-your-applications-configurable
yes, I have.
do you have a MyServiceConfigurationBeanDeclaration class?
yes, in following manner
package XXX.configuration.declaration;
import XXX.XXXConfiguration;
import com.liferay.portal.kernel.settings.definition.ConfigurationBeanDeclaration;
public class XXXXConfigurationBeanDeclaration implements ConfigurationBeanDeclaration {
@Override
public Class<!--?--> getConfigurationBeanClass() {
return XXXConfiguration.class;
}
}
And in my Component class I am trying to access it something like this
@Activate
@Modified
protected void activate(Map<string, object> properties) throws SchedulerException {
XXXConfiguration configuration =
_configurationProvider.getCompanyConfiguration(XXXConfiguration.class, PortalUtil.getDefaultCompanyId());
String cronExpression = configuration.cronExpression();
}
@Reference(unbind = "-")
protected void setConfigurationProvider(ConfigurationProvider configurationProvider) {
_configurationProvider = configurationProvider;
}
private ConfigurationProvider _configurationProvider;
</string,>
And how is your call to getCompanyConfiguration failing? Any exceptions?
No exceptions are there in console or front end but no values are being returned from the configuration object, not even default values of configuration. One more thing configuration is also not null.
Gaurav Jain, modificado 6 Anos atrás.
RE: How to add custom settings in control panel's system settings
Junior Member Postagens: 85 Data de Entrada: 12/07/16 Postagens Recentes
Hi Russell Bohl,
I found the thing. I left a small error in my ConfigurationBeanDeclaration class. I did not make it component. After doing this I am able to read the values from system settings.
Thanks
I found the thing. I left a small error in my ConfigurationBeanDeclaration class. I did not make it component. After doing this I am able to read the values from system settings.
Thanks