From 7be3a9cbcdb1f506953ea01bfe8baffad125c187 Mon Sep 17 00:00:00 2001 From: ambpro Date: Mon, 21 Oct 2019 17:54:08 +0200 Subject: [PATCH] #408 #409 Fixes and improvements related to the bts and cc connectors --- .../add-connector-dialog.component.html | 32 +- .../edit-project/edit-project.component.html | 32 +- .../client/api/ProjectCreationResource.java | 37 -- .../client/api/ProjectEditionResource.java | 364 +++++++++++------- 4 files changed, 254 insertions(+), 211 deletions(-) diff --git a/administration/scava-administration/src/app/layout/project/components/edit-project/add-connector/add-connector-dialog.component.html b/administration/scava-administration/src/app/layout/project/components/edit-project/add-connector/add-connector-dialog.component.html index 69d07c660..aefa9dbf9 100644 --- a/administration/scava-administration/src/app/layout/project/components/edit-project/add-connector/add-connector-dialog.component.html +++ b/administration/scava-administration/src/app/layout/project/components/edit-project/add-connector/add-connector-dialog.component.html @@ -293,8 +293,8 @@
- - + +
This field is required. @@ -302,8 +302,8 @@
- - + +
This field is required. @@ -338,8 +338,8 @@
- - + +
This field is required. @@ -347,8 +347,8 @@
- - + +
This field is required. @@ -374,8 +374,8 @@
- - + +
This field is required. @@ -383,8 +383,8 @@
- - + +
This field is required. @@ -392,8 +392,8 @@
- - + +
This field is required. @@ -401,8 +401,8 @@
- - + +
This field is required. diff --git a/administration/scava-administration/src/app/layout/project/components/edit-project/edit-project.component.html b/administration/scava-administration/src/app/layout/project/components/edit-project/edit-project.component.html index 0e75ba237..9bea909b9 100755 --- a/administration/scava-administration/src/app/layout/project/components/edit-project/edit-project.component.html +++ b/administration/scava-administration/src/app/layout/project/components/edit-project/edit-project.component.html @@ -248,28 +248,28 @@

Edit Project {{project?.shortName}}

- +     Mailing List Name: - + - +     Mailing List Description: - + - +     Mbox Name: - + - +     Mbox Description: - + @@ -314,28 +314,28 @@

Edit Project {{project?.shortName}}

- +     Forum Id: - + - +     Forum Name: - + - +     Client Id: - + - +     Client Secret: - + diff --git a/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectCreationResource.java b/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectCreationResource.java index 3f873c58c..94c2ffa62 100644 --- a/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectCreationResource.java +++ b/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectCreationResource.java @@ -45,43 +45,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode; public class ProjectCreationResource extends ServerResource { - - public static void main(String[] args) throws Exception { - String j = "{\"name\":\"hi\",\"homePage\":\"hi\",\"description\":\"hi\",\"vcsRepositories\":[{\"name\":\"hi\",\"url\":\"hi\",\"type\":\"git\"}],\"bts\":[{\"product\":\"hi\",\"url\":\"hi\",\"component\":\"hi\"}],\"communication_channels\":[{\"name\":\"hi\",\"url\":\"hi\",\"newsgroup\":\"hi\"}]}"; - - ObjectMapper mapper = new ObjectMapper(); - JsonNode json = mapper.readTree(j); - - Project project = new Project(); - project.setName(json.get("name").asText()); - project.setHomePage(json.get("homePage").asText()); - project.setDescription(json.get("description").asText()); - - for (JsonNode vcs : (ArrayNode)json.get("vcsRepositories")) { - VcsRepository repo = null; - if (vcs.get("type").asText().equals("svn")) { - repo = new SvnRepository(); - } else if (vcs.get("type").asText().equals("git")) { - repo = new GitRepository(); - } - repo.setName(vcs.get("name").asText()); - repo.setUrl(vcs.get("url").asText()); - project.getVcsRepositories().add(repo); - } - for (JsonNode cc : (ArrayNode)json.get("communication_channels")) { - NntpNewsGroup newsgroup = new NntpNewsGroup(); - newsgroup.setName(cc.get("name").asText()); - newsgroup.setUrl(cc.get("url").asText()); - project.getCommunicationChannels().add(newsgroup); - } - for (JsonNode bts : (ArrayNode)json.get("bts")) { - Bugzilla bugs = new Bugzilla(); - bugs.setProduct(bts.get("product").asText()); - bugs.setUrl(bts.get("url").asText()); - bugs.setComponent(bts.get("component").asText()); - project.getBugTrackingSystems().add(bugs); - } - } @Post public Representation createProject(Representation entity) { diff --git a/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectEditionResource.java b/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectEditionResource.java index d404eaab0..031869676 100644 --- a/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectEditionResource.java +++ b/metric-platform/platform/org.eclipse.scava.platform.client.api/src/org/eclipse/scava/platform/client/api/ProjectEditionResource.java @@ -275,13 +275,13 @@ private void editProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } exist = true; @@ -291,41 +291,58 @@ private void editProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; + } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof SympaMailingList) { + communication.setUrl(ccJson.get("url").asText()); + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); + ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); + if (ccJson.has("username")) { + ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); + } + if (ccJson.has("password")) { + ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); + } + exist = true; + break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof Mbox) { communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof EclipseForum) { - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof DocumentationSystematic) { if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -344,13 +361,13 @@ private void editProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } break; @@ -360,54 +377,58 @@ private void editProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.sympa.SympaMailingList": communication = new SympaMailingList(); communication.setUrl(ccJson.get("url").asText()); - ((SympaMailingList) communication).setMailingListName(ccJson.get("mailingListName").asText()); - ((SympaMailingList) communication).setMailingListDescription(ccJson.get("mailingListDescription").asText()); + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.mbox.Mbox": communication = new Mbox(); communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum": communication = new EclipseForum(); - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); break; case "org.eclipse.scava.repository.model.documentation.systematic.DocumentationSystematic": communication = new DocumentationSystematic(); if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -638,13 +659,13 @@ private void editGithubProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } exist = true; @@ -654,41 +675,58 @@ private void editGithubProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; + } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof SympaMailingList) { + communication.setUrl(ccJson.get("url").asText()); + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); + ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); + if (ccJson.has("username")) { + ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); + } + if (ccJson.has("password")) { + ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); + } + exist = true; + break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof Mbox) { communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof EclipseForum) { - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof DocumentationSystematic) { if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -707,13 +745,13 @@ private void editGithubProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } break; @@ -723,56 +761,58 @@ private void editGithubProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.sympa.SympaMailingList": communication = new SympaMailingList(); communication.setUrl(ccJson.get("url").asText()); - ((SympaMailingList) communication).setMailingListName(ccJson.get("mailingListName").asText()); - ((SympaMailingList) communication) - .setMailingListDescription(ccJson.get("mailingListDescription").asText()); - ((SympaMailingList) communication) - .setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); + ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); + if (ccJson.has("username")) { ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.mbox.Mbox": communication = new Mbox(); communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum": communication = new EclipseForum(); - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); break; case "org.eclipse.scava.repository.model.documentation.systematic.DocumentationSystematic": communication = new DocumentationSystematic(); if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -990,13 +1030,13 @@ private void editGitlabProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } exist = true; @@ -1006,41 +1046,58 @@ private void editGitlabProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; + } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof SympaMailingList) { + communication.setUrl(ccJson.get("url").asText()); + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); + ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); + if (ccJson.has("username")) { + ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); + } + if (ccJson.has("password")) { + ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); + } + exist = true; + break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof Mbox) { communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof EclipseForum) { - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof DocumentationSystematic) { if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -1059,13 +1116,13 @@ private void editGitlabProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } break; @@ -1075,56 +1132,58 @@ private void editGitlabProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.sympa.SympaMailingList": communication = new SympaMailingList(); communication.setUrl(ccJson.get("url").asText()); - ((SympaMailingList) communication).setMailingListName(ccJson.get("mailingListName").asText()); - ((SympaMailingList) communication) - .setMailingListDescription(ccJson.get("mailingListDescription").asText()); - ((SympaMailingList) communication) - .setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); + ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); + if (ccJson.has("username")) { ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.mbox.Mbox": communication = new Mbox(); communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum": communication = new EclipseForum(); - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); break; case "org.eclipse.scava.repository.model.documentation.systematic.DocumentationSystematic": communication = new DocumentationSystematic(); if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -1334,13 +1393,13 @@ private void editEclipseProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } exist = true; @@ -1350,41 +1409,58 @@ private void editEclipseProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; + } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof SympaMailingList) { + communication.setUrl(ccJson.get("url").asText()); + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); + ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); + if (ccJson.has("username")) { + ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); + } + if (ccJson.has("password")) { + ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); + } + exist = true; + break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof Mbox) { communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof EclipseForum) { - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); exist = true; break; } else if (communication.getId().equals(ccJson.get("_id").asText()) && communication instanceof DocumentationSystematic) { if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText()); @@ -1403,13 +1479,13 @@ private void editEclipseProject(JsonNode json, Project project) { communication.setUrl(ccJson.get("url").asText()); ((NntpNewsGroup) communication).setName(ccJson.get("name").asText()); ((NntpNewsGroup) communication).setPort(ccJson.get("port").asInt()); - if (ccJson.get("interval").asText() != null && !ccJson.get("interval").asText().equals("")) { + if (ccJson.has("interval")) { ((NntpNewsGroup) communication).setInterval(ccJson.get("interval").asInt()); } - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((NntpNewsGroup) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((NntpNewsGroup) communication).setPassword(ccJson.get("password").asText()); } break; @@ -1419,54 +1495,58 @@ private void editEclipseProject(JsonNode json, Project project) { ((Irc) communication).setName(ccJson.get("name").asText()); ((Irc) communication).setDescription(ccJson.get("description").asText()); ((Irc) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Irc) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Irc) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.sympa.SympaMailingList": communication = new SympaMailingList(); communication.setUrl(ccJson.get("url").asText()); - ((SympaMailingList) communication).setMailingListName(ccJson.get("mailingListName").asText()); - ((SympaMailingList) communication).setMailingListDescription(ccJson.get("mailingListDescription").asText()); + ((SympaMailingList) communication).setMailingListName(ccJson.get("MailingListName").asText()); + ((SympaMailingList) communication).setMailingListDescription(ccJson.get("MailingListDescription").asText()); ((SympaMailingList) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((SympaMailingList) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((SympaMailingList) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.mbox.Mbox": communication = new Mbox(); communication.setUrl(ccJson.get("url").asText()); - ((Mbox) communication).setMboxName(ccJson.get("mboxName").asText()); - ((Mbox) communication).setMboxDescription(ccJson.get("mboxDescription").asText()); + ((Mbox) communication).setMboxName(ccJson.get("MboxName").asText()); + ((Mbox) communication).setMboxDescription(ccJson.get("MboxDescription").asText()); ((Mbox) communication).setCompressedFileExtension(ccJson.get("compressedFileExtension").asText()); - if (ccJson.get("username").asText() != null && !ccJson.get("username").asText().equals("")) { + if (ccJson.has("username")) { ((Mbox) communication).setUsername(ccJson.get("username").asText()); } - if (ccJson.get("password").asText() != null && !ccJson.get("password").asText().equals("")) { + if (ccJson.has("password")) { ((Mbox) communication).setPassword(ccJson.get("password").asText()); } break; case "org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum": communication = new EclipseForum(); - ((EclipseForum) communication).setForum_id(ccJson.get("forumId").asText()); - ((EclipseForum) communication).setForum_name(ccJson.get("forumName").asText()); - ((EclipseForum) communication).setClient_id(ccJson.get("clientId").asText()); - ((EclipseForum) communication).setClient_secret(ccJson.get("clientSecret").asText()); + ((EclipseForum) communication).setForum_id(ccJson.get("forum_id").asText()); + ((EclipseForum) communication).setForum_name(ccJson.get("forum_name").asText()); + ((EclipseForum) communication).setClient_id(ccJson.get("client_id").asText()); + ((EclipseForum) communication).setClient_secret(ccJson.get("client_secret").asText()); break; case "org.eclipse.scava.repository.model.documentation.systematic.DocumentationSystematic": communication = new DocumentationSystematic(); if (ccJson.get("loginOption").asText().equals("option1")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } } else if (ccJson.get("loginOption").asText().equals("option2")) { communication.setUrl(ccJson.get("url").asText()); - ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + if (ccJson.has("executionFrequency")) { + ((DocumentationSystematic) communication).setExecutionFrequency(Integer.parseInt(ccJson.get("executionFrequency").asText())); + } ((DocumentationSystematic) communication).setLoginURL(ccJson.get("loginURL").asText()); ((DocumentationSystematic) communication).setUsername(ccJson.get("username").asText()); ((DocumentationSystematic) communication).setUsernameFieldName(ccJson.get("usernameFieldName").asText());