use of com.hortonworks.registries.common.Schema.Field in project streamline by hortonworks.
the class MLModel method getPrimaryKey.
@JsonIgnore
@Override
public PrimaryKey getPrimaryKey() {
Map<Field, Object> fieldObjectMap = new HashMap<>();
fieldObjectMap.put(new Schema.Field(ID, Type.LONG), this.id);
return new PrimaryKey(fieldObjectMap);
}
use of com.hortonworks.registries.common.Schema.Field in project streamline by hortonworks.
the class TopologyStream method setFieldsData.
// for internal storage, not part of JSON
@JsonIgnore
public void setFieldsData(String fieldsData) throws Exception {
if (fieldsData == null || fieldsData.isEmpty()) {
return;
}
ObjectMapper mapper = new ObjectMapper();
fields = mapper.readValue(fieldsData, new TypeReference<List<Field>>() {
});
}
use of com.hortonworks.registries.common.Schema.Field in project streamline by hortonworks.
the class TopologyStream method getPrimaryKey.
@JsonIgnore
@Override
public PrimaryKey getPrimaryKey() {
Map<Field, Object> fieldToObjectMap = new HashMap<>();
fieldToObjectMap.put(new Schema.Field(ID, Schema.Type.LONG), this.id);
fieldToObjectMap.put(new Schema.Field(VERSIONID, Schema.Type.LONG), this.versionId);
return new PrimaryKey(fieldToObjectMap);
}
use of com.hortonworks.registries.common.Schema.Field in project streamline by hortonworks.
the class TopologyStream method fromMap.
@Override
public Storable fromMap(Map<String, Object> map) {
setId((Long) map.get(ID));
setVersionId((Long) map.get(VERSIONID));
setStreamId((String) map.get(STREAMID));
setDescription((String) map.get(DESCRIPTION));
setTopologyId((Long) map.get(TOPOLOGYID));
ObjectMapper mapper = new ObjectMapper();
String fieldsDataStr = (String) map.get(FIELDSDATA);
if (!StringUtils.isEmpty(fieldsDataStr)) {
List<Field> fields;
try {
fields = mapper.readValue(fieldsDataStr, new TypeReference<List<Field>>() {
});
} catch (IOException e) {
throw new RuntimeException(e);
}
setFields(fields);
}
return this;
}
use of com.hortonworks.registries.common.Schema.Field in project registry by hortonworks.
the class MLModel method getPrimaryKey.
@JsonIgnore
@Override
public PrimaryKey getPrimaryKey() {
Map<Field, Object> fieldObjectMap = new HashMap<>();
fieldObjectMap.put(new Schema.Field(ID, Type.LONG), this.id);
return new PrimaryKey(fieldObjectMap);
}
Aggregations