public static String getDataType(PMML pmmlDocument, String fieldName) { DataDictionary dataDictionary = pmmlDocument.getDataDictionary(); for (DataField dataField : dataDictionary.getDataFields()){ if (dataField.getName().equalsIgnoreCase(fieldName)) { DATATYPE datatype = dataField.getDataType(); if (datatype == DATATYPE.DOUBLE) { return XLSKeywords.DATATYPE_NUMBER; } else if (datatype == DATATYPE.STRING) { return XLSKeywords.DATATYPE_TEXT; } else if (datatype == DATATYPE.BOOLEAN) { return XLSKeywords.DATATYPE_BOOLEAN; } } } return null; }
public PMMLDataField(DataField field) { this.type = helper.mapDatatype(field.getDataType(), true); this.name = helper.compactAsJavaId(field.getName()); this.dataDictionaryField = field; }
private DataField copyDataField(DataField df) { if (df == null) { return null; } DataField copy = new DataField(); copy.setDataType(df.getDataType()); copy.setDisplayName(df.getDisplayName()); copy.setIsCyclic(df.getIsCyclic()); copy.setOptype(df.getOptype()); copy.setName(df.getName()); return copy; }