private TablePropertyDefinition getPropByName(String name) { return TablePropertyDefinitionUtils.getPropertyByName(name); }
private TablePropertyDefinition getPropByName(String name) { return TablePropertyDefinitionUtils.getPropertyByName(name); }
private TablePropertyDefinition getPropByName(String name) { return TablePropertyDefinitionUtils.getPropertyByName(name); }
public static boolean isPropertyExist(String propertyName) { return getPropertyByName(propertyName) != null; }
/** * Gets the table types in which this property can be defined. * * @param propertyName property name. * @return the table type in which this property can be defined. * <code>NULL</code> if property can be defined for each type of * tables. */ public static XlsNodeTypes[] getSuitableTableTypes(String propertyName) { TablePropertyDefinition propDefinition = getPropertyByName(propertyName); if (propDefinition != null) { return propDefinition.getTableType(); } return null; }
/** * {@inheritDoc} */ public Map<String, Object> getAllDimensionalProperties() { if (allDimensionalProperties == null) { Map<String, Object> tmp = new HashMap<String, Object>(); Map<String, Object> props = getAllProperties(); for (Map.Entry<String, Object> property : props.entrySet()) { String propName = property.getKey(); TablePropertyDefinition propertyDefinition = TablePropertyDefinitionUtils.getPropertyByName(propName); if (propertyDefinition.isDimensional()) { tmp.put(propName, property.getValue()); } } allDimensionalProperties = Collections.unmodifiableMap(tmp); } return allDimensionalProperties; }
public void addNew() { TablePropertyDefinition propDefinition = TablePropertyDefinitionUtils.getPropertyByName(propertyToAdd); storeProperty(new TableProperty(propDefinition)); propsToRemove.remove(propertyToAdd); }
/** * Checks if property with given name is suitable for given level. Checks according to the property * definitions in {@link DefaultPropertyDefinitions}. * * @param currentLevel current level of current property. * @param propertyName name of the property to check. * @return true if property with income name can be defined in income level. */ public static boolean isPropertySuitableForLevel(InheritanceLevel currentLevel, String propertyName) { final Logger log = LoggerFactory.getLogger(PropertiesChecker.class); boolean result = false; TablePropertyDefinition propertyDefinition = TablePropertyDefinitionUtils.getPropertyByName(propertyName); if (propertyDefinition != null) { InheritanceLevel[] inheritanceLevels = propertyDefinition.getInheritanceLevel(); if (inheritanceLevels != null && inheritanceLevels.length > 0) { if (Arrays.asList(inheritanceLevels).contains(currentLevel)) { result = true; } } else { log.debug("Inheritance levels were not defined for property with name [{}].", propertyName); } } else { log.debug("There is no such property in Definitions with name [{}].", propertyName); } return result; }
public void addNew() { TablePropertyDefinition propDefinition = TablePropertyDefinitionUtils.getPropertyByName(propertyToAdd); storeProperty(new TableProperty(propDefinition)); propsToRemove.remove(propertyToAdd); }
public static Class<?> getPropertyTypeByPropertyName(String name) { TablePropertyDefinition propDefinition = getPropertyByName(name); if (propDefinition != null) { return propDefinition.getType().getInstanceClass(); } return null; } }
public static Class<?> getTypeByPropertyName(String propertyName) { TablePropertyDefinition tablePropertyDefinition = TablePropertyDefinitionUtils.getPropertyByName(propertyName); if (tablePropertyDefinition != null) { return tablePropertyDefinition.getType().getInstanceClass(); } return null; }
/** * Checks if properties were deprecated. */ private static void checkForDeprecation(IBindingContext bindingContext, Set<String> propertyNamesToCheck, TableSyntaxNode tableSyntaxNode) { for (String propertyNameToCheck : propertyNamesToCheck) { TablePropertyDefinition propertyDefinition = TablePropertyDefinitionUtils.getPropertyByName(propertyNameToCheck); if (propertyDefinition != null && propertyDefinition.getDeprecation() != null && !propertyDefinition.getDeprecation().isEmpty()) { String message = String.format("Property '%s' was deprecated. Please remove it!", propertyNameToCheck); bindingContext.addMessage(OpenLMessagesUtils.newWarnMessage(message, tableSyntaxNode)); } } }
private void applyAllDomains() { // ensure that map of gathered domains is empty. // propertiesDomains.clear(); IDomainAdaptor dateDomainAdaptor = null; for (String propNeedDomain : domainCollectors.keySet()) { TablePropertyDefinition propDef = TablePropertyDefinitionUtils.getPropertyByName(propNeedDomain); // Class<?> propertyType = TablePropertyDefinitionUtils.getPropertyTypeByPropertyName(propNeedDomain); Class<?> propertyType = propDef.getType().getInstanceClass(); IDomainCollector domainCollector = domainCollectors.get(propNeedDomain); applyDomain(propDef, domainCollector.getGatheredDomain()); if (dateDomainAdaptor == null && Date.class.equals(propertyType)) { dateDomainAdaptor = domainCollector.getGatheredDomain(); } else if (propertyType.isArray() && propertyType.getComponentType().isEnum()) { applyArrayDomains(propNeedDomain, domainCollector); } } applyCurrentDateDomain(dateDomainAdaptor); }
if (propValue != null) { if (propValue instanceof Date) { String format = TablePropertyDefinitionUtils.getPropertyByName(key).getFormat(); if (format != null) { SimpleDateFormat dateFormat = new SimpleDateFormat(format);
String propName = request.getParameter("propName"); TablePropertyDefinition propDefinition = TablePropertyDefinitionUtils.getPropertyByName(propName); ServletOutputStream outputStream = response.getOutputStream();
String propName = request.getParameter("propName"); TablePropertyDefinition propDefinition = TablePropertyDefinitionUtils.getPropertyByName(propName); ServletOutputStream outputStream = response.getOutputStream();
public synchronized void setProperty(String name, String value) throws Exception { Object objectValue = null; if (StringUtils.isNotBlank(value)) { TablePropertyDefinition tablePropeprtyDefinition = TablePropertyDefinitionUtils.getPropertyByName(name); if (tablePropeprtyDefinition != null) { Class<?> type = tablePropeprtyDefinition.getType().getInstanceClass(); IFormatter formatter = FormattersManager.getFormatter(type, tablePropeprtyDefinition.getFormat()); objectValue = formatter.parse(value); } else { objectValue = value; } } setProperty(name, objectValue); }
public synchronized void setProperty(String name, String value) { Object objectValue = null; if (StringUtils.isNotBlank(value)) { TablePropertyDefinition tablePropeprtyDefinition = TablePropertyDefinitionUtils.getPropertyByName(name); if (tablePropeprtyDefinition != null) { Class<?> type = tablePropeprtyDefinition.getType().getInstanceClass(); IFormatter formatter = FormattersManager.getFormatter(type, tablePropeprtyDefinition.getFormat()); objectValue = formatter.parse(value); } else { objectValue = value; } } setProperty(name, objectValue); }
private void initProperties() { List<TableProperty> definedProperties = new ArrayList<TableProperty>(); ITableProperties tableProperties = table.getProperties(); for (String possiblePropertyName : propertiesManager.getPossibleToAddProperties()) { TablePropertyDefinition propDefinition = TablePropertyDefinitionUtils.getPropertyByName(possiblePropertyName); if (propDefinition != null && !propDefinition.isSystem() && propDefinition.getDeprecation() == null) { Object propertyValue = tableProperties.getPropertyValue(possiblePropertyName) != null ? tableProperties.getPropertyValue(possiblePropertyName) : null; if (tableProperties.getTableProperties().containsKey(possiblePropertyName)) { Class<?> propertyType = null; if (propDefinition.getType() != null) { propertyType = propDefinition.getType().getInstanceClass(); } String displayName = propDefinition.getDisplayName(); String format = propDefinition.getFormat(); boolean dimensional = propDefinition.isDimensional(); TableProperty tableProperty = new TableProperty.TablePropertyBuilder(possiblePropertyName, propertyType).value( propertyValue).displayName(displayName).format(format).dimensional(dimensional).build(); definedProperties.add(tableProperty); } } } propertiesManager.setProperties(definedProperties); }
private void initProperties() { List<TableProperty> definedProperties = new ArrayList<TableProperty>(); ITableProperties tableProperties = table.getProperties(); for (String possiblePropertyName : propertiesManager.getPossibleToAddProperties()) { TablePropertyDefinition propDefinition = TablePropertyDefinitionUtils.getPropertyByName(possiblePropertyName); if (propDefinition != null && !propDefinition.isSystem() && propDefinition.getDeprecation() == null) { Object propertyValue = tableProperties.getPropertyValue(possiblePropertyName) != null ? tableProperties.getPropertyValue(possiblePropertyName) : null; if (tableProperties.getTableProperties().containsKey(possiblePropertyName)) { Class<?> propertyType = null; if (propDefinition.getType() != null) { propertyType = propDefinition.getType().getInstanceClass(); } String displayName = propDefinition.getDisplayName(); String format = propDefinition.getFormat(); boolean dimensional = propDefinition.isDimensional(); TableProperty tableProperty = new TableProperty.TablePropertyBuilder(possiblePropertyName, propertyType).value( propertyValue).displayName(displayName).format(format).dimensional(dimensional).build(); definedProperties.add(tableProperty); } } } propertiesManager.setProperties(definedProperties); }