Skip to content
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
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,46 @@ protected void doDispatch(
super.doDispatch(renderRequest, renderResponse);
}

private void _addLocalizedCustomObjectField(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩

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);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"required", the last argument, is hardcoded to false. If it is not, Objects backend API will throw an error.


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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import 'atlas-variables';

.orderable-table-sheet {
margin-top: 1rem;

.c-empty-state {
text-align: center;
}
Expand Down Expand Up @@ -30,3 +32,9 @@
margin-bottom: 0;
}
}

.tab-pane .orderable-table-sheet {
border-width: 0;
margin-top: 0;
padding: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

const API_URL = {
FDS_ACTIONS: '/o/data-set-manager/actions',
FDS_DATE_FILTERS: '/o/data-set-manager/date-filters',
FDS_DYNAMIC_FILTERS: '/o/data-set-manager/dynamic-filters',
FDS_ENTRIES: '/o/data-set-manager/entries',
Expand All @@ -20,6 +21,8 @@ const FUZZY_OPTIONS = {
const OBJECT_RELATIONSHIP = {
FDS_ENTRY_FDS_VIEW: 'fdsEntryFDSViewRelationship',
FDS_ENTRY_FDS_VIEW_ID: 'r_fdsEntryFDSViewRelationship_c_fdsEntryId',
FDS_VIEW_FDS_ACTION: 'fdsViewFDSActionRelationship',
FDS_VIEW_FDS_ACTION_ID: 'r_fdsViewFDSActionRelationship_c_fdsViewId',
FDS_VIEW_FDS_DATE_FILTER: 'fdsViewFDSDateFilterRelationship',
FDS_VIEW_FDS_DATE_FILTER_ID:
'r_fdsViewFDSDateFilterRelationship_c_fdsViewId',
Expand Down
Loading