Application not configurable in system settings

thumbnail
Gerhard Horatschek, modified 5 Years ago. Junior Member Posts: 86 Join Date: 3/20/09 Recent Posts
Hi all,
Our new application is not configurable, despite implementing the MVC portlet like described in the 7.1 documentation, https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/making-applications-configurable.
We made a configuration interface, a bean declaration and configuration category like mentioned in the docu.
But we can not see the an entry in the system settings section "other".
We debugged the portal an saw that the bundle didn't have a categoryPid / pid in the MetaTypeInformation, see
ConfigurationModelRetrieverImpl.collectConfigurationModels()
How this can happen?
Is there a new documentation for 7.2 or do we have to implement someting additionally? We found nothing ...
Does anybody know what's the problem here?
Thank you very much!
Tested with CE 7.2.1 GA2 and DXP 7.2.10 GA1.
Handling of the configuration interface in general works, because the default value is fetched correct in the configuration.jsp of the portlet.

Implementation:
configuration interface:

@ExtendedObjectClassDefinition(
	category = "facility-references", factoryInstanceLabelAttribute = "ddmStructureName",
	scope = ExtendedObjectClassDefinition.Scope.SYSTEM
)
@Meta.OCD(
	factory = true,
	id = "com.company.portal.facility.references.web.configuration.FacilityReferencesConfiguration",
	localization = "content/Language",
	name = "facility-references-web-configuration-name"
)
public interface FacilityReferencesConfiguration {

	@Meta.AD(deflt = "Facility-Reference", name = "ddm-structure-name", required = false)
	String ddmStructureName();

}

bean declaration:

@Component(service = ConfigurationBeanDeclaration.class)
public class FacilityReferencesConfigurationBeanDeclaration implements ConfigurationBeanDeclaration {
     
	@Override
	public Class<!--?--> getConfigurationBeanClass() {
		return FacilityReferencesConfiguration.class;
	}
	
}

configuration category:

@Component(service = ConfigurationCategory.class)
public class FacilityReferencesConfigurationCategory
	implements ConfigurationCategory {

	@Override
	public String getCategoryIcon() {
		return _CATEGORY_ICON;
	}

	@Override
	public String getCategoryKey() {
		return _CATEGORY_KEY;
	}

	@Override
	public String getCategorySection() {
		return _CATEGORY_SECTION;
	}

	private static final String _CATEGORY_ICON = "web-content";

	private static final String _CATEGORY_KEY = "facility-references";

	private static final String _CATEGORY_SECTION = "other";

}


configuration form renderer:

@Component(immediate = true, service = ConfigurationFormRenderer.class)
public class FacilityReferencesConfigurationFormRenderer
    implements ConfigurationFormRenderer {

    @Override
    public String getPid() {
        return "com.company.portal.facility.references.web.configuration.FacilityReferencesConfiguration";
    }

    @Override
    public void render(HttpServletRequest request, HttpServletResponse response)
            throws IOException {
            
        String formHtml = "<input name="\&quot;ddmStructureName\&quot;">";

        PrintWriter writer = response.getWriter();

        writer.print(formHtml);

    }

    @Override
    public Map<string, object> getRequestParameters(
            HttpServletRequest request) {

        Map<string, object> params = new HashMap&lt;&gt;();

        String ddmStructureName = ParamUtil.getString(request, "ddmStructureName");

        params.put("ddmStructureName", ddmStructureName);

        return params;
    }
}
</string,></string,>


portlet:

@Component(
	configurationPid = "com.company.portal.facility.references.web.configuration.FacilityReferencesConfiguration",
	immediate = true,
	property = {
		"com.liferay.portlet.display-category=category.applications",
		"com.liferay.portlet.header-portlet-css=/css/main.css",
		"com.liferay.portlet.instanceable=true",
		"javax.portlet.display-name=FacilityReferences",
		"javax.portlet.init-param.template-path=/",
		"javax.portlet.init-param.view-template=/view.jsp",
		"javax.portlet.name=" + FacilityReferencesPortletKeys.FACILITYREFERENCES,
		"javax.portlet.resource-bundle=content.Language",
		"javax.portlet.security-role-ref=power-user,user"
	},
	service = Portlet.class
)
public class FacilityReferencesPortlet extends MVCPortlet {

	@Activate
	@Modified
	protected void activate(Map<object, object> properties) throws Exception {
		configuration = ConfigurableUtil.createConfigurable(FacilityReferencesConfiguration.class, properties);
	}
</object,>
thumbnail
Gerhard Horatschek, modified 5 Years ago. Junior Member Posts: 86 Join Date: 3/20/09 Recent Posts
Hi Olaf,
thank you for the quick answer.
But for me your application doesn't work, the portal doesn't show any entry in the "other" section.I also tried to add a configuration form renderer like mentioned in a sub-chapter of the docu (https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/customizing-the-system-settings-user-interface
), but with no success.
I think we will just need the configuration interface , bean declaration and the configuration category , right? Or do we need configuration form renderer or a display context?
Which version of 7.2 do you use? We tested it with CE 7.2.1 GA2 and DXP 7.2.10 GA1.
I added the code of the configuration form renderer and the portlet in the original post.
Thank you.
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Now that you say this: I might have changed some settings a while ago - there was some info about changes in a library that I can't remember any more.
My Liferay Workspace's settings.gradle is this (check your versions):
buildscript {
    dependencies {
        classpath group: "com.liferay", name: "com.liferay.gradle.plugins.workspace", version: "2.1.5"
        classpath group: "net.saliman", name: "gradle-properties-plugin", version: "1.4.6"
    }
    repositories {
        maven {
            url "https://repository-cdn.liferay.com/nexus/content/groups/public"
        }
    }
}
apply plugin: "net.saliman.properties"
apply plugin: "com.liferay.workspace"
thumbnail
Gerhard Horatschek, modified 5 Years ago. Junior Member Posts: 86 Join Date: 3/20/09 Recent Posts
Hi Olaf,

like mentioned in my first reply, it works now on the local instance.

But we have problems now during the build (already on the clean task of the hello world portlet) on the stages, see following log:

Running in /home/sysadmin/workspace/int/liferay-portal
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] sh
+ chmod 755 gradlew
[Pipeline] sh
+ ./gradlew clean
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':modules:hello-portlet'.
Extension of type 'LiferayExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension]

For both ways we use the same gradle version: https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip

Do you have an idea?

Thank you!
thumbnail
Gerhard Horatschek, modified 5 Years ago. Junior Member Posts: 86 Join Date: 3/20/09 Recent Posts
Hi Olaf,
Thanks a lot!
Switching com.liferay.gradle.plugins.workspace to 2.1.5 was the key. Now it works.
Maybe a short hint of this dependency in the docu would be useful for other developers.
Thanks again