Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

Commit

Permalink
#408 #409 Fixes and improvements related to the bts and cc connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
ambpro committed Oct 21, 2019
1 parent 77962a0 commit 7be3a9c
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,17 @@ <h4 class="modal-title">Add connector</h4>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.sympa.SympaMailingList'">
<label for="mailingListName">Mailing List Name</label>
<input type="text" class="form-control" name="mailingListName" [(ngModel)]="repository.mailingListName" #mailingListNameInput="ngModel" required>
<label for="MailingListName">Mailing List Name</label>
<input type="text" class="form-control" name="MailingListName" [(ngModel)]="repository.MailingListName" #mailingListNameInput="ngModel" required>
<div *ngIf="mailingListNameInput.dirty && mailingListNameInput.invalid">
<small class="form-text text-danger" *ngIf="mailingListNameInput.errors.required">
This field is required.
</small>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.sympa.SympaMailingList'">
<label for="mailingListDescription">Mailing List Description</label>
<input type="text" class="form-control" name="mailingListDescription" [(ngModel)]="repository.mailingListDescription" #mailingListDescriptionInput="ngModel" required>
<label for="MailingListDescription">Mailing List Description</label>
<input type="text" class="form-control" name="MailingListDescription" [(ngModel)]="repository.MailingListDescription" #mailingListDescriptionInput="ngModel" required>
<div *ngIf="mailingListDescriptionInput.dirty && mailingListDescriptionInput.invalid">
<small class="form-text text-danger" *ngIf="mailingListDescriptionInput.errors.required">
This field is required.
Expand Down Expand Up @@ -338,17 +338,17 @@ <h4 class="modal-title">Add connector</h4>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.mbox.Mbox'">
<label for="mboxName">Mbox Name</label>
<input type="text" class="form-control" name="mboxName" [(ngModel)]="repository.mboxName" #mboxNameInput="ngModel" required>
<label for="MboxName">Mbox Name</label>
<input type="text" class="form-control" name="MboxName" [(ngModel)]="repository.MboxName" #mboxNameInput="ngModel" required>
<div *ngIf="mboxNameInput.dirty && mboxNameInput.invalid">
<small class="form-text text-danger" *ngIf="mboxNameInput.errors.required">
This field is required.
</small>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.mbox.Mbox'">
<label for="mboxDescription">Mbox Description</label>
<input type="text" class="form-control" name="mboxDescription" [(ngModel)]="repository.mboxDescription" #mboxDescriptionInput="ngModel" required>
<label for="MboxDescription">Mbox Description</label>
<input type="text" class="form-control" name="MboxDescription" [(ngModel)]="repository.MboxDescription" #mboxDescriptionInput="ngModel" required>
<div *ngIf="mboxDescriptionInput.dirty && mboxDescriptionInput.invalid">
<small class="form-text text-danger" *ngIf="mboxDescriptionInput.errors.required">
This field is required.
Expand All @@ -374,35 +374,35 @@ <h4 class="modal-title">Add connector</h4>
</div>
<!-- ECLIPSE FORUM -->
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum'">
<label for="forumId">Forum Id</label>
<input type="text" class="form-control" name="forumId" [(ngModel)]="repository.forumId" #forumIdInput="ngModel" required>
<label for="forum_id">Forum Id</label>
<input type="text" class="form-control" name="forum_id" [(ngModel)]="repository.forum_id" #forumIdInput="ngModel" required>
<div *ngIf="forumIdInput.dirty && forumIdInput.invalid">
<small class="form-text text-danger" *ngIf="forumIdInput.errors.required">
This field is required.
</small>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum'">
<label for="forumName">Forum Name</label>
<input type="text" class="form-control" name="forumName" [(ngModel)]="repository.forumName" #forumNameInput="ngModel" required>
<label for="forum_name">Forum Name</label>
<input type="text" class="form-control" name="forum_name" [(ngModel)]="repository.forum_name" #forumNameInput="ngModel" required>
<div *ngIf="forumNameInput.dirty && forumNameInput.invalid">
<small class="form-text text-danger" *ngIf="forumNameInput.errors.required">
This field is required.
</small>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum'">
<label for="clientId">Client Id</label>
<input type="text" class="form-control" name="clientId" [(ngModel)]="repository.clientId" #clientIdInput="ngModel" required>
<label for="client_id">Client Id</label>
<input type="text" class="form-control" name="client_id" [(ngModel)]="repository.client_id" #clientIdInput="ngModel" required>
<div *ngIf="clientIdInput.dirty && clientIdInput.invalid">
<small class="form-text text-danger" *ngIf="clientIdInput.errors.required">
This field is required.
</small>
</div>
</div>
<div class="form-group" *ngIf="repository._type == 'org.eclipse.scava.repository.model.cc.eclipseforums.EclipseForum'">
<label for="clientSecret">Client Secret</label>
<input type="text" class="form-control" name="clientSecret" [(ngModel)]="repository.clientSecret" #clientSecretInput="ngModel" required>
<label for="client_secret">Client Secret</label>
<input type="text" class="form-control" name="client_secret" [(ngModel)]="repository.client_secret" #clientSecretInput="ngModel" required>
<div *ngIf="clientSecretInput.dirty && clientSecretInput.invalid">
<small class="form-text text-danger" *ngIf="clientSecretInput.errors.required">
This field is required.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,28 +248,28 @@ <h2>Edit Project <b>{{project?.shortName}}</b></h2>
<input type="text" class="form-control" name="cc.description-{{i + 1}}" [(ngModel)]="cc.description">
</td>
</tr>
<tr *ngIf="cc?.mailingListName != null" class="row">
<tr *ngIf="cc?.MailingListName != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Mailing List Name: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.mailingListName-{{i + 1}}" [(ngModel)]="cc.mailingListName">
<input type="text" class="form-control" name="cc.MailingListName-{{i + 1}}" [(ngModel)]="cc.MailingListName">
</td>
</tr>
<tr *ngIf="cc?.mailingListDescription != null" class="row">
<tr *ngIf="cc?.MailingListDescription != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Mailing List Description: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.mailingListDescription-{{i + 1}}" [(ngModel)]="cc.mailingListDescription">
<input type="text" class="form-control" name="cc.MailingListDescription-{{i + 1}}" [(ngModel)]="cc.MailingListDescription">
</td>
</tr>
<tr *ngIf="cc?.mboxName != null" class="row">
<tr *ngIf="cc?.MboxName != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Mbox Name: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.mboxName-{{i + 1}}" [(ngModel)]="cc.mboxName">
<input type="text" class="form-control" name="cc.MboxName-{{i + 1}}" [(ngModel)]="cc.MboxName">
</td>
</tr>
<tr *ngIf="cc?.mboxDescription != null" class="row">
<tr *ngIf="cc?.MboxDescription != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Mbox Description: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.mboxDescription-{{i + 1}}" [(ngModel)]="cc.mboxDescription">
<input type="text" class="form-control" name="cc.MboxDescription-{{i + 1}}" [(ngModel)]="cc.MboxDescription">
</td>
</tr>
<tr *ngIf="cc?.compressedFileExtension != null" class="row">
Expand Down Expand Up @@ -314,28 +314,28 @@ <h2>Edit Project <b>{{project?.shortName}}</b></h2>
<input type="text" class="form-control" name="cc.password-{{i + 1}}" [(ngModel)]="cc.password">
</td>
</tr>
<tr *ngIf="cc?.forumId != null" class="row">
<tr *ngIf="cc?.forum_id != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Forum Id: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.forumId-{{i + 1}}" [(ngModel)]="cc.forumId">
<input type="text" class="form-control" name="cc.forum_id-{{i + 1}}" [(ngModel)]="cc.forum_id">
</td>
</tr>
<tr *ngIf="cc?.forumName != null" class="row">
<tr *ngIf="cc?.forum_name != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Forum Name: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.forumName-{{i + 1}}" [(ngModel)]="cc.forumName">
<input type="text" class="form-control" name="cc.forum_name-{{i + 1}}" [(ngModel)]="cc.forum_name">
</td>
</tr>
<tr *ngIf="cc?.clientId != null" class="row">
<tr *ngIf="cc?.client_id != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Client Id: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.clientId-{{i + 1}}" [(ngModel)]="cc.clientId">
<input type="text" class="form-control" name="cc.client_id-{{i + 1}}" [(ngModel)]="cc.client_id">
</td>
</tr>
<tr *ngIf="cc?.clientSecret != null" class="row">
<tr *ngIf="cc?.client_secret != null" class="row">
<td class="col-2">&nbsp;&nbsp;&nbsp;&nbsp;Client Secret: </td>
<td class="col-10">
<input type="text" class="form-control" name="cc.clientSecret-{{i + 1}}" [(ngModel)]="cc.clientSecret">
<input type="text" class="form-control" name="cc.client_secret-{{i + 1}}" [(ngModel)]="cc.client_secret">
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 7be3a9c

Please sign in to comment.