diff --git a/api/src/main/java/org/open4goods/api/services/backup/BackupService.java b/api/src/main/java/org/open4goods/api/services/backup/BackupService.java index bcb2b6b79..bcf3b5046 100644 --- a/api/src/main/java/org/open4goods/api/services/backup/BackupService.java +++ b/api/src/main/java/org/open4goods/api/services/backup/BackupService.java @@ -298,51 +298,12 @@ private Product translate(Product p) { // Attributes migration // Purging aggregated - p.getAttributes().getAggregatedAttributes().clear(); - - p.getAttributes().getUnmapedAttributes().forEach(e-> { - p.getAttributes().getAll().put(e.getName(), e); - - e.getSources().forEach(s -> { - SourcedAttribute sa = new SourcedAttribute(); - sa.setDataSourcename(s.getKey()); - sa.setValue(s.getValue()); - e.addSourceAttribute(sa); - - }); - e.getSources().clear(); - - }); - - p.getAttributes().getUnmapedAttributes().clear(); - - - - // Brands - - p.getAlternativeBrands().forEach(b -> { - - if (!b.getKey().equalsIgnoreCase(b.getValue())) { - p.getAkaBrands().put(b.getKey(), b.getValue().toUpperCase()); - } - }); - - - // Models - p.setAkaModels(p.getAlternativeModels()); - - - - p.getAttributes().setAggregatedAttributes(null); - p.getAttributes().setUnmapedAttributes(null); - p.setAlternativeBrands(null); - p.setAlternativeModels(null); - - try { - aggregationService.sanitize(p); - } catch (AggregationSkipException e) { - logger.error("Error in import, with product sanitisation",e); - } +// +// try { +// aggregationService.sanitize(p); +// } catch (AggregationSkipException e) { +// logger.error("Error in import, with product sanitisation",e); +// } // Setting datasources to new Map format diff --git a/commons/src/main/java/org/open4goods/commons/model/data/UnindexedKeyVal.java b/commons/src/main/java/org/open4goods/commons/model/data/UnindexedKeyVal.java deleted file mode 100644 index 32e1c0cdb..000000000 --- a/commons/src/main/java/org/open4goods/commons/model/data/UnindexedKeyVal.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.open4goods.commons.model.data; - -import org.springframework.data.elasticsearch.annotations.Field; -import org.springframework.data.elasticsearch.annotations.FieldType; -//TODO(design, p2) : This is a legacy due to elastic misconception, should be replaced my maps / sets -public class UnindexedKeyVal { - - - private String key; - private String value; - - public UnindexedKeyVal() { - super(); - } - - public UnindexedKeyVal(String key, String val) { - this.key = key; - this.value = val; - } - - - @Override - public int hashCode() { - return key.hashCode(); - } - - @Override - public boolean equals(Object obj) { - - if (obj instanceof UnindexedKeyVal || obj instanceof UnindexedKeyValTimestamp) { - return ((UnindexedKeyVal)obj).key.equals(key); - } - return false; - } - - - @Override - public String toString() { - return value; - } - - public void setKey(String key) { - this.key = key; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - - public String getKey() { - return key; - } - - -} diff --git a/commons/src/main/java/org/open4goods/commons/model/data/UnindexedKeyValTimestamp.java b/commons/src/main/java/org/open4goods/commons/model/data/UnindexedKeyValTimestamp.java deleted file mode 100644 index d96ff199e..000000000 --- a/commons/src/main/java/org/open4goods/commons/model/data/UnindexedKeyValTimestamp.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.open4goods.commons.model.data; - -// TODO(design, p2) : This is a legacy due to elastic misconception, should be replaced my maps / sets -public class UnindexedKeyValTimestamp extends UnindexedKeyVal{ - - - private long ts; - - - public UnindexedKeyValTimestamp() { - super(); - } - - public UnindexedKeyValTimestamp(String key, String value) { - super(key, value); - this.ts=System.currentTimeMillis(); - } - - public long getTs() { - return ts; - } - - public void setTs(long ts) { - this.ts = ts; - } - - - - - -} diff --git a/commons/src/main/java/org/open4goods/commons/model/product/Product.java b/commons/src/main/java/org/open4goods/commons/model/product/Product.java index 29eadb7a2..c5e2b1e01 100644 --- a/commons/src/main/java/org/open4goods/commons/model/product/Product.java +++ b/commons/src/main/java/org/open4goods/commons/model/product/Product.java @@ -32,7 +32,6 @@ import org.open4goods.commons.model.data.AiDescriptions; import org.open4goods.commons.model.data.Resource; import org.open4goods.commons.model.data.Score; -import org.open4goods.commons.model.data.UnindexedKeyValTimestamp; import org.open4goods.commons.services.StandardiserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,18 +94,11 @@ public class Product implements Standardisable { /** If true, means the item is excluded from vertical representation (because not enough data, ....)**/ private boolean excluded = false; - /** The list of other model's known for this product **/ - // TODO(p1) : remove once migration - private Set alternativeModels = new HashSet<>(); - /** The list of other model's known for this product **/ private Set akaModels = new HashSet<>(); /** The list of other id's known for this product **/ - // TODO(p1, design) : Remove once migration - private Set alternativeBrands = new HashSet<>(); - private Map akaBrands = new HashMap(); @@ -668,15 +660,6 @@ public String shortestModel() { - - public Set getAlternativeBrands() { - return alternativeBrands; - } - public void setAlternativeBrands(Set alternativeBrands) { - this.alternativeBrands = alternativeBrands; - } - - public Long getId() { return id; } @@ -818,14 +801,6 @@ public void setCoverImagePath(String coverImagePath) { this.coverImagePath = coverImagePath; } - public Set getAlternativeModels() { - return alternativeModels; - } - - public void setAlternativeModels(Set alternativeModels) { - this.alternativeModels = alternativeModels; - } - public boolean isExcluded() { return excluded; } diff --git a/commons/src/main/java/org/open4goods/commons/model/product/ProductAttribute.java b/commons/src/main/java/org/open4goods/commons/model/product/ProductAttribute.java index 41a608983..5fd94e01b 100644 --- a/commons/src/main/java/org/open4goods/commons/model/product/ProductAttribute.java +++ b/commons/src/main/java/org/open4goods/commons/model/product/ProductAttribute.java @@ -1,15 +1,7 @@ package org.open4goods.commons.model.product; -import java.util.Comparator; -import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.open4goods.commons.model.data.UnindexedKeyValTimestamp; public class ProductAttribute extends SourcableAttribute implements IAttribute { @@ -29,13 +21,6 @@ public class ProductAttribute extends SourcableAttribute implements IAttribute { // TODO(p1, design) : remove after migration private Double numericValue; - /** - * The collections of conflicts for this attribute - * */ - // TODO(p1, design) : remove after migration - private Set sources = new HashSet<>(); - - /** * The attribute raw rawValue @@ -155,14 +140,6 @@ public void setIcecatTaxonomyIds(Set icecatTaxonomyIds) { this.icecatTaxonomyIds = icecatTaxonomyIds; } - public Set getSources() { - return sources; - } - - public void setSources(Set sources) { - this.sources = sources; - } - public Set getSource() { return source; } diff --git a/commons/src/main/java/org/open4goods/commons/model/product/ProductAttributes.java b/commons/src/main/java/org/open4goods/commons/model/product/ProductAttributes.java index 94edcf54c..f883ebf70 100644 --- a/commons/src/main/java/org/open4goods/commons/model/product/ProductAttributes.java +++ b/commons/src/main/java/org/open4goods/commons/model/product/ProductAttributes.java @@ -18,17 +18,9 @@ public class ProductAttributes { */ private Map referentielAttributes = new HashMap<>(); - //TODO(p1,design): remove when migration done - private Map aggregatedAttributes = new HashMap<>(); - private Map indexed = new HashMap<>(); - //TODO(p1,design): remove when migration done - - private Set unmapedAttributes = new HashSet<>(); - - private Map all = new HashMap<>(); @Transient @@ -74,7 +66,6 @@ public String toString() { return "ref:"+referentielAttributes.size()+ " , indexed:"+indexed.size() +" , all:"+all.size(); } - public int count() { @@ -114,16 +105,6 @@ public Map referentielAttributesAsStringKeys() { )); } - - - -// public Set getFeatures() { -// return features; -// } -// -// public void setFeatures(Set features) { -// this.features = features; -// } @@ -158,27 +139,5 @@ public Map getAll() { public void setAll(Map all) { this.all = all; } - - public Map getAggregatedAttributes() { - return aggregatedAttributes; - } - - public void setAggregatedAttributes(Map aggregatedAttributes) { - this.aggregatedAttributes = aggregatedAttributes; - } - - public Set getUnmapedAttributes() { - return unmapedAttributes; - } -// -// public void setUnmapedAttributes(Set unmapedAttributes) { -// this.unmapedAttributes = unmapedAttributes; -// } -// - - public void setUnmapedAttributes(Set unmapedAttributes) { - this.unmapedAttributes = unmapedAttributes; - } - }