diff options
author | donald.g.dunne | 2016-04-01 01:04:03 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2016-04-01 01:04:03 +0000 |
commit | 6f3817936f2de155c65cd5cf19b9b53ff72c864b (patch) | |
tree | 0be724b47956d988f0f27822a9a3af244dc654a1 /plugins/org.eclipse.osee.account.rest.model | |
parent | 65b07a027aaa915309a0f517c22b87a3ebcdb7a7 (diff) | |
download | org.eclipse.osee-6f3817936f2de155c65cd5cf19b9b53ff72c864b.tar.gz org.eclipse.osee-6f3817936f2de155c65cd5cf19b9b53ff72c864b.tar.xz org.eclipse.osee-6f3817936f2de155c65cd5cf19b9b53ff72c864b.zip |
feature: Add links to CommonNavigateItems
Change-Id: Ibd5ec5870b4db2a7cd0a6aa0f64ab2fcec0b598e
Diffstat (limited to 'plugins/org.eclipse.osee.account.rest.model')
2 files changed, 20 insertions, 10 deletions
diff --git a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java index b09094e7bef..f01a67d219f 100644 --- a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java +++ b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/AccountWebPreferences.java @@ -13,6 +13,7 @@ package org.eclipse.osee.account.rest.model; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -21,7 +22,7 @@ import org.json.JSONObject; */ public class AccountWebPreferences { - Map<String, Link> linksMap; + Map<String, Link> linksMap = new HashMap<String, Link>(); public AccountWebPreferences() { @@ -31,16 +32,11 @@ public class AccountWebPreferences { for (String team : teamToPreferences.keySet()) { initPreferences(teamToPreferences.get(team), team); } - } private void initPreferences(String string, String team) { try { JSONObject jObject = new JSONObject(string); - - if (linksMap == null) { - linksMap = new HashMap<String, Link>(); - } JSONObject linkJsonObject = jObject.getJSONObject("links"); @SuppressWarnings("unchecked") Iterator<String> keys = linkJsonObject.keys(); @@ -54,6 +50,12 @@ public class AccountWebPreferences { if (linkJObject.has("url")) { link.setUrl(linkJObject.getString("url")); } + if (linkJObject.has("tags")) { + JSONArray array = linkJObject.getJSONArray("tags"); + for (int x = 0; x < array.length(); x++) { + link.getTags().add(array.getString(x)); + } + } link.setTeam(team); link.setId(linkJObject.getString("id")); linksMap.put(next, link); diff --git a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java index 7f500b6cd2b..abec1f4d635 100644 --- a/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java +++ b/plugins/org.eclipse.osee.account.rest.model/src/org/eclipse/osee/account/rest/model/Link.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.account.rest.model; +import java.util.ArrayList; +import java.util.List; + /** * @author Angel Avila */ @@ -18,10 +21,7 @@ public class Link { String url; String id; String team; - - public Link() { - - } + List<String> tags = new ArrayList<String>(); public void setId(String id) { this.id = id; @@ -54,4 +54,12 @@ public class Link { public String getTeam() { return team; } + + public List<String> getTags() { + return tags; + } + + public void setTags(List<String> tags) { + this.tags = tags; + } } |