public String getParameterDeclaration() { Class<?> componentType = getProperty().getType().getInstanceClass().getComponentType(); final String simpleName = componentType.getSimpleName() + "[]"; final String localParameterName = getLocalParameterName(); return new StringBuilder(64).append(simpleName).append(' ').append(localParameterName).toString(); }
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; }
private void validate() { if (!getProperty().getType().getInstanceClass().isArray()) { throw new OpenlNotCheckedException("Can`t create array parameter column for not an array property"); } }
private static IDecisionTableColumn makeColumn(TablePropertyDefinition dimensionProperty, DispatcherTableRules rules) { if (dimensionProperty.getType().getInstanceClass().isArray()) { return new ArrayParameterColumn(dimensionProperty, rules); } else { return new SimpleParameterColumn(dimensionProperty, rules); } }
public String getParameterDeclaration() { String propertyTypeName = getProperty().getType().getInstanceClass().getSimpleName(); return String.format("%s %s%s", propertyTypeName, getProperty().getName(), ADispatcherTableColumn.LOCAL_PARAM_SUFFIX); }
/** * Action that can be use on form. "propNameToAdd" must be specified. */ public void addProperty() { TablePropertyDefinition propDefinition = getPropByName(propNameToAdd); Class<?> propType = propDefinition.getType() == null ? String.class : propDefinition.getType() .getInstanceClass(); properties .add(new TableProperty.TablePropertyBuilder(propDefinition.getName(), propType) .displayName(propDefinition.getDisplayName()).format(propDefinition.getFormat()).build()); possibleToAddProps.remove(propNameToAdd); }
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); }
/** * Action that can be use on form. "propNameToAdd" must be specified. */ public void addProperty() { TablePropertyDefinition propDefinition = getPropByName(propNameToAdd); Class<?> propType = propDefinition.getType() == null ? String.class : propDefinition.getType() .getInstanceClass(); properties .add(new TableProperty.TablePropertyBuilder(propDefinition.getName(), propType) .displayName(propDefinition.getDisplayName()).format(propDefinition.getFormat()).build()); possibleToAddProps.remove(propNameToAdd); }
/** * Action that can be use on form. "propNameToAdd" must be specified. */ public void addProperty() { TablePropertyDefinition propDefinition = getPropByName(propNameToAdd); Class<?> propType = propDefinition.getType() == null ? String.class : propDefinition.getType() .getInstanceClass(); properties .add(new TableProperty.TablePropertyBuilder(propDefinition.getName(), propType) .displayName(propDefinition.getDisplayName()).format(propDefinition.getFormat()).build()); possibleToAddProps.remove(propNameToAdd); }
public TableProperty(TablePropertyDefinition propDefinition) { this.name = propDefinition.getName(); this.displayName = propDefinition.getDisplayName(); this.type = propDefinition.getType() == null ? String.class : propDefinition.getType().getInstanceClass(); this.group = propDefinition.getGroup(); this.format = propDefinition.getFormat(); this.deprecation = propDefinition.getDeprecation(); this.constraints = propDefinition.getConstraints(); this.description = propDefinition.getDescription(); this.system = propDefinition.isSystem(); this.dimensional = propDefinition.isDimensional(); }
public TableProperty(TablePropertyDefinition propDefinition) { this.name = propDefinition.getName(); this.displayName = propDefinition.getDisplayName(); this.type = propDefinition.getType() == null ? String.class : propDefinition.getType().getInstanceClass(); this.group = propDefinition.getGroup(); this.format = propDefinition.getFormat(); this.deprecation = propDefinition.getDeprecation(); this.constraints = propDefinition.getConstraints(); this.description = propDefinition.getDescription(); this.system = propDefinition.isSystem(); this.dimensional = propDefinition.isDimensional(); }
/** * During the construction, we take all the properties from DefaultPropertyDefinitions * that must be included in business search */ public BussinesSearchPropertyBean() { TablePropertyDefinition[] propDefinitions = DefaultPropertyDefinitions.getDefaultDefinitions(); for (TablePropertyDefinition propDefinition : propDefinitions) { if(propDefinition.isBusinessSearch()) { Class<?> propertyType = propDefinition.getType() == null ? null : propDefinition.getType() .getInstanceClass(); propForSearch.add( new TableProperty.TablePropertyBuilder(propDefinition.getName(), propertyType) .displayName(propDefinition.getDisplayName()).group(propDefinition.getGroup()) .format(propDefinition.getFormat()).constraints(propDefinition.getConstraints()) .build()); } } //busSearchResBean = new BussinessSearchResultBean(propForSearch); }
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); }
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; } }
private void processTypes() { for (TablePropertyDefinitionWrapper wrapper : tablePropertyDefinitionWrappers.asList()) { if (wrapper.isEnum()) { String name = wrapper.getEnumName(); String enumName = GenRulesTypes.getEnumName(name); String fullEnumName = CodeGenConstants.ENUMS_PACKAGE + "." + enumName; boolean isArray = wrapper.getDefinition().getType().getInstanceClass().isArray(); JavaOpenClass enumOpenClass = CodeGenTools.getJavaOpenClass(fullEnumName, isArray); wrapper.getDefinition().setType(enumOpenClass); } } for (ContextPropertyDefinitionWrapper wrapper : contextPropertyDefinitionWrappers.asList()) { if (wrapper.isEnum()) { String name = wrapper.getEnumName(); String enumName = GenRulesTypes.getEnumName(name); String fullEnumName = CodeGenConstants.ENUMS_PACKAGE + "." + enumName; boolean isArray = wrapper.getDefinition().getType().getInstanceClass().isArray(); JavaOpenClass enumOpenClass = CodeGenTools.getJavaOpenClass(fullEnumName, isArray); wrapper.getDefinition().setType(enumOpenClass); } } }