private static boolean updateSystemValue(TableEditorModel editorModel, TablePropertyDefinition systemProperty, String userMode) { final Logger log = LoggerFactory.getLogger(EditHelper.class); boolean result = false; String systemValueDescriptor = systemProperty.getSystemValueDescriptor(); if (userMode.equals("single") && systemValueDescriptor.equals(SystemValuesManager.CURRENT_USER_DESCRIPTOR)) { return true; } if (systemProperty.getSystemValuePolicy().equals(SystemValuePolicy.ON_EACH_EDIT)) { Object systemValue = SystemValuesManager.getInstance().getSystemValue(systemValueDescriptor); if (systemValue != null) { try { if (editorModel != null) { editorModel.setProperty(systemProperty.getName(), systemValue); result = true; } } catch (Exception e) { String message = String.format("Can`t update system property '%s' with value '%s'", systemProperty.getName(), systemValue); log.error(message, e); throw new IllegalStateException(message, e); } } } return result; } }
private static boolean updateSystemValue(TableEditorModel editorModel, TablePropertyDefinition systemProperty, String userMode) { final Logger log = LoggerFactory.getLogger(EditHelper.class); boolean result = false; String systemValueDescriptor = systemProperty.getSystemValueDescriptor(); if (userMode.equals("single") && systemValueDescriptor.equals(SystemValuesManager.CURRENT_USER_DESCRIPTOR)) { return true; } if (systemProperty.getSystemValuePolicy().equals(SystemValuePolicy.ON_EACH_EDIT)) { Object systemValue = SystemValuesManager.getInstance().getSystemValue(systemValueDescriptor); if (systemValue != null) { try { if (editorModel != null) { editorModel.setProperty(systemProperty.getName(), systemValue); result = true; } } catch (Exception e) { String message = String.format("Can`t update system property '%s' with value '%s'", systemProperty.getName(), systemValue); log.error(message, e); throw new IllegalStateException(message, e); } } } return result; } }
protected Map<String, Object> buildSystemProperties() { String userMode = WebStudioUtils.getWebStudio().getSystemConfigManager().getStringProperty("user.mode"); Map<String, Object> result = new LinkedHashMap<String, Object>(); List<TablePropertyDefinition> systemPropDefinitions = TablePropertyDefinitionUtils.getSystemProperties(); for (TablePropertyDefinition systemPropDef : systemPropDefinitions) { String systemValueDescriptor = systemPropDef.getSystemValueDescriptor(); if (userMode.equals("single") && systemValueDescriptor.equals(SystemValuesManager.CURRENT_USER_DESCRIPTOR)) { continue; } if (systemPropDef.getSystemValuePolicy().equals(SystemValuePolicy.IF_BLANK_ONLY)) { Object systemValue = SystemValuesManager.getInstance().getSystemValue(systemValueDescriptor); if (systemValue != null) { result.put(systemPropDef.getName(), systemValue); } } } return result; }
/** * Creates system properties for new table. * * @return */ protected Map<String, Object> buildSystemProperties() { Map<String, Object> result = new HashMap<String, Object>(); List<TablePropertyDefinition> systemPropDefinitions = TablePropertyDefinitionUtils.getSystemProperties(); for (TablePropertyDefinition systemPropDef : systemPropDefinitions) { if (systemPropDef.getSystemValuePolicy().equals(SystemValuePolicy.IF_BLANK_ONLY)) { Object systemValue = SystemValuesManager.getInstance().getSystemValue( systemPropDef.getSystemValueDescriptor()); if (systemValue != null){ result.put(systemPropDef.getName(), systemValue); } } } return result; }
protected Map<String, Object> buildSystemProperties() { String userMode = WebStudioUtils.getWebStudio().getSystemConfigManager().getStringProperty("user.mode"); Map<String, Object> result = new LinkedHashMap<String, Object>(); List<TablePropertyDefinition> systemPropDefinitions = TablePropertyDefinitionUtils.getSystemProperties(); for (TablePropertyDefinition systemPropDef : systemPropDefinitions) { String systemValueDescriptor = systemPropDef.getSystemValueDescriptor(); if (userMode.equals("single") && systemValueDescriptor.equals(SystemValuesManager.CURRENT_USER_DESCRIPTOR)) { continue; } if (systemPropDef.getSystemValuePolicy().equals(SystemValuePolicy.IF_BLANK_ONLY)) { Object systemValue = SystemValuesManager.getInstance().getSystemValue(systemValueDescriptor); if (systemValue != null) { result.put(systemPropDef.getName(), systemValue); } } } return result; }
private boolean updateSystemValue(TableEditorModel editorModel, TablePropertyDefinition sysProperty) { boolean result = false; String systemValue = null; if (sysProperty.getSystemValuePolicy().equals(SystemValuePolicy.ON_EACH_EDIT)) { systemValue = SystemValuesManager.getInstance().getSystemValueString( sysProperty.getSystemValueDescriptor()); if (systemValue != null) { try { editorModel.setProperty(sysProperty.getName(), systemValue); result = true; } catch (Exception e) { LOG.error(String.format("Can`t update system property '%s' with value '%s'", sysProperty.getName(), systemValue), e); } } } return result; }
protected Map<String, Object> buildSystemProperties() { Map<String, Object> result = new LinkedHashMap<String, Object>(); List<TablePropertyDefinition> systemPropDefinitions = TablePropertyDefinitionUtils.getSystemProperties(); for (TablePropertyDefinition systemPropDef : systemPropDefinitions) { if (systemPropDef.getSystemValuePolicy().equals(SystemValuePolicy.IF_BLANK_ONLY)) { Object systemValue = SystemValuesManager.getInstance(). getSystemValue(systemPropDef.getSystemValueDescriptor()); if (systemValue != null) { result.put(systemPropDef.getName(), systemValue); } } } return result; }