private static void _addIdSchemaField( List<Schema.Field> fields, Set<String> names) { String safeIdFieldName = "_id"; names.add(safeIdFieldName); Schema.Field designField = new Schema.Field( safeIdFieldName, AvroUtils.wrapAsNullable(AvroUtils._string()), null, (Object)null); // This is the first column in the schema fields.add(0, designField); }
private static Schema _getDeleteSchema() { List<Schema.Field> schemaFields = new ArrayList<>(1); Schema.Field designField = new Schema.Field( AvroConstants.ID, AvroUtils._string(), null, (Object)null); designField.addProp(SchemaConstants.TALEND_IS_LOCKED, "true"); schemaFields.add(designField); Schema schema = Schema.createRecord( "Runtime", null, null, false, schemaFields); return schema; }
fieldName, AvroUtils.wrapAsNullable(AvroUtils._string()), null, (Object)null);
public static Schema createRejectSchema(Schema inputSchema) { final List<Schema.Field> rejectFields = new ArrayList<>(); Schema.Field field = new Schema.Field( FIELD_ERROR_MESSAGE, AvroUtils.wrapAsNullable(AvroUtils._string()), null, (Object)null); field.addProp(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "255"); field.addProp(SchemaConstants.TALEND_FIELD_GENERATED, "true"); field.addProp(SchemaConstants.TALEND_IS_LOCKED, "true"); rejectFields.add(field); Schema rejectSchema = SchemaUtils.newSchema( inputSchema, "rejectOutput", rejectFields); return rejectSchema; }
private void _setupSchemas() { Schema.Field docIdField = new Schema.Field( "resourceId", AvroUtils._string(), null, (Object)null, Schema.Field.Order.ASCENDING); docIdField.addProp(SchemaConstants.TALEND_FIELD_GENERATED, "true"); docIdField.addProp(SchemaConstants.TALEND_IS_LOCKED, "true"); List<Schema.Field> fields = new ArrayList<>(); fields.add(docIdField); Schema initialSchema = Schema.createRecord( "liferay", null, null, false, fields); resource.main.schema.setValue(initialSchema); _updateOutputSchemas(); }
fieldName, AvroUtils.wrapAsNullable(AvroUtils._string()), null, (Object)null);
public static Schema inferSchemaByResourceType( ApioApiDocumentation.SupportedClass resourceSupportedClass) { List<Property> supportedProperties = resourceSupportedClass.getSupportedProperties(); List<Schema.Field> schemaFields = new ArrayList<>( supportedProperties.size() + 1); // Already used names for the fields Set<String> fieldNames = new HashSet<>(); _addIdSchemaField(schemaFields, fieldNames); int i = 1; for (Property supportedProperty : supportedProperties) { String fieldName = NameUtil.correct( supportedProperty.getName(), i, fieldNames); fieldNames.add(fieldName); Schema.Field designField = new Schema.Field( fieldName, AvroUtils.wrapAsNullable(AvroUtils._string()), null, (Object)null); schemaFields.add(i, designField); i++; } Schema schema = Schema.createRecord( "Runtime", null, null, false, schemaFields); return schema; }
/** * Returns schema of avro data */ @Override public Schema getSchema() { return AvroUtils._string(); }
public void setupSchema() { Schema.Field docIdField = new Schema.Field("docId", AvroUtils._string(), null, (Object) null, Schema.Field.Order.ASCENDING); docIdField.addProp(SchemaConstants.TALEND_IS_LOCKED, "true"); Schema.Field newDocContentField = new Schema.Field("docContent", AvroUtils._string(), null, (Object) null, Schema.Field.Order.IGNORE); List<Schema.Field> fields = new ArrayList<>(); fields.add(docIdField); fields.add(newDocContentField); Schema initialSchema = Schema.createRecord("markLogic", null, null, false, fields); main.schema.setValue(initialSchema); }
/** * Created default field for dynamic,default Length and Precision keep same with old behavior */ protected static Schema.Field getDefaultField(String columnName, String defaultValue) { Schema.Field avroField = new Schema.Field(columnName, AvroUtils._string(), null, defaultValue); avroField.addProp(SchemaConstants.TALEND_COLUMN_DB_LENGTH, String.valueOf(100)); avroField.addProp(SchemaConstants.TALEND_COLUMN_PRECISION, String.valueOf(0)); return avroField; } }
/** * Sets initial value of schema property */ void setupSchema() { Schema stringSchema = AvroUtils._string(); // create Schema for JSON Schema.Field jsonField = new Schema.Field("json", stringSchema, null, (Object) null, Order.ASCENDING); Schema initialSchema = Schema.createRecord("jira", null, null, false, Collections.singletonList(jsonField)); initialSchema.addProp(TALEND_IS_LOCKED, "true"); schema.schema.setValue(initialSchema); }
public Schema getContainerSchema() { return SchemaBuilder.builder().record("Main").fields()// .name("containerName").prop(SchemaConstants.TALEND_COLUMN_IS_KEY, "true") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "100").type(AvroUtils._string()).noDefault()// .endRecord(); }
@Override public void setupProperties() { super.setupProperties(); Schema s = SchemaBuilder.record("Main").fields() // .name("ContainerName").prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "50")// $NON-NLS-3$ .prop(SchemaConstants.TALEND_IS_LOCKED, "true")//$NON-NLS-1$ // .type(AvroUtils._string()).noDefault().endRecord(); schema.schema.setValue(s); }
@Override public void setupProperties() { super.setupProperties(); Schema s = SchemaBuilder.record("Main").fields() // .name("ContainerName").prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "50")// $NON-NLS-3$ .prop(SchemaConstants.TALEND_IS_LOCKED, "true")//$NON-NLS-1$ // .type(AvroUtils._string()).noDefault().endRecord(); schema.schema.setValue(s); }
@Override public void setupProperties() { super.setupProperties(); Schema s = SchemaBuilder.record("Main").fields().name("BlobName").prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "300")// $NON-NLS-3$ .prop(SchemaConstants.TALEND_IS_LOCKED, "true")//$NON-NLS-1$ .type(AvroUtils._string()).noDefault().endRecord(); schema.schema.setValue(s); }
@Override public void setupProperties() { super.setupProperties(); dieOnError.setValue(true); Schema s = SchemaBuilder.record("QueueList").fields().name("QueueName").prop(SchemaConstants.TALEND_IS_LOCKED, "true") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "63").type(AvroUtils._string()).noDefault().endRecord(); schema.schema.setValue(s); }
@Override public void setupProperties() { super.setupProperties(); dieOnError.setValue(true); Schema s = SchemaBuilder.record("QueueList").fields().name("QueueName").prop(SchemaConstants.TALEND_IS_LOCKED, "true") .prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, "63").type(AvroUtils._string()).noDefault().endRecord(); schema.schema.setValue(s); }
public static Schema createTestSchema4(String tablename) { FieldAssembler<Schema> builder = SchemaBuilder.builder().record(tablename).fields(); Schema schema = AvroUtils._string();// TODO : fix it as should be object type schema = wrap(schema); builder = builder.name("RESULTSET").prop(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME, "RESULTSET").type(schema) .noDefault(); return builder.endRecord(); }
public static Schema createSPSchema2(String tablename) { FieldAssembler<Schema> builder = SchemaBuilder.builder().record(tablename).fields(); Schema schema = AvroUtils._string(); schema = wrap(schema); builder = builder.name("PARAMETER").prop(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME, "PARAMETER").type(schema) .noDefault(); return builder.endRecord(); }
public static Schema createTestSchema(String tablename) { FieldAssembler<Schema> builder = SchemaBuilder.builder().record(tablename).fields(); Schema schema = AvroUtils._int(); schema = wrap(schema); builder = builder.name("ID").prop(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME, "ID").type(schema).noDefault(); schema = AvroUtils._string(); schema = wrap(schema); builder = builder.name("NAME").prop(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME, "NAME").type(schema).noDefault(); return builder.endRecord(); }