private FieldType[] _buildFieldArray(JMSMLConfigETLConfigSchemaContainerSchemasSchema schema) { // Build an order-sorted array of fields for the given schema. FieldType[] fields = {}; string[] schemaTypes = schema.SchemaTypeIDs.Split(' '); // For each schema type in the schema, fined that type and fetch its fields. // Then concatenate the fields. foreach (string id in schemaTypes) { JMSMLConfigETLConfigSchemaType schemaType = _findSchemaType(id); if (schemaType != null) { fields = fields.Concat(schemaType.Fields).ToArray(); } } // Now concat the fields that are unique to this schema. fields = fields.Concat(schema.Fields).ToArray(); // Now sort the array of fields based on their Order property. fields = fields.OrderBy(x => int.Parse(x.Order)).ToArray(); return(fields); }
private JMSMLConfigETLConfigSchemaType _findSchemaType(string id) { // Find a schema type given its ID. JMSMLConfigETLConfigSchemaType result = null; if (_etlConfig != null) { foreach (JMSMLConfigETLConfigSchemaType schemaType in _etlConfig.SchemaTypes) { if (id == schemaType.ID) { result = schemaType; break; } } } return(result); }