From 8641cc63ddaab4984bc87677a865be8c55e4c63b Mon Sep 17 00:00:00 2001
From: Martin Lowe <martin.lowe@eclipse-foundation.org>
Date: Tue, 22 Oct 2019 15:00:06 -0400
Subject: [PATCH] Rename 'name' in BaseNode to 'title' #38

Renamed name to title, updated database fields to match.

Change-Id: I2fefc1b6426644a57b902c4a29d893dc1704c049
Signed-off-by: Martin Lowe <martin.lowe@eclipse-foundation.org>
---
 .../marketplace/dto/Listing.java               |  2 +-
 .../marketplace/dto/NodeBase.java              | 18 +++++++++---------
 .../marketplace/dto/codecs/CatalogCodec.java   |  4 ++--
 .../dto/codecs/ErrorReportCodec.java           |  2 +-
 .../marketplace/dto/codecs/ListingCodec.java   |  4 ++--
 .../marketplace/dto/codecs/MarketCodec.java    |  4 ++--
 .../dto/converters/CategoryConverter.java      |  4 ++--
 .../namespace/DatabaseFieldNames.java          |  2 +-
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/Listing.java b/src/main/java/org/eclipsefoundation/marketplace/dto/Listing.java
index 40c5c01..d1a7cb3 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/Listing.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/Listing.java
@@ -385,7 +385,7 @@ public class Listing extends NodeBase {
 		StringBuilder sb = new StringBuilder();
 		sb.append("Listing [");
 		sb.append(", id=").append(getId());
-		sb.append(", name=").append(getName());
+		sb.append(", name=").append(getTitle());
 		sb.append(", url=").append(getUrl());
 		sb.append(", supportUrl=").append(supportUrl);
 		sb.append(", homepageUrl=").append(homepageUrl);
diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/NodeBase.java b/src/main/java/org/eclipsefoundation/marketplace/dto/NodeBase.java
index 278f294..3035305 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/NodeBase.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/NodeBase.java
@@ -15,7 +15,7 @@ import java.util.Objects;
  */
 public class NodeBase {
 	private String id;
-	private String name;
+	private String title;
 	private String url;
 
 	/**
@@ -33,17 +33,17 @@ public class NodeBase {
 	}
 
 	/**
-	 * @return the name
+	 * @return the title
 	 */
-	public String getName() {
-		return name;
+	public String getTitle() {
+		return title;
 	}
 
 	/**
-	 * @param name the name to set
+	 * @param title the title to set
 	 */
-	public void setName(String name) {
-		this.name = name;
+	public void setTitle(String title) {
+		this.title = title;
 	}
 
 	/**
@@ -62,7 +62,7 @@ public class NodeBase {
 
 	@Override
 	public int hashCode() {
-		return Objects.hash(id, name, url);
+		return Objects.hash(id, title, url);
 	}
 
 	@Override
@@ -77,6 +77,6 @@ public class NodeBase {
 			return false;
 		}
 		NodeBase other = (NodeBase) obj;
-		return Objects.equals(id, other.id) && Objects.equals(name, other.name) && Objects.equals(url, other.url);
+		return Objects.equals(id, other.id) && Objects.equals(title, other.title) && Objects.equals(url, other.url);
 	}
 }
diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/CatalogCodec.java b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/CatalogCodec.java
index 15626de..cfa9cd7 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/CatalogCodec.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/CatalogCodec.java
@@ -51,7 +51,7 @@ public class CatalogCodec implements CollectibleCodec<Catalog> {
 		Document doc = new Document();
 
 		doc.put(DatabaseFieldNames.DOCID, value.getId());
-		doc.put(DatabaseFieldNames.NAME, value.getName());
+		doc.put(DatabaseFieldNames.TITLE, value.getTitle());
 		doc.put(DatabaseFieldNames.URL, value.getUrl());
 		doc.put(DatabaseFieldNames.CATALOG_ICON, value.getIcon());
 		doc.put(DatabaseFieldNames.CATALOG_SELF_CONTAINED, value.isSelfContained());
@@ -73,7 +73,7 @@ public class CatalogCodec implements CollectibleCodec<Catalog> {
 		Catalog out = new Catalog();
 		out.setId(document.getString(DatabaseFieldNames.DOCID));
 		out.setUrl(document.getString(DatabaseFieldNames.URL));
-		out.setName(document.getString(DatabaseFieldNames.NAME));
+		out.setTitle(document.getString(DatabaseFieldNames.TITLE));
 		out.setIcon(document.getString(DatabaseFieldNames.CATALOG_ICON));
 		out.setSelfContained(document.getBoolean(DatabaseFieldNames.CATALOG_SELF_CONTAINED));
 		out.setSearchEnabled(document.getBoolean(DatabaseFieldNames.CATALOG_SEARCH_ENABLED));
diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ErrorReportCodec.java b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ErrorReportCodec.java
index ac2915a..e8dc9b5 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ErrorReportCodec.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ErrorReportCodec.java
@@ -43,7 +43,7 @@ public class ErrorReportCodec implements CollectibleCodec<ErrorReport> {
 		Document doc = new Document();
 
 		doc.put(DatabaseFieldNames.DOCID, value.getId());
-		doc.put(DatabaseFieldNames.NAME, value.getTitle());
+		doc.put(DatabaseFieldNames.TITLE, value.getTitle());
 		doc.put(DatabaseFieldNames.ERROR_BODY, value.getBody());
 		doc.put(DatabaseFieldNames.ERROR_DETAILED_MESSAGE, value.getDetailedMessage());
 		doc.put(DatabaseFieldNames.ERROR_READ, value.isRead());
diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ListingCodec.java b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ListingCodec.java
index 59dc2f0..19daaff 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ListingCodec.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/ListingCodec.java
@@ -65,7 +65,7 @@ public class ListingCodec implements CollectibleCodec<Listing> {
 
 		// for each of the fields, get the value from the unencoded object and set it
 		doc.put(DatabaseFieldNames.DOCID, value.getId());
-		doc.put(DatabaseFieldNames.NAME, value.getName());
+		doc.put(DatabaseFieldNames.TITLE, value.getTitle());
 		doc.put(DatabaseFieldNames.URL, value.getUrl());
 		doc.put(DatabaseFieldNames.SUPPORT_PAGE_URL, value.getSupportUrl());
 		doc.put(DatabaseFieldNames.HOME_PAGE_URL, value.getHomepageUrl());
@@ -105,7 +105,7 @@ public class ListingCodec implements CollectibleCodec<Listing> {
 		
 		// for each field, get the value from the encoded object and set it in POJO
 		out.setId(document.getString(DatabaseFieldNames.DOCID));
-		out.setName(document.getString(DatabaseFieldNames.NAME));
+		out.setTitle(document.getString(DatabaseFieldNames.TITLE));
 		out.setUrl(document.getString(DatabaseFieldNames.URL));
 		out.setSupportUrl(document.getString(DatabaseFieldNames.SUPPORT_PAGE_URL));
 		out.setHomepageUrl(document.getString(DatabaseFieldNames.HOME_PAGE_URL));
diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/MarketCodec.java b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/MarketCodec.java
index 610a036..4a2631d 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/MarketCodec.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/codecs/MarketCodec.java
@@ -47,7 +47,7 @@ public class MarketCodec implements CollectibleCodec<Market> {
 
 		doc.put(DatabaseFieldNames.DOCID, value.getId());
 		doc.put(DatabaseFieldNames.URL, value.getUrl());
-		doc.put(DatabaseFieldNames.NAME, value.getName());
+		doc.put(DatabaseFieldNames.TITLE, value.getTitle());
 		doc.put(DatabaseFieldNames.CATEGORY_IDS, value.getCategoryIds());
 
 		documentCodec.encode(writer, doc, encoderContext);
@@ -64,7 +64,7 @@ public class MarketCodec implements CollectibleCodec<Market> {
 		Market out = new Market();
 		out.setId(document.getString(DatabaseFieldNames.DOCID));
 		out.setUrl(document.getString(DatabaseFieldNames.URL));
-		out.setName(document.getString(DatabaseFieldNames.NAME));
+		out.setTitle(document.getString(DatabaseFieldNames.TITLE));
 		
 		return out;
 	}
diff --git a/src/main/java/org/eclipsefoundation/marketplace/dto/converters/CategoryConverter.java b/src/main/java/org/eclipsefoundation/marketplace/dto/converters/CategoryConverter.java
index d887ae2..14d0aaf 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/dto/converters/CategoryConverter.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/dto/converters/CategoryConverter.java
@@ -21,7 +21,7 @@ public class CategoryConverter implements Converter<Category> {
 	public Category convert(Document src) {
 		Category out = new Category();
 		out.setId(src.getString(DatabaseFieldNames.DOCID));
-		out.setName(src.getString(DatabaseFieldNames.NAME));
+		out.setTitle(src.getString(DatabaseFieldNames.TITLE));
 		out.setUrl(src.getString(DatabaseFieldNames.URL));
 		return out;
 	}
@@ -30,7 +30,7 @@ public class CategoryConverter implements Converter<Category> {
 	public Document convert(Category src) {
 		Document doc = new Document();
 		doc.put(DatabaseFieldNames.DOCID, src.getId());
-		doc.put(DatabaseFieldNames.NAME, src.getName());
+		doc.put(DatabaseFieldNames.TITLE, src.getTitle());
 		doc.put(DatabaseFieldNames.URL, src.getUrl());
 		return doc;
 	}
diff --git a/src/main/java/org/eclipsefoundation/marketplace/namespace/DatabaseFieldNames.java b/src/main/java/org/eclipsefoundation/marketplace/namespace/DatabaseFieldNames.java
index 91306cf..bad77d4 100644
--- a/src/main/java/org/eclipsefoundation/marketplace/namespace/DatabaseFieldNames.java
+++ b/src/main/java/org/eclipsefoundation/marketplace/namespace/DatabaseFieldNames.java
@@ -20,7 +20,7 @@ public final class DatabaseFieldNames {
 	// base fields
 	public static final String DOCID = "_id";
 	public static final String URL = "url";
-	public static final String NAME = "name";
+	public static final String TITLE = "title";
 	public static final String OS = "os";
 	public static final String LISTING_ID = "listing_id";
 	
-- 
GitLab