Remove blocker issues

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-02-09 13:26:25 +01:00
parent ceb23e65e4
commit a4e1ae7ac8
2 changed files with 21 additions and 27 deletions

View File

@@ -342,33 +342,23 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
distributionSet.setRequiredMigrationStep(isMigStepReq); distributionSet.setRequiredMigrationStep(isMigStepReq);
} }
/**
* Duplicate check-Name and version for {@link DistributionSet} unique.
*
* @param name
* as String
* @param version
* as String
* @return
*/
private boolean duplicateCheck(final String name, final String version) { private boolean duplicateCheck(final String name, final String version) {
final DistributionSet existingDs = distributionSetManagement.findDistributionSetByNameAndVersion(name, version); final DistributionSet existingDs = distributionSetManagement.findDistributionSetByNameAndVersion(name, version);
/*
* Distribution should not exists with the same name & version. Display
* error message, when the "existingDs" is not null and it is add window
* (or) when the "existingDs" is not null and it is edit window and the
* distribution Id of the edit window is different then the "existingDs"
*/
if (existingDs != null && (!editDistribution || editDistribution && !existingDs.getId().equals(editDistId))) {
distNameTextField.addStyleName("v-textfield-error");
distVersionTextField.addStyleName("v-textfield-error");
notificationMessage.displayValidationError(
i18n.get("message.duplicate.dist", new Object[] { existingDs.getName(), existingDs.getVersion() }));
return false; if (existingDs == null) {
} else {
return true; return true;
} }
if (editDistribution && !existingDs.getId().equals(editDistId)) {
return true;
}
distNameTextField.addStyleName("v-textfield-error");
distVersionTextField.addStyleName("v-textfield-error");
notificationMessage.displayValidationError(
i18n.get("message.duplicate.dist", new Object[] { existingDs.getName(), existingDs.getVersion() }));
return false;
} }
/** /**

View File

@@ -20,6 +20,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.im.authentication.UserPrincipal; import org.eclipse.hawkbit.im.authentication.UserPrincipal;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
@@ -437,13 +438,16 @@ public final class HawkbitCommonUtil {
* @return String formatted text * @return String formatted text
*/ */
public static String getFormattedText(final String orgText) { public static String getFormattedText(final String orgText) {
String formtdTxt = orgText == null ? "" : orgText; if (orgText == null) {
final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH; return StringUtils.EMPTY;
if (formtdTxt.length() > txtLengthAllowed) {
formtdTxt = new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
} }
return formtdTxt; final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH;
if (orgText.length() > txtLengthAllowed) {
return new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
}
return orgText;
} }
/** /**