@Override public ExtractionController controllerBy(BandOrientation orientation) { return extractionControllerMap.getOrDefault(BandOrientation.defaultIfNull(orientation), defaultExtractionController); }
public static BandOrientation fromId(String id) { for (BandOrientation orientation : values()) { if (orientation.id.equals(id)) { return orientation; } } return UNDEFINED; }
@Override public BandOrientation deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { return BandOrientation.defaultIfNull(BandOrientation.fromId(p.getValueAsString())); } }
protected void parseChildBandDefinitions(Element bandDefinitionElement, BandBuilder parentBandDefinitionBuilder) throws FileNotFoundException, ClassNotFoundException { Element childrenBandsElement = bandDefinitionElement.element("bands"); if (childrenBandsElement != null) { List<Element> childrenBands = childrenBandsElement.elements("band"); for (Element childBandElement : childrenBands) { String childBandName = childBandElement.attribute("name").getText(); BandOrientation orientation = BandOrientation.fromId(childBandElement.attribute("orientation").getText()); BandBuilder childBandDefinitionBuilder = new BandBuilder() .name(childBandName) .orientation(orientation); parseQueries(childBandElement, childBandDefinitionBuilder); parseChildBandDefinitions(childBandElement, childBandDefinitionBuilder); ReportBand childBandDefinition = childBandDefinitionBuilder.build(); parentBandDefinitionBuilder.child(childBandDefinition); } } }
protected void parseChildBandDefinitions(Element bandDefinitionElement, BandBuilder parentBandDefinitionBuilder) throws FileNotFoundException, ClassNotFoundException { Element childrenBandsElement = bandDefinitionElement.element("bands"); if (childrenBandsElement != null) { List<Element> childrenBands = childrenBandsElement.elements("band"); for (Element childBandElement : childrenBands) { String childBandName = childBandElement.attribute("name").getText(); BandOrientation orientation = BandOrientation.fromId(childBandElement.attribute("orientation").getText()); BandBuilder childBandDefinitionBuilder = new BandBuilder() .name(childBandName) .orientation(orientation); parseQueries(childBandElement, childBandDefinitionBuilder); parseChildBandDefinitions(childBandElement, childBandDefinitionBuilder); ReportBand childBandDefinition = childBandDefinitionBuilder.build(); parentBandDefinitionBuilder.child(childBandDefinition); } } }
@Override public ExtractionController controllerBy(BandOrientation orientation) { return extractionControllerMap.getOrDefault(BandOrientation.defaultIfNull(orientation), defaultExtractionController); }
public static BandOrientation fromId(String id) { for (BandOrientation orientation : values()) { if (orientation.id.equals(id)) { return orientation; } } return UNDEFINED; }
@Override public BandOrientation getBandOrientation() { return BandOrientation.defaultIfNull(getOrientation() != null ? getOrientation().getBandOrientation(): null); } }