Merge remote-tracking branch 'refs/remotes/eclipse/master'

This commit is contained in:
Michael Hirsch
2016-02-09 14:49:20 +01:00
4 changed files with 46 additions and 42 deletions

View File

@@ -298,20 +298,7 @@ public class AmqpMessageHandlerService {
*/
private void updateActionStatus(final Message message) {
final ActionUpdateStatus actionUpdateStatus = convertMessage(message, ActionUpdateStatus.class);
final Long actionId = actionUpdateStatus.getActionId();
LOG.debug("Target notifies intermediate about action {} with status {}.", actionId, actionUpdateStatus
.getActionStatus().name());
if (actionId == null) {
logAndThrowMessageError(message, "Invalid message no action id");
}
final Action action = controllerManagement.findActionWithDetails(actionId);
if (action == null) {
logAndThrowMessageError(message, "Got intermediate notification about action " + actionId
+ " but action does not exist");
}
final Action action = checkActionExist(message, actionUpdateStatus);
final ActionStatus actionStatus = new ActionStatus();
final List<String> messageText = actionUpdateStatus.getMessage();
@@ -362,6 +349,29 @@ public class AmqpMessageHandlerService {
}
}
/**
* @param message
* @param actionUpdateStatus
* @return
*/
private Action checkActionExist(final Message message, final ActionUpdateStatus actionUpdateStatus) {
final Long actionId = actionUpdateStatus.getActionId();
LOG.debug("Target notifies intermediate about action {} with status {}.", actionId, actionUpdateStatus
.getActionStatus().name());
if (actionId == null) {
logAndThrowMessageError(message, "Invalid message no action id");
}
final Action action = controllerManagement.findActionWithDetails(actionId);
if (action == null) {
logAndThrowMessageError(message, "Got intermediate notification about action " + actionId
+ " but action does not exist");
}
return action;
}
private void handleCancelRejected(final Message message, final Action action, final ActionStatus actionStatus) {
if (action.isCancelingOrCanceled()) {

View File

@@ -161,7 +161,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
@Override
protected Map<String, Object> getVendorProperties() {
final Map<String, Object> properties = new HashMap<String, Object>();
final Map<String, Object> properties = new HashMap<>();
// Turn off dynamic weaving to disable LTW lookup in static weaving mode
properties.put("eclipselink.weaving", "false");
// needed for reports

View File

@@ -342,33 +342,23 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
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) {
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;
} else {
if (existingDs == null) {
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.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
@@ -437,13 +438,16 @@ public final class HawkbitCommonUtil {
* @return String formatted text
*/
public static String getFormattedText(final String orgText) {
String formtdTxt = orgText == null ? "" : orgText;
final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH;
if (formtdTxt.length() > txtLengthAllowed) {
formtdTxt = new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
if (orgText == null) {
return StringUtils.EMPTY;
}
return formtdTxt;
final int txtLengthAllowed = SPUIDefinitions.NAME_DESCRIPTION_LENGTH;
if (orgText.length() > txtLengthAllowed) {
return new StringBuilder(orgText.substring(0, txtLengthAllowed)).append("...").toString();
}
return orgText;
}
/**