Class CsvTransformer
java.lang.Object
ddf.catalog.transformer.csv.common.CsvTransformer
Common Library used to transform
Metacards into CSV text.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ddf.catalog.data.BinaryContentcreateResponse(Appendable csv) static Set<ddf.catalog.data.AttributeDescriptor> getAllCsvAttributeDescriptors(List<ddf.catalog.data.Metacard> metacards) Given a list ofMetacards, returns a set ofAttributeDescriptors that contains all attributes that exist on the given metacard types.static Set<ddf.catalog.data.AttributeDescriptor> getNonEmptyValueAttributes(List<ddf.catalog.data.Metacard> metacards) Given a list ofMetacards, return only the attribute descriptors that have a non-empty value.static Set<ddf.catalog.data.AttributeDescriptor> getOnlyRequestedAttributes(List<ddf.catalog.data.Metacard> metacards, Set<String> requestedAttributes) Given a list ofMetacards and a string set of requested attributes, returns a set ofAttributeDescriptors containing the requested attributes.static List<ddf.catalog.data.AttributeDescriptor> sortAttributes(Set<ddf.catalog.data.AttributeDescriptor> attributeSet, List<String> attributeOrder) static AppendablewriteMetacardsToCsv(List<ddf.catalog.data.Metacard> metacards, List<ddf.catalog.data.AttributeDescriptor> orderedAttributeDescriptors, Map<String, String> aliasMap)
-
Method Details
-
createResponse
-
writeMetacardsToCsv
public static Appendable writeMetacardsToCsv(List<ddf.catalog.data.Metacard> metacards, List<ddf.catalog.data.AttributeDescriptor> orderedAttributeDescriptors, Map<String, String> aliasMap) throws ddf.catalog.transform.CatalogTransformerException- Throws:
ddf.catalog.transform.CatalogTransformerException
-
sortAttributes
-
getAllCsvAttributeDescriptors
public static Set<ddf.catalog.data.AttributeDescriptor> getAllCsvAttributeDescriptors(List<ddf.catalog.data.Metacard> metacards) Given a list ofMetacards, returns a set ofAttributeDescriptors that contains all attributes that exist on the given metacard types. Object and Binary types are excluded- Parameters:
metacards- List of metacards from which to extract attribute descriptors- Returns:
- a Set of s that are on each metacard
-
getOnlyRequestedAttributes
public static Set<ddf.catalog.data.AttributeDescriptor> getOnlyRequestedAttributes(List<ddf.catalog.data.Metacard> metacards, Set<String> requestedAttributes) Given a list ofMetacards and a string set of requested attributes, returns a set ofAttributeDescriptors containing the requested attributes. -
getNonEmptyValueAttributes
public static Set<ddf.catalog.data.AttributeDescriptor> getNonEmptyValueAttributes(List<ddf.catalog.data.Metacard> metacards) Given a list ofMetacards, return only the attribute descriptors that have a non-empty value. Returns a set ofAttributeDescriptors containing the attributes with non-empty values.
-