private boolean isModuleProperties(String scope) { return InheritanceLevel.MODULE.getDisplayName().equals(scope); }
public StringBuilder genLiteralLevelInheritance(InheritanceLevel value, StringBuilder sb) { return sb.append(InheritanceLevel.class.getSimpleName()).append(".").append(value.name()); }
public static InheritanceLevel getEnumByValue(String value) { for (InheritanceLevel level : InheritanceLevel.values()) { if (level.getDisplayName().equals(value)) { return level; } } return null; }
public List<String> getPropertyNamesList() { List<String> propertyNames = new ArrayList<String>(); TablePropertyDefinition[] propDefinitions = TablePropertyDefinitionUtils .getDefaultDefinitionsByInheritanceLevel(InheritanceLevel.valueOf(scopeType.toUpperCase())); for (TablePropertyDefinition propDefinition : propDefinitions) { String propName = propDefinition.getName(); List<String> exceptProperties = getExceptProperties(); if (!exceptProperties.contains(propName)) { propertyNames.add(propName); } } return propertyNames; }
@Override public IMemberBoundNode preBind(TableSyntaxNode tsn, OpenL openl, IBindingContext cxt, XlsModuleOpenClass module) throws Exception { assert cxt instanceof RulesModuleBindingContext; PropertyTableBoundNode propertyNode = (PropertyTableBoundNode) makeNode(tsn, module, cxt); String tableName = parseHeader(tsn); propertyNode.setTableName(tableName); if (tableName == null) { tableName = DEFAULT_TABLE_NAME_PREFIX + tsn.getUri(); } ITable propertyTable = module.getDataBase().registerTable(tableName, tsn); IOpenClass propertiesClass = JavaOpenClass.getOpenClass(TableProperties.class); ILogicalTable propTableBody = getTableBody(tsn); try { processTable(module, propertyTable, propTableBody, tableName, propertiesClass, cxt, openl, false); } catch (SyntaxNodeException ex) { throw SyntaxNodeExceptionUtils.createError("Table definiton is wrong.", ex, ex.getSyntaxNode()); } TableProperties propertiesInstance = ((TableProperties[]) propertyTable.getDataArray())[0]; propertiesInstance.setPropertiesSection(tsn.getTable().getRows(1)); // Skip header propertiesInstance.setCurrentTableType(tsn.getType()); PropertiesChecker.checkProperties(cxt, propertiesInstance.getAllProperties().keySet(), tsn, InheritanceLevel.getEnumByValue(propertiesInstance.getPropertyValueAsString(SCOPE_PROPERTY_NAME))); tsn.setTableProperties(propertiesInstance); analysePropertiesNode(tsn, propertiesInstance, (RulesModuleBindingContext) cxt, propertyNode); propertyNode.setPropertiesInstance(propertiesInstance); return propertyNode; }
public List<String> getPropertyNamesList() { List<String> propertyNames = new ArrayList<String>(); TablePropertyDefinition[] propDefinitions = TablePropertyDefinitionUtils .getDefaultDefinitionsByInheritanceLevel(InheritanceLevel.valueOf(scopeType.toUpperCase())); for (TablePropertyDefinition propDefinition : propDefinitions) { String propName = propDefinition.getName(); List<String> exceptProperties = getExceptProperties(); if (!exceptProperties.contains(propName)) { propertyNames.add(propName); } } return propertyNames; }
public boolean isFolderLevelProperty() { return InheritanceLevel.FOLDER.equals(inheritanceLevel); }
private boolean isCategoryProperties(String scope) { return InheritanceLevel.CATEGORY.getDisplayName().equals(scope); }
public List<String> getPropertyNamesList() { List<String> propertyNames = new ArrayList<String>(); TablePropertyDefinition[] propDefinitions = TablePropertyDefinitionUtils .getDefaultDefinitionsByInheritanceLevel(InheritanceLevel.valueOf(scopeType.toUpperCase())); for (TablePropertyDefinition propDefinition : propDefinitions) { String propName = propDefinition.getName(); List<String> exceptProperties = getExceptProperties(); if (!exceptProperties.contains(propName)) { propertyNames.add(propName); } } return propertyNames; }
public boolean isModuleLevelProperty() { return InheritanceLevel.MODULE.equals(inheritanceLevel); }
public static boolean isModulePropertyTable(TableSyntaxNode tableSyntaxNode) { boolean result = false; ITableProperties tableProperties = tableSyntaxNode.getTableProperties(); if (tableProperties != null) { String propValue = tableProperties.getScope(); if (StringUtils.isNotEmpty(propValue) && InheritanceLevel.MODULE.getDisplayName().equals(propValue)) { result = true; } } return result; }
public boolean isCategoryLevelProperty() { return InheritanceLevel.CATEGORY.equals(inheritanceLevel); }
private boolean isCategoryPropertyTable(TableSyntaxNode tableSyntaxNode) { boolean result = false; ITableProperties tableProperties = tableSyntaxNode.getTableProperties(); if (tableProperties != null) { String propValue = tableProperties.getScope(); if (StringUtils.isNotEmpty(propValue)) { if (InheritanceLevel.CATEGORY.getDisplayName().equals(propValue)) { result = true; } } } return result; }
public boolean isExternalPropery() { return InheritanceLevel.EXTERNAL.equals(inheritanceLevel); }
private void checkPropertiesLevel(InheritanceLevel currentLevel, TableProperties propertiesInstance, TableSyntaxNode tableSyntaxNode, IBindingContext bindingContext) throws SyntaxNodeException { for (String propertyNameToCheck : propertiesInstance.getAllProperties().keySet()) { if (!PropertiesChecker.isPropertySuitableForLevel(currentLevel, propertyNameToCheck)) { String message = String.format("Property '%s' can`t be defined on the '%s' level", propertyNameToCheck, currentLevel.getDisplayName()); throw SyntaxNodeExceptionUtils.createError(message, tableSyntaxNode); } } }
public boolean isProjectLevelProperty() { return InheritanceLevel.PROJECT.equals(inheritanceLevel); }
public static boolean isModulePropertyTable(TableSyntaxNode tableSyntaxNode) { boolean result = false; ITableProperties tableProperties = tableSyntaxNode.getTableProperties(); if (tableProperties != null) { String propValue = tableProperties.getScope(); if (StringUtils.isNotEmpty(propValue) && InheritanceLevel.MODULE.getDisplayName().equals(propValue)) { result = true; } } return result; }
public boolean isModuleLevelProperty() { return InheritanceLevel.MODULE.equals(inheritanceLevel); }
private boolean isCategoryPropertyTable(TableSyntaxNode tableSyntaxNode) { boolean result = false; ITableProperties tableProperties = tableSyntaxNode.getTableProperties(); if (tableProperties != null) { String propValue = tableProperties.getScope(); if (StringUtils.isNotEmpty(propValue)) { if (InheritanceLevel.CATEGORY.getDisplayName().equals(propValue)) { result = true; } } } return result; }