minor bug fixes

This commit is contained in:
Francesco Mangiacrapa 2021-04-26 17:05:09 +02:00
parent 9b6d715611
commit 56bdb79189
3 changed files with 12 additions and 3 deletions

View File

@ -176,7 +176,8 @@ public class CreatorsFormView extends Composite implements FormValidator{
if(userRole.compareToIgnoreCase(ZenodoContributor.USER_ROLE)==0) { if(userRole.compareToIgnoreCase(ZenodoContributor.USER_ROLE)==0) {
author = new ZenodoContributor(); author = new ZenodoContributor();
((ZenodoContributor) author).setType(contributorTypeValues); ((ZenodoContributor) author).setType(contributorTypeValues);
} }else
author = new ZenodoCreator();
CreatorView view = new CreatorView(author, userRole, eventBus,false); CreatorView view = new CreatorView(author, userRole, eventBus,false);
listCreatorView.add(view); listCreatorView.add(view);
@ -206,7 +207,7 @@ public class CreatorsFormView extends Composite implements FormValidator{
*/ */
public List<? extends ZenodoAuthor> readListOfCreatorsFromView(){ public List<? extends ZenodoAuthor> readListOfCreatorsFromView(){
List<ZenodoAuthor> listAuthors = new ArrayList<>(listCreatorView.size()); List<ZenodoAuthor> listAuthors = new ArrayList<>();
for (CreatorView creatorView : listCreatorView) { for (CreatorView creatorView : listCreatorView) {
ZenodoAuthor author = creatorView.getAuthor(); ZenodoAuthor author = creatorView.getAuthor();
@ -227,6 +228,7 @@ public class CreatorsFormView extends Composite implements FormValidator{
GWT.log("The fielName is null or empty skpping he/she from list of Authors"); GWT.log("The fielName is null or empty skpping he/she from list of Authors");
} }
GWT.log("returning list of authors: "+listAuthors);
return listAuthors; return listAuthors;
} }

View File

@ -554,6 +554,9 @@ public class BasicInformationView extends Composite implements FormValidator {
*/ */
public List<ZenodoCreator> getListOfCreators() { public List<ZenodoCreator> getListOfCreators() {
List<ZenodoCreator> listOfCreators = new ArrayList<>(); List<ZenodoCreator> listOfCreators = new ArrayList<>();
if(listOfCreatorsView==null) {
return listOfCreators;
}
for (CreatorsFormView cfv : listOfCreatorsView) { for (CreatorsFormView cfv : listOfCreatorsView) {
List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView(); List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
for (ZenodoAuthor zenodoAuthor : listOfUsers) { for (ZenodoAuthor zenodoAuthor : listOfUsers) {
@ -570,11 +573,15 @@ public class BasicInformationView extends Composite implements FormValidator {
*/ */
public List<ZenodoContributor> getListOfContributors() { public List<ZenodoContributor> getListOfContributors() {
List<ZenodoContributor> listOfContributors = new ArrayList<>(); List<ZenodoContributor> listOfContributors = new ArrayList<>();
if(listOfContributorsView==null) {
return listOfContributors;
}
for (CreatorsFormView cfv : listOfContributorsView) { for (CreatorsFormView cfv : listOfContributorsView) {
List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView(); List<? extends ZenodoAuthor> listOfUsers = cfv.readListOfCreatorsFromView();
for (ZenodoAuthor zenodoAuthor : listOfUsers) { for (ZenodoAuthor zenodoAuthor : listOfUsers) {
listOfContributors.add((ZenodoContributor) zenodoAuthor); listOfContributors.add((ZenodoContributor) zenodoAuthor);
} }
} }
return listOfContributors; return listOfContributors;
} }