Incorporated the review comments.

Signed-off-by: Gaurav <gaurav.sahay@in.bosch.com>
This commit is contained in:
Gaurav
2016-08-08 13:24:12 +02:00
27 changed files with 428 additions and 306 deletions

View File

@@ -61,11 +61,12 @@ public class DistributionSetMetadatadetailslayout extends Table {
private Long selectedDistSetId;
/**
*
* Initialize the component.
* @param i18n
* @param permissionChecker
* @param distributionSetManagement
* @param dsMetadataPopupLayout
* @param entityFactory
*/
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final DistributionSetManagement distributionSetManagement,

View File

@@ -186,12 +186,17 @@ public class SoftwareModuleDetailsTable extends Table {
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet,
final Set<SoftwareModule> alreadyAssignedSwModules) {
final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(), alreadyAssignedSwModules);
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
unAssignedSw);
manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet));
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
uiNotification.displaySuccess(i18n.get("message.sw.unassigned", unAssignedSw.getName()));
if (distributionSetManagement.isDistributionSetInUse(distributionSet)) {
uiNotification.displayValidationError(i18n.get("message.error.notification.ds.target.assigned",distributionSet.getName(), distributionSet.getVersion()));
} else {
final DistributionSet newDistributionSet = distributionSetManagement.unassignSoftwareModule(distributionSet,
unAssignedSw);
manageDistUIState.setLastSelectedEntity(DistributionSetIdName.generate(newDistributionSet));
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet));
eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION);
uiNotification.displaySuccess(i18n.get("message.sw.unassigned", unAssignedSw.getName()));
}
}
private static boolean isSoftModAvaiableForSoftType(final Set<SoftwareModule> swModulesSet,

View File

@@ -12,6 +12,7 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -54,7 +55,7 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
protected IndexedContainer container;
protected final transient Map<Long, TagData> tagDetails = new HashMap<>();
protected final transient Map<Long, TagData> tagDetails = new ConcurrentHashMap<>();
protected final transient Map<Long, TagData> tokensAdded = new HashMap<>();
@@ -140,10 +141,12 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
}
protected void setContainerPropertValues(final Long tagId, final String tagName, final String tagColor) {
tagDetails.put(tagId, new TagData(tagId, tagName, tagColor));
final Item item = container.addItem(tagId);
item.getItemProperty("id").setValue(tagId);
updateItem(tagName, tagColor, item);
final TagData tagData = tagDetails.putIfAbsent(tagId, new TagData(tagId, tagName, tagColor));
if(tagData == null){
final Item item = container.addItem(tagId);
item.getItemProperty("id").setValue(tagId);
updateItem(tagName, tagColor, item);
}
}
protected void updateItem(final String tagName, final String tagColor, final Item item) {

View File

@@ -364,9 +364,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
}
if (distributionSetManagement.isDistributionSetInUse(ds)) {
notification.displayValidationError(
String.format("Distribution set %s:%s is already assigned to targets and cannot be changed",
ds.getName(), ds.getVersion()));
notification.displayValidationError(i18n.get("message.error.notification.ds.target.assigned", ds.getName(), ds.getVersion()));
return false;
}
return true;
@@ -472,7 +470,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final SaveActionWindowEvent event) {
if (event == SaveActionWindowEvent.SAVED_ASSIGNMENTS) {
if (event == SaveActionWindowEvent.DELETED_DISTRIBUTIONS || event == SaveActionWindowEvent.SAVED_ASSIGNMENTS) {
UI.getCurrent().access(() -> refreshFilter());
}
}
@@ -550,9 +548,9 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
return manageMetadataBtn;
}
private void showMetadataDetails(final Long itemId) {
private void showMetadataDetails(final Long itemId) {
final DistributionSet ds = distributionSetManagement.findDistributionSetByIdWithDetails(itemId);
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds,null));
}
private String getNameAndVerion(final Object itemId) {

View File

@@ -386,6 +386,7 @@ message.metadata.updated = Metadata with key {0} successfully updated !
message.metadata.duplicate.check = Metadata with key {0} already exists, please enter another value
message.metadata.deleted.successfully = Metadata with key {0} successfully deleted !
message.confirm.delete.metadata = Are you sure that you want to delete metadata with key {0} ?
message.error.notification.ds.target.assigned = Distribution set {0}:{1} is already assigned to targets and cannot be changed
# Login view
notification.login.title=Welcome to Bosch IoT Software Provisioning.

View File

@@ -375,6 +375,7 @@ message.metadata.updated = Metadata with key {0} successfully updated !
message.metadata.duplicate.check = Metadata with key {0} already exists, please enter another value
message.metadata.deleted.successfully = Metadata with key {0} successfully deleted !
message.confirm.delete.metadata = Are you sure that you want to delete metadata with key {0} ?
message.error.notification.ds.target.assigned = Distribution set {0}:{1} is already assigned to targets and cannot be changed
# Login view

View File

@@ -371,6 +371,7 @@ message.metadata.updated = Metadata with key {0} successfully updated !
message.metadata.duplicate.check = Metadata with key {0} already exists, please enter another value
message.metadata.deleted.successfully = Metadata with key {0} successfully deleted !
message.confirm.delete.metadata = Are you sure that you want to delete metadata with key {0} ?
message.error.notification.ds.target.assigned = Distribution set {0}:{1} is already assigned to targets and cannot be changed
# Login view
notification.login.title=Welcome to Bosch IoT Software Provisioning.