Skip to content

Commit

Permalink
QA-15345: Handle merges of static definitions from fieldsets for prim…
Browse files Browse the repository at this point in the history
…ary node type and mixins correctly. (#1768)

* QA-15345: Handle merges of static definitions from fieldsets for primary node type and mixins correctly.

* QA-15345: rollback plugin

* QA-15345: Fix issues with Resource bundle key resolution across the board

* QA-15345: Add new test to validate overrides are working as expected in Content Editor

* QA-15345: fix linting

* Add clean-up revisions

---------

Co-authored-by: Geofrey Flores <gflores@jahia.com>
  • Loading branch information
cedmail and gflores-jahia authored Nov 5, 2024
1 parent 5474c82 commit 3cfa47c
Show file tree
Hide file tree
Showing 19 changed files with 477 additions and 39 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<jahia-module-type>system</jahia-module-type>
<yarn.arguments>build:production</yarn.arguments>
<require-capability>osgi.extender;filter:="(osgi.extender=org.jahia.bundles.blueprint.extender.config)"</require-capability>
<jahia-module-signature>MCwCFD/TCIKGNSSOq8Iga3EphH2K/YE0AhQQMkqhiwmB8gZTgPTeIc7Hlkwe4Q==</jahia-module-signature>
<jahia-module-signature>MCwCFGsdFRDbyfvw/0eW/dPJf4Gc0KalAhQ/Vjq83ruUpHoFeVlkhyoA7R5m7Q==</jahia-module-signature>
<jahia-depends>app-shell=2.7,graphql-dxm-provider=2.19.1,jcontent=2.9</jahia-depends>
<jahia.plugin.version>6.9</jahia.plugin.version>
<import-package>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.jahia.modules.contenteditor.api.forms;

import graphql.annotations.annotationTypes.GraphQLField;
import org.jahia.services.content.nodetypes.ExtendedNodeType;
import org.jahia.services.content.nodetypes.NodeTypeRegistry;
import org.osgi.framework.Bundle;
Expand Down Expand Up @@ -55,6 +56,7 @@ public EditorFormDefinition(String nodeType, Double priority, Boolean hasPreview
this.hasPreview = hasPreview;
}

@GraphQLField
public String getNodeType() {
return nodeType;
}
Expand All @@ -63,6 +65,7 @@ public void setNodeType(String nodeType) {
this.nodeType = nodeType;
}

@GraphQLField
public Double getPriority() {
return priority;
}
Expand All @@ -71,6 +74,7 @@ public void setPriority(Double priority) {
this.priority = priority;
}

@GraphQLField
public Boolean hasPreview() {
return hasPreview;
}
Expand All @@ -79,6 +83,7 @@ public void setHasPreview(Boolean hasPreview) {
this.hasPreview = hasPreview;
}

@GraphQLField
public List<EditorFormSectionDefinition> getSections() {
return sections;
}
Expand All @@ -87,6 +92,11 @@ public void setSections(List<EditorFormSectionDefinition> sections) {
this.sections = sections;
}

@GraphQLField
public String getOriginBundleSymbolicName() {
return originBundle != null ? originBundle.getSymbolicName() : null;
}

public Bundle getOriginBundle() {
return originBundle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,19 @@ public EditorFormFieldSet mergeWith(EditorFormFieldSet otherEditorFormFieldSet,
}

newEditorFormFieldSet.setRemoved(otherEditorFormFieldSet.isRemoved());
if (originBundle != null) {
newEditorFormFieldSet.setOriginBundle(getOriginBundle());
} else {
newEditorFormFieldSet.setOriginBundle(otherEditorFormFieldSet.getOriginBundle());
}

return newEditorFormFieldSet;
}

public EditorFormField getFieldByName(String name) {
return editorFormFieldsByName.get(name);
}

public EditorFormFieldTarget getTarget() {
return target;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,20 @@ public boolean expanded() {
public void setExpanded(boolean expanded) {
this.expanded = expanded;
}

/**
*
* @param fieldSetName name of field set to look for in this section
* @return EditorFormFieldSet that matches given name, or null if not found.
*/
public EditorFormFieldSet getFieldSetByName(String fieldSetName) {
if (fieldSetName == null || fieldSetName.isEmpty()) {
return null;
}

return getFieldSets().stream()
.filter(fs -> fs.getName().equals(fieldSetName))
.findFirst()
.orElse(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
package org.jahia.modules.contenteditor.api.forms;

import graphql.annotations.annotationTypes.GraphQLField;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -48,6 +50,7 @@ public EditorFormSectionDefinition(String name) {
this.name = name;
}

@GraphQLField
public String getName() {
return name;
}
Expand All @@ -56,6 +59,7 @@ public void setName(String name) {
this.name = name;
}

@GraphQLField
public String getLabelKey() {
return labelKey;
}
Expand All @@ -64,6 +68,7 @@ public void setLabelKey(String labelKey) {
this.labelKey = labelKey;
}

@GraphQLField
public String getDescriptionKey() {
return descriptionKey;
}
Expand All @@ -72,6 +77,7 @@ public void setDescriptionKey(String descriptionKey) {
this.descriptionKey = descriptionKey;
}

@GraphQLField
public String getRequiredPermission() {
return requiredPermission;
}
Expand All @@ -80,6 +86,7 @@ public void setRequiredPermission(String requiredPermission) {
this.requiredPermission = requiredPermission;
}

@GraphQLField
public boolean isHide() {
return hide;
}
Expand All @@ -88,6 +95,7 @@ public void setHide(boolean hide) {
this.hide = hide;
}

@GraphQLField
public boolean expanded() {
return expanded;
}
Expand All @@ -96,6 +104,7 @@ public void setExpanded(boolean expanded) {
this.expanded = expanded;
}

@GraphQLField
public List<String> getDisplayModes() {
return displayModes;
}
Expand All @@ -104,6 +113,7 @@ public void setDisplayModes(List<String> displayModes) {
this.displayModes = displayModes;
}

@GraphQLField
public List<EditorFormFieldSet> getFieldSets() {
return fieldSets;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
*/
package org.jahia.modules.contenteditor.api.forms;

import graphql.annotations.annotationTypes.GraphQLNonNull;
import org.jahia.modules.contenteditor.graphql.api.types.ContextEntryInput;

import java.util.List;
import java.util.Locale;
import java.util.SortedSet;

/**
* Main service to retrieve form for editing content
Expand Down Expand Up @@ -89,4 +91,6 @@ List<EditorFormFieldValueConstraint> getFieldConstraints(String nodeUuidOrPath,
List<ContextEntryInput> context,
Locale uiLocale,
Locale locale) throws EditorFormException;

SortedSet<EditorFormDefinition> getFormOverrides(@GraphQLNonNull String nodeType);
}
Loading

0 comments on commit 3cfa47c

Please sign in to comment.