public UIConfiguration fetchGroupUIConfiguration(final Long groupId) { final CMClass roleClass = view.findClass("Role"); final CMQueryRow row = view.select(anyAttribute(roleClass)) // .from(roleClass) // .where(condition(attribute(roleClass, "Id"), eq(groupId))) // .run() .getOnlyRow(); final CMCard roleCard = row.getCard(roleClass); final UIConfiguration uiConfiguration = new UIConfiguration(); final String[] disabledModules = (String[]) roleCard.get(GROUP_ATTRIBUTE_DISABLEDMODULES); if (!isStringArrayNull(disabledModules)) { uiConfiguration.setDisabledModules(disabledModules); } final String[] disabledCardTabs = (String[]) roleCard.get(GROUP_ATTRIBUTE_DISABLEDCARDTABS); if (!isStringArrayNull(disabledCardTabs)) { uiConfiguration.setDisabledCardTabs(disabledCardTabs); } final String[] disabledProcessTabs = (String[]) roleCard.get(GROUP_ATTRIBUTE_DISABLEDPROCESSTABS); if (!isStringArrayNull(disabledProcessTabs)) { uiConfiguration.setDisabledProcessTabs(disabledProcessTabs); } uiConfiguration.setHideSidePanel((Boolean) roleCard.get(GROUP_ATTRIBUTE_HIDESIDEPANEL)); uiConfiguration.setFullScreenMode((Boolean) roleCard.get(GROUP_ATTRIBUTE_FULLSCREEN)); uiConfiguration.setSimpleHistoryModeForCard( (Boolean) roleCard.get(GROUP_ATTRIBUTE_SIMPLE_HISTORY_CARD)); uiConfiguration.setSimpleHistoryModeForProcess( (Boolean) roleCard.get(GROUP_ATTRIBUTE_SIMPLE_HISTORY_PROCESS)); uiConfiguration.setProcessWidgetAlwaysEnabled( (Boolean) roleCard.get(GROUP_ATTRIBUTE_PROCESS_WIDGET_ALWAYS_ENABLED)); uiConfiguration.setCloudAdmin((Boolean) roleCard.get(GROUP_ATTRIBUTE_CLOUD_ADMIN)); return uiConfiguration; }
public void saveGroupUIConfiguration(final Long groupId, final UIConfiguration configuration) { final CMClass roleClass = view.findClass("Role"); final CMQueryRow row = view.select(anyAttribute(roleClass)) // .from(roleClass) // .where(condition(attribute(roleClass, "Id"), eq(groupId))) // .run() .getOnlyRow(); final CMCard roleCard = row.getCard(roleClass); final CMCardDefinition cardDefinition = view.update(roleCard); if (isStringArrayNull(configuration.getDisabledModules())) { cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDMODULES, null); } else { cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDMODULES, configuration.getDisabledModules()); } if (isStringArrayNull(configuration.getDisabledCardTabs())) { cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDCARDTABS, null); } else { cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDCARDTABS, configuration.getDisabledCardTabs()); } if (isStringArrayNull(configuration.getDisabledProcessTabs())) { cardDefinition.set(GROUP_ATTRIBUTE_DISABLEDPROCESSTABS, null); } else { cardDefinition.set( GROUP_ATTRIBUTE_DISABLEDPROCESSTABS, configuration.getDisabledProcessTabs()); } cardDefinition.set(GROUP_ATTRIBUTE_HIDESIDEPANEL, configuration.isHideSidePanel()); cardDefinition.set(GROUP_ATTRIBUTE_FULLSCREEN, configuration.isFullScreenMode()); cardDefinition.set( GROUP_ATTRIBUTE_SIMPLE_HISTORY_CARD, configuration.isSimpleHistoryModeForCard()); cardDefinition.set( GROUP_ATTRIBUTE_SIMPLE_HISTORY_PROCESS, configuration.isSimpleHistoryModeForProcess()); cardDefinition.set( GROUP_ATTRIBUTE_PROCESS_WIDGET_ALWAYS_ENABLED, configuration.isProcessWidgetAlwaysEnabled()); // FIXME: manage cloud admin cardDefinition.save(); }