/** * Gets the array of properties names that are dimensional. * * @return names of properties that are dimensional. */ public static String[] getDimensionalTablePropertiesNames() { if (dimensionalTablePropertiesNames == null) { List<String> names = new ArrayList<String>(); List<TablePropertyDefinition> dimensionalProperties = getDimensionalTableProperties(); for (TablePropertyDefinition definition : dimensionalProperties) { names.add(definition.getName()); } dimensionalTablePropertiesNames = names.toArray(new String[names.size()]); } return dimensionalTablePropertiesNames; }
/** * Initialize domain collectors for each dimension property. */ private void initDomainCollectors() { for (TablePropertyDefinition property : TablePropertyDefinitionUtils.getDimensionalTableProperties()) { IDomainCollector domainCollector = getDomainCollector(property); if (domainCollector != null) { domainCollectors.put(property.getName(), domainCollector); } } }
private List<IDecisionTableColumn> getConditions(List<ITableProperties> propertiesFromMethods, DispatcherTableRules rules) { List<TablePropertyDefinition> dimensionalPropertiesDef = TablePropertyDefinitionUtils.getDimensionalTableProperties(); List<IDecisionTableColumn> conditions = new ArrayList<>(); // get only dimensional properties from methods properties // for (TablePropertyDefinition dimensionProperty : dimensionalPropertiesDef) { if (isSuitable(dimensionProperty.getName(), propertiesFromMethods)) { conditions.add(makeColumn(dimensionProperty, rules)); } } return conditions; }
/** * Build the table only if there is any property value for any table. * * @return flag if it is needed to build the table for given methods properties */ private boolean needToBuild() { List<TablePropertyDefinition> dimensionalPropertiesDef = TablePropertyDefinitionUtils.getDimensionalTableProperties(); List<ITableProperties> propertiesFromMethods = getMethodsProperties(); for (TablePropertyDefinition dimensionProperty : dimensionalPropertiesDef) { if (isSuitable(dimensionProperty.getName(), propertiesFromMethods)) { return true; } } return false; }
private boolean dimensionalPropertyPresented(IOpenMethod m) { List<TablePropertyDefinition> dimensionalPropertiesDef = TablePropertyDefinitionUtils .getDimensionalTableProperties(); ITableProperties propertiesFromMethod = PropertiesHelper.getTableProperties(m); for (TablePropertyDefinition dimensionProperty : dimensionalPropertiesDef) { String propertyValue = propertiesFromMethod.getPropertyValueAsString(dimensionProperty.getName()); if (StringUtils.isNotEmpty(propertyValue)) { return true; } } return false; }
private static TablePropertyDefinition getTablePropertyDefinition(Attribute attribute) { List<TablePropertyDefinition> dimensionalTableProperties = TablePropertyDefinitionUtils.getDimensionalTableProperties(); Class<? extends Constraint> constraintClass = getConstraintClass(attribute); for (TablePropertyDefinition property : dimensionalTableProperties) { String contextAttribute = property.getExpression().getMatchExpression().getContextAttribute(); if (contextAttribute.equals(attribute.getName())) { Constraints constraints = property.getConstraints(); if (constraints.size() == 1) { Constraint constraint = constraints.get(0); if (constraintClass == null || constraintClass.isAssignableFrom(constraint.getClass())) { return property; } } } } return null; }
private Object convertAttribute(String attributeName, Object attributeValue) { List<TablePropertyDefinition> dimensionalTableProperties = TablePropertyDefinitionUtils.getDimensionalTableProperties(); for (TablePropertyDefinition property : dimensionalTableProperties) { String contextAttribute = property.getExpression().getMatchExpression().getContextAttribute(); if (contextAttribute.equals(attributeName)) { IOpenClass type = property.getType(); if (type.isArray()) { type = type.getComponentClass(); } IString2DataConvertor converter = String2DataConvertorFactory.getConvertor(type.getInstanceClass()); String argument = HelperFunctions.convertArgument(String.class, attributeValue); return converter.parse(argument, property.getFormat()); } } // Couldn't find property and converter for it return attributeValue; } }