forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LPS-195155 Implement saving of FDS item actions in DSM #3639
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f113ef6
LPS-195155 Create persistence for FDS Actions
markocikos d42d52e
LPS-195155 Create UI to save and reorder FDS Actions
markocikos df12a7e
LPS-195155 Fix ordering in filters and sorts
markocikos 1a58cb3
LPS-195155 Apply default toast utils to the rest of DSM
markocikos 8fb2986
LPS-195155 Fix styles
markocikos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,46 @@ protected void doDispatch( | |
super.doDispatch(renderRequest, renderResponse); | ||
} | ||
|
||
private void _addLocalizedCustomObjectField( | ||
String label, String name, ObjectDefinition objectDefinition, | ||
long userId) | ||
throws Exception { | ||
|
||
ObjectField objectField = ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, label, name, | ||
false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "required", the last argument, is hardcoded to |
||
|
||
if (FeatureFlagManagerUtil.isEnabled("LPS-172017")) { | ||
objectField.setLocalized(true); | ||
} | ||
|
||
_objectFieldLocalService.addCustomObjectField( | ||
objectField.getExternalReferenceCode(), userId, | ||
objectField.getListTypeDefinitionId(), | ||
objectDefinition.getObjectDefinitionId(), | ||
objectField.getBusinessType(), objectField.getDBType(), | ||
objectField.isIndexed(), objectField.isIndexedAsKeyword(), | ||
objectField.getIndexedLanguageId(), objectField.getLabelMap(), | ||
objectField.isLocalized(), objectField.getName(), | ||
objectField.getReadOnly(), | ||
objectField.getReadOnlyConditionExpression(), | ||
objectField.isRequired(), objectField.isState(), | ||
objectField.getObjectFieldSettings()); | ||
} | ||
|
||
private void _enableObjectDefinitionLocalization( | ||
ObjectDefinition objectDefinition) { | ||
|
||
if (FeatureFlagManagerUtil.isEnabled("LPS-172017")) { | ||
objectDefinition.setEnableLocalization(true); | ||
|
||
objectDefinition = | ||
_objectDefinitionLocalService.updateObjectDefinition( | ||
objectDefinition); | ||
} | ||
} | ||
|
||
private synchronized void _generate( | ||
long companyId, Locale locale, long userId) | ||
throws Exception { | ||
|
@@ -180,6 +220,11 @@ private synchronized void _generate( | |
ObjectFieldConstants.DB_TYPE_INTEGER, true, false, null, | ||
_language.get(locale, "default-items-per-page"), | ||
"defaultItemsPerPage", true), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_LONG_TEXT, | ||
ObjectFieldConstants.DB_TYPE_CLOB, true, false, null, | ||
_language.get(locale, "actions-order"), | ||
"fdsActionsOrder", false), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_LONG_TEXT, | ||
ObjectFieldConstants.DB_TYPE_CLOB, true, false, null, | ||
|
@@ -245,39 +290,11 @@ private synchronized void _generate( | |
ObjectFieldConstants.DB_TYPE_BOOLEAN, true, false, null, | ||
_language.get(locale, "sortable"), "sortable", false))); | ||
|
||
if (FeatureFlagManagerUtil.isEnabled("LPS-172017")) { | ||
fdsFieldObjectDefinition.setEnableLocalization(true); | ||
_enableObjectDefinitionLocalization(fdsFieldObjectDefinition); | ||
|
||
fdsFieldObjectDefinition = | ||
_objectDefinitionLocalService.updateObjectDefinition( | ||
fdsFieldObjectDefinition); | ||
} | ||
|
||
ObjectField fieldLabelObjectField = ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "column-label"), "label", false); | ||
|
||
if (FeatureFlagManagerUtil.isEnabled("LPS-172017")) { | ||
fieldLabelObjectField.setLocalized(true); | ||
} | ||
|
||
_objectFieldLocalService.addCustomObjectField( | ||
fieldLabelObjectField.getExternalReferenceCode(), userId, | ||
fieldLabelObjectField.getListTypeDefinitionId(), | ||
fdsFieldObjectDefinition.getObjectDefinitionId(), | ||
fieldLabelObjectField.getBusinessType(), | ||
fieldLabelObjectField.getDBType(), | ||
fieldLabelObjectField.isIndexed(), | ||
fieldLabelObjectField.isIndexedAsKeyword(), | ||
fieldLabelObjectField.getIndexedLanguageId(), | ||
fieldLabelObjectField.getLabelMap(), | ||
fieldLabelObjectField.isLocalized(), | ||
fieldLabelObjectField.getName(), | ||
fieldLabelObjectField.getReadOnly(), | ||
fieldLabelObjectField.getReadOnlyConditionExpression(), | ||
fieldLabelObjectField.isRequired(), fieldLabelObjectField.isState(), | ||
fieldLabelObjectField.getObjectFieldSettings()); | ||
_addLocalizedCustomObjectField( | ||
_language.get(locale, "column-label"), "label", | ||
fdsFieldObjectDefinition, userId); | ||
|
||
_objectDefinitionLocalService.publishSystemObjectDefinition( | ||
userId, fdsFieldObjectDefinition.getObjectDefinitionId()); | ||
|
@@ -410,6 +427,71 @@ private synchronized void _generate( | |
LocalizedMapUtil.getLocalizedMap("FDSView FDSSort Relationship"), | ||
"fdsViewFDSSortRelationship", | ||
ObjectRelationshipConstants.TYPE_ONE_TO_MANY); | ||
|
||
ObjectDefinition fdsActionObjectDefinition = | ||
_objectDefinitionLocalService.addSystemObjectDefinition( | ||
"FDSAction", userId, 0, "FDSAction", "FDSAction", false, | ||
LocalizedMapUtil.getLocalizedMap("FDS Action"), true, | ||
"FDSAction", null, null, null, null, | ||
LocalizedMapUtil.getLocalizedMap("FDS Actions"), | ||
ObjectDefinitionConstants.SCOPE_COMPANY, null, 1, | ||
WorkflowConstants.STATUS_DRAFT, | ||
Arrays.asList( | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "type"), "type", true), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "icon"), "icon", false), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "confirmation-message-type"), | ||
"confirmationMessageType", false), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "method"), "method", false), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "permission-key"), | ||
"permissionKey", false), | ||
ObjectFieldUtil.createObjectField( | ||
ObjectFieldConstants.BUSINESS_TYPE_TEXT, | ||
ObjectFieldConstants.DB_TYPE_STRING, true, false, null, | ||
_language.get(locale, "url"), "url", false))); | ||
|
||
_enableObjectDefinitionLocalization(fdsActionObjectDefinition); | ||
|
||
_addLocalizedCustomObjectField( | ||
_language.get(locale, "confirmation-message"), | ||
"confirmationMessage", fdsActionObjectDefinition, userId); | ||
_addLocalizedCustomObjectField( | ||
_language.get(locale, "label"), "label", fdsActionObjectDefinition, | ||
userId); | ||
_addLocalizedCustomObjectField( | ||
_language.get(locale, "success-message"), "successMessage", | ||
fdsActionObjectDefinition, userId); | ||
_addLocalizedCustomObjectField( | ||
_language.get(locale, "error-message"), "errorMessage", | ||
fdsActionObjectDefinition, userId); | ||
_addLocalizedCustomObjectField( | ||
_language.get(locale, "title"), "title", fdsActionObjectDefinition, | ||
userId); | ||
|
||
_objectDefinitionLocalService.publishSystemObjectDefinition( | ||
userId, fdsActionObjectDefinition.getObjectDefinitionId()); | ||
|
||
_objectRelationshipLocalService.addObjectRelationship( | ||
userId, fdsViewObjectDefinition.getObjectDefinitionId(), | ||
fdsActionObjectDefinition.getObjectDefinitionId(), 0, | ||
ObjectRelationshipConstants.DELETION_TYPE_CASCADE, | ||
LocalizedMapUtil.getLocalizedMap("FDSView FDSAction Relationship"), | ||
"fdsViewFDSActionRelationship", | ||
ObjectRelationshipConstants.TYPE_ONE_TO_MANY); | ||
} | ||
|
||
private static final Log _log = LogFactoryUtil.getLog( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩