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();
float pieceElevation = elevation != null ? elevation : piece.getElevation();
boolean pieceMovable = movable != null ? movable : piece.isMovable();
float [][] pieceModelRotation = modelRotation != null ? modelRotation : piece.getModelRotation();
String pieceCreator = creator != null || piecesCount == 1 ? creator : piece.getCreator();
boolean pieceResizable = resizable != null ? resizable : piece.isResizable();
boolean pieceDeformable = deformable != null ? deformable : piece.isDeformable();
BigDecimal piecePrice = price != null ? price : piece.getPrice();
BigDecimal pieceValueAddedTaxPercentage = valueAddedTaxPercentage != null
? valueAddedTaxPercentage : piece.getValueAddedTaxPercentage();
if (piece instanceof CatalogDoorOrWindow) {
CatalogDoorOrWindow opening = (CatalogDoorOrWindow)piece;
piece = new CatalogDoorOrWindow(pieceId, pieceName, pieceDescription,