private StaticProperty getStaticPropertyByName(String name) { for(StaticProperty p : list) { if (p.getInternalName().equals(name)) return p; } return null; } }
public StaticProperty(StaticProperty other) { super(other); this.description = other.getDescription(); this.internalName = other.getInternalName(); this.valueRequired = other.isValueRequired(); this.staticPropertyType = other.getStaticPropertyType(); this.label = other.getLabel(); this.predefined = other.isPredefined(); }
private StaticProperty getCustomizedElement(String dom, String internalName) { StaticProperty staticProperty = pipelineTemplateInvocation .getStaticProperties() .stream() .filter(sp -> sp.getInternalName().equals(internalName)).findFirst().get(); staticProperty.setInternalName(staticProperty.getInternalName().replace(dom, "")); return staticProperty; }
public BoundPipelineElementBuilder withOverwrittenLabel(String internalStaticPropertyId, String newLabel) { this.streamPipesEntity.getStaticProperties().forEach(sp -> { sp.setPredefined(true); if (sp.getInternalName().equals(internalStaticPropertyId)) { sp.setLabel(newLabel); } }); return this; }
private Optional<RuntimeResolvableSelectionStaticProperty> findProperty(List<StaticProperty> staticProperties, String runtimeResolvablePropertyId) { return staticProperties.stream() .filter(sp -> sp.getInternalName().equals(runtimeResolvablePropertyId)) .filter(sp -> sp.getStaticPropertyType() == StaticPropertyType.RuntimeResolvableAnyStaticProperty || sp .getStaticPropertyType() == StaticPropertyType.RuntimeResolvableOneOfStaticProperty) .map(sp -> (RuntimeResolvableSelectionStaticProperty) sp) .findFirst(); } }
public BoundPipelineElementBuilder withPredefinedFreeTextValue(String internalStaticPropertyId, String value) { this.streamPipesEntity.getStaticProperties().stream().filter(sp -> sp instanceof FreeTextStaticProperty).forEach(sp -> { if (sp.getInternalName().equals(internalStaticPropertyId)) { sp.setPredefined(true); ((FreeTextStaticProperty) sp).setValue(value); } }); return this; }
protected <SP extends StaticProperty> SP prepareStaticProperty(Label label, SP element) { element.setInternalName(label.getInternalId()); element.setDescription(label.getDescription()); element.setLabel(label.getLabel()); return element; }
private List<StaticProperty> filter(List<StaticProperty> staticProperties) { return staticProperties .stream() // TODO fix (predefined is always true //.filter(sp -> !(sp instanceof MappingProperty)) .filter(sp -> !(sp.isPredefined())) .collect(Collectors.toList()); } }
private Optional<RuntimeResolvableSelectionStaticProperty> findProperty(List<StaticProperty> staticProperties, String runtimeResolvablePropertyId) { return staticProperties.stream() .filter(sp -> sp.getInternalName().equals(runtimeResolvablePropertyId)) .filter(sp -> sp.getStaticPropertyType() == StaticPropertyType.RuntimeResolvableAnyStaticProperty || sp .getStaticPropertyType() == StaticPropertyType.RuntimeResolvableOneOfStaticProperty) .map(sp -> (RuntimeResolvableSelectionStaticProperty) sp) .findFirst(); } }
public BoundPipelineElementBuilder withPredefinedSelection(String internalStaticPropertyId, List<String> selectedOptions) { this.streamPipesEntity.getStaticProperties().stream().filter(sp -> sp instanceof SelectionStaticProperty).forEach(sp -> { if (sp.getInternalName().equals(internalStaticPropertyId)) { sp.setPredefined(true); ((SelectionStaticProperty) sp).getOptions().forEach(o -> { if (selectedOptions.stream().anyMatch(so -> so.equals(o.getName()))) { o.setSelected(true); } }); } }); return this; }
private List<StaticProperty> filter(List<StaticProperty> staticProperties) { return staticProperties .stream() // TODO fix (predefined is always true //.filter(sp -> !(sp instanceof MappingProperty)) .filter(sp -> !(sp.isPredefined())) .collect(Collectors.toList()); } }
public StaticProperty getStaticPropertyByName(String name) { for(StaticProperty p : list) { if (p.getInternalName().equals(name)) return p; } return null; } }
private StaticProperty getCustomizedElement(String dom, String internalName) { StaticProperty staticProperty = pipelineTemplateInvocation .getStaticProperties() .stream() .filter(sp -> sp.getInternalName().equals(internalName)).findFirst().get(); staticProperty.setInternalName(staticProperty.getInternalName().replace(dom, "")); return staticProperty; }
private Optional<StaticProperty> findStaticProperty(List<StaticProperty> staticProperties, String sourceStaticProperty) { return staticProperties .stream() .filter(sp -> sp.getInternalName().equals(sourceStaticProperty)) .findFirst(); }
private List<StaticProperty> collectStaticProperties(Pipeline pipeline) { List<StaticProperty> staticProperties = new ArrayList<>(); pipeline.getSepas().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); pipeline.getActions().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); staticProperties .stream() .filter(sp -> sp instanceof MappingPropertyUnary) .forEach(mp -> ((MappingPropertyUnary) mp) .setMapsTo(URI.create(((MappingPropertyUnary) mp) .getMapsFromOptions() .get(0) .getElementId()))); return staticProperties; }
private Optional<MappingPropertyUnary> findMappingProperty(String mappingPropertyInternalName, List<StaticProperty> staticProperties) { return staticProperties .stream() .filter(sp -> sp.getInternalName().equals(mappingPropertyInternalName)) .map(sp -> (MappingPropertyUnary) sp) .findFirst(); }
private List<StaticProperty> collectStaticProperties(Pipeline pipeline) { List<StaticProperty> staticProperties = new ArrayList<>(); pipeline.getSepas().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); pipeline.getActions().forEach(pe -> { pe.getStaticProperties().forEach(sp -> sp.setInternalName(pe.getDOM() + sp.getInternalName())); staticProperties.addAll(pe.getStaticProperties()); }); staticProperties .stream() .filter(sp -> sp instanceof MappingPropertyUnary) .forEach(mp -> ((MappingPropertyUnary) mp) .setMapsTo(URI.create(((MappingPropertyUnary) mp) .getMapsFromOptions() .get(0) .getElementId()))); return staticProperties; }
private Optional<MappingPropertyUnary> findMappingProperty(String mappingPropertyInternalName, List<StaticProperty> staticProperties) { return staticProperties .stream() .filter(sp -> sp.getInternalName().equals(mappingPropertyInternalName)) .map(sp -> (MappingPropertyUnary) sp) .findFirst(); }
private boolean existsInCustomizedElements(String dom, StaticProperty staticProperty) { return pipelineTemplateInvocation .getStaticProperties() .stream() .anyMatch(sp -> sp.getInternalName().equals(dom +staticProperty.getInternalName())); }
private Optional<StaticProperty> findStaticProperty(List<StaticProperty> staticProperties, String sourceStaticProperty) { return staticProperties .stream() .filter(sp -> sp.getInternalName().equals(sourceStaticProperty)) .findFirst(); }