public void modifyFurniture() {
if (!this.modifiedFurniture.isEmpty()) {
String id = getId();
String name = getName();
String description = getDescription();
FurnitureCategory category = getCategory();
Content model = getModel();
Content icon = getIcon();
Float width = getWidth();
Float depth = getDepth();
Float height = getHeight();
Float elevation = getElevation();
Boolean movable = getMovable();
Boolean resizable = getResizable();
Boolean deformable = getDeformable();
Boolean doorOrWindow = getDoorOrWindow();
float [][] modelRotation = getModelRotation();
String creator = getCreator();
BigDecimal price = getPrice();
BigDecimal valueAddedTaxPercentage = getValueAddedTaxPercentage();
boolean defaultFurnitureLanguage = FurnitureLibrary.DEFAULT_LANGUAGE.equals(this.furnitureLanguageController.getFurnitureLangauge());
// Apply modification
int piecesCount = this.modifiedFurniture.size();
for (CatalogPieceOfFurniture piece : this.modifiedFurniture) {
int index = this.furnitureLibrary.getPieceOfFurnitureIndex(piece);
// Retrieve localized data
Map<String, Object> localizedNames = new HashMap<String, Object>();
Map<String, Object> localizedDescriptions = new HashMap<String, Object>();
Map<String, Object> localizedCategories = new HashMap<String, Object>();
for (String language : this.furnitureLibrary.getSupportedLanguages()) {
Object pieceName = this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece, language, FurnitureLibrary.FURNITURE_NAME_PROPERTY);
if (pieceName != null) {
localizedNames.put(language, pieceName);
}
Object pieceDescription = this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece, language, FurnitureLibrary.FURNITURE_DESCRIPTION_PROPERTY);
if (pieceDescription != null) {
localizedDescriptions.put(language, pieceDescription);
}
Object categoryName = this.furnitureLibrary.getPieceOfFurnitureLocalizedData(
piece, language, FurnitureLibrary.FURNITURE_CATEGORY_PROPERTY);
if (categoryName != null) {
localizedCategories.put(language, categoryName);
}
}
this.furnitureLibrary.deletePieceOfFurniture(piece);
String pieceId = id != null || piecesCount == 1 ? id : piece.getId();
String pieceName = name != null && defaultFurnitureLanguage ? name : piece.getName();
String pieceDescription = description != null && defaultFurnitureLanguage ? description : piece.getDescription();
FurnitureCategory pieceCategory = category != null && defaultFurnitureLanguage ? category : piece.getCategory();
Content pieceModel = model != null ? model : piece.getModel();
Content pieceIcon = icon != null ? icon : piece.getIcon();
float pieceWidth = width != null ? width : piece.getWidth();
float pieceDepth = depth != null ? depth : piece.getDepth();
float pieceHeight = height != null ? height : piece.getHeight();