Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Evolveum/midpoint
- Loading branch information
Showing
5 changed files
with
152 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/impl/validator/RelationValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2020 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.gui.impl.validator; | ||
|
||
import com.evolveum.midpoint.util.QNameUtil; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.apache.wicket.validation.IValidatable; | ||
import org.apache.wicket.validation.IValidator; | ||
import org.apache.wicket.validation.ValidationError; | ||
|
||
public class RelationValidator implements IValidator<String> { | ||
|
||
@Override | ||
public void validate(IValidatable<String> validatable) { | ||
String value = validatable.getValue(); | ||
if (StringUtils.isBlank(value)) { | ||
return; | ||
} | ||
|
||
if (QNameUtil.isUri(value)) { | ||
return; | ||
} | ||
|
||
ValidationError error = new ValidationError(); | ||
error.addKey("RelationPanel.relation.identifier.must.be.qname"); | ||
error.setMessage("Relation identifier must be in the form of URI."); | ||
validatable.error(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters