public boolean Validate(ParserSession PS, View ParentView) { int Errs = PS.getErrorCount(); _ParentView = ParentView; // Mandatories if (_Columns == null || _Columns.length == 0) return PS.AddError( "View '" + ParentView.getFullName() + "' is defining a groupBy without any columns."); Set<String> Names = new HashSet<String>(); for (String gb : _Columns) { if (TextUtil.isNullOrEmpty(gb) == true) continue; Column C = ParentView.getColumn(gb); if (C == null) { PS.AddError( "View '" + ParentView._Name + "' defined a groupBy with an unknown column '" + gb + "'."); continue; } if (Names.add(C.getFullName()) == false) { PS.AddError( "View '" + ParentView._Name + "' defined a groupBy with a duplicated column '" + gb + "'."); continue; } _GroupByObjs.add(C); } if (_Count == true) { // ViewColumn VC = new ViewColumn(); // VC._ } return Errs == PS.getErrorCount(); }
public boolean Validate(ParserSession PS, Schema ParentSchema, int pos) { int Errs = PS.getErrorCount(); _ParentSchema = ParentSchema; LOG.debug(" Validating Enumeration " + _Name + "."); // Mandatories if (TextUtil.isNullOrEmpty(_Name) == true) return PS.AddError( "Schema '" + _ParentSchema.getFullName() + "' is declaring an enumeration '" + _Name + "' without a name."); if (ValidationHelper.isValidIdentifier(_Name) == false) return PS.AddError( "Schema '" + _ParentSchema.getFullName() + "' is declaring an enumeration '" + _Name + "' with a name which is not valid. " + ValidationHelper._ValidIdentifierMessage); if (TextUtil.isNullOrEmpty(_Description) == true) return PS.AddError( "Schema '" + _ParentSchema.getFullName() + "' is declaring an enumeration '" + _Name + "' without a description."); if (_Id == null) return PS.AddError( "Schema '" + _ParentSchema.getFullName() + "' is declaring an enumeration '" + _Name + "' without an Id type."); if (_Value == null) return PS.AddError( "Schema '" + _ParentSchema.getFullName() + "' is declaring an enumeration '" + _Name + "' without a Value type."); Object O = new Object(); O._FST = FrameworkSourcedType.ENUMERATION; O._Name = _Name; O._Description = _Description; Column C = new Column( "id", _Id._TypeStr, _Id._Size, false, ColumnMode.NORMAL, true, null, "The id for this enumeration."); O._Columns.add(C); C = new Column( "value", _Value._TypeStr, _Value._Size, false, ColumnMode.NORMAL, true, null, "The value for this enumeration."); O._Columns.add(C); C = new Column( "label", ColumnType.STRING.toString(), 254, false, ColumnMode.NORMAL, false, ProtectionType.ABSOLUTE, "The label for this enumeration."); O._Columns.add(C); C = new Column( "deactivated", ColumnType.DATETIME.toString(), null, true, ColumnMode.NORMAL, false, null, "The label for this enumeration."); C._FrameworkManaged = true; O._Columns.add(C); PrimaryKey PK = new PrimaryKey(); PK._Columns = new String[] {"id"}; O._PrimaryKey = PK; O._Indices = new ArrayList<Index>(); Index I = new Index(); I._Name = "Id"; I._Columns = new String[] {"id"}; I._Db = true; O._Indices.add(I); I = new Index(); I._Name = "Value"; I._Columns = new String[] {"value"}; I._Db = true; O._Indices.add(I); I = new Index(); I._Name = "All"; I._OrderBy = new String[] {"id"}; I._Db = false; O._Indices.add(I); _ParentSchema._Objects.add(pos, O); return Errs == PS.getErrorCount(); }