Skip to content
Snippets Groups Projects
Commit 7dd93588 authored by srosse's avatar srosse
Browse files

OO-5279: check the provider to remove them all

parent 13c0018c
No related branches found
No related tags found
No related merge requests found
...@@ -124,36 +124,36 @@ public class ExternalLinksController extends FormBasicController { ...@@ -124,36 +124,36 @@ public class ExternalLinksController extends FormBasicController {
String id = link.getId(); String id = link.getId();
String uri = link.getLink().getURI(); String uri = link.getLink().getURI();
if(!StringHelper.containsNonWhitespace(uri)) { if(!StringHelper.containsNonWhitespace(uri)) {
uri = "http://"; uri = "https://";
} }
TextElement url = uifactory.addTextElement("url_" + id, null, -1, uri, layoutContainer); TextElement url = uifactory.addTextElement("url_".concat(id), null, -1, uri, layoutContainer);
url.clearError(); url.clearError();
url.setDisplaySize(60); url.setDisplaySize(60);
url.setMandatory(true); url.setMandatory(true);
link.setUrl(url); link.setUrl(url);
// add link description // add link description
TextElement name = uifactory.addTextElement("displayName_" + id, null, -1, link.getLink().getDisplayName(), layoutContainer); TextElement name = uifactory.addTextElement("displayName_".concat(id), null, -1, link.getLink().getDisplayName(), layoutContainer);
name.clearError(); name.clearError();
name.setDisplaySize(40); name.setDisplaySize(40);
name.setMandatory(true); name.setMandatory(true);
link.setName(name); link.setName(name);
// add link add action button // add link add action button
FormLink addButton = uifactory.addFormLink("add_" + id, "table.add", "table.add", layoutContainer, Link.BUTTON); FormLink addButton = uifactory.addFormLink("add_".concat(id), "table.add", "table.add", layoutContainer, Link.BUTTON);
addButton.setUserObject(link); addButton.setUserObject(link);
link.setAddButton(addButton); link.setAddButton(addButton);
// add link deletion action button // add link deletion action button
FormLink delButton = uifactory.addFormLink("del_" + id, "table.delete", "table.delete", layoutContainer, Link.BUTTON); FormLink delButton = uifactory.addFormLink("del_".concat(id), "table.delete", "table.delete", layoutContainer, Link.BUTTON);
delButton.setUserObject(link); delButton.setUserObject(link);
link.setDelButton(delButton); link.setDelButton(delButton);
} }
@Override @Override
protected boolean validateFormLogic(UserRequest ureq) { protected boolean validateFormLogic(UserRequest ureq) {
boolean allOk = super.validateFormLogic(ureq);
boolean allOk = true;
for(LinkWrapper link:externalLinks) { for(LinkWrapper link:externalLinks) {
link.getUrl().clearError(); link.getUrl().clearError();
link.getName().clearError(); link.getName().clearError();
...@@ -182,13 +182,13 @@ public class ExternalLinksController extends FormBasicController { ...@@ -182,13 +182,13 @@ public class ExternalLinksController extends FormBasicController {
} }
} }
return allOk && super.validateFormLogic(ureq); return allOk;
} }
@Override @Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if(source == newButton) { if(source == newButton) {
String id = UUID.randomUUID().toString().replaceAll("-", ""); String id = UUID.randomUUID().toString().replace("-", "");
KalendarEventLink link = new KalendarEventLink(EXTERNAL_LINKS_PROVIDER, id, "", "", ""); KalendarEventLink link = new KalendarEventLink(EXTERNAL_LINKS_PROVIDER, id, "", "", "");
LinkWrapper linkWrapper = new LinkWrapper(link); LinkWrapper linkWrapper = new LinkWrapper(link);
externalLinks.add(linkWrapper); externalLinks.add(linkWrapper);
...@@ -246,7 +246,7 @@ public class ExternalLinksController extends FormBasicController { ...@@ -246,7 +246,7 @@ public class ExternalLinksController extends FormBasicController {
//remove deleted links //remove deleted links
for(Iterator<KalendarEventLink> it=links.iterator(); it.hasNext(); ) { for(Iterator<KalendarEventLink> it=links.iterator(); it.hasNext(); ) {
KalendarEventLink link = it.next(); KalendarEventLink link = it.next();
if(EXTERNAL_LINKS_PROVIDER.equals(link.getId()) && !usedUuids.contains(link.getId())) { if(EXTERNAL_LINKS_PROVIDER.equals(link.getProvider()) && !usedUuids.contains(link.getId())) {
it.remove(); it.remove();
} }
} }
...@@ -261,10 +261,9 @@ public class ExternalLinksController extends FormBasicController { ...@@ -261,10 +261,9 @@ public class ExternalLinksController extends FormBasicController {
private LinkWrapper createLinkWrapper() { private LinkWrapper createLinkWrapper() {
String id = UUID.randomUUID().toString().replaceAll("-", ""); String id = UUID.randomUUID().toString().replace("-", "");
KalendarEventLink newLink = new KalendarEventLink(EXTERNAL_LINKS_PROVIDER, id, "", "", ""); KalendarEventLink newLink = new KalendarEventLink(EXTERNAL_LINKS_PROVIDER, id, "", "", "");
LinkWrapper newLinkWrapper = new LinkWrapper(newLink); return new LinkWrapper(newLink);
return newLinkWrapper;
} }
public class LinkWrapper { public class LinkWrapper {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment