001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * ataillefer 016 */ 017package org.nuxeo.ecm.diff.model.impl; 018 019import java.util.Map; 020 021import org.apache.commons.collections.MapUtils; 022import org.nuxeo.ecm.diff.model.DiffDisplayBlock; 023import org.nuxeo.ecm.diff.model.PropertyDiffDisplay; 024import org.nuxeo.ecm.platform.forms.layout.api.LayoutDefinition; 025 026/** 027 * Handles... 028 * 029 * @author <a href="mailto:ataillefer@nuxeo.com">Antoine Taillefer</a> 030 */ 031public class DiffDisplayBlockImpl implements DiffDisplayBlock { 032 033 private static final long serialVersionUID = 5777784629522360126L; 034 035 protected String label; 036 037 protected Map<String, Map<String, PropertyDiffDisplay>> leftValue; 038 039 protected Map<String, Map<String, PropertyDiffDisplay>> rightValue; 040 041 protected Map<String, Map<String, PropertyDiffDisplay>> contentDiffValue; 042 043 protected LayoutDefinition layoutDefinition; 044 045 public DiffDisplayBlockImpl(String label, Map<String, Map<String, PropertyDiffDisplay>> leftValue, 046 Map<String, Map<String, PropertyDiffDisplay>> rightValue, 047 Map<String, Map<String, PropertyDiffDisplay>> contentDiffValue, LayoutDefinition layoutDefinition) { 048 this.label = label; 049 this.leftValue = leftValue; 050 this.rightValue = rightValue; 051 this.contentDiffValue = contentDiffValue; 052 this.layoutDefinition = layoutDefinition; 053 } 054 055 public String getLabel() { 056 return label; 057 } 058 059 public void setLabel(String label) { 060 this.label = label; 061 } 062 063 public Map<String, Map<String, PropertyDiffDisplay>> getLeftValue() { 064 return leftValue; 065 } 066 067 public void setLeftValue(Map<String, Map<String, PropertyDiffDisplay>> leftValue) { 068 this.leftValue = leftValue; 069 } 070 071 public Map<String, Map<String, PropertyDiffDisplay>> getRightValue() { 072 return rightValue; 073 } 074 075 public void setRightValue(Map<String, Map<String, PropertyDiffDisplay>> rightValue) { 076 this.rightValue = rightValue; 077 } 078 079 public Map<String, Map<String, PropertyDiffDisplay>> getContentDiffValue() { 080 return contentDiffValue; 081 } 082 083 public void setContentDiffValue(Map<String, Map<String, PropertyDiffDisplay>> contentDiffValue) { 084 this.contentDiffValue = contentDiffValue; 085 } 086 087 public LayoutDefinition getLayoutDefinition() { 088 return layoutDefinition; 089 } 090 091 public void setLayoutDefinition(LayoutDefinition layoutDefinition) { 092 this.layoutDefinition = layoutDefinition; 093 } 094 095 public boolean isEmpty() { 096 return MapUtils.isEmpty(this.contentDiffValue) 097 && (MapUtils.isEmpty(this.leftValue) || MapUtils.isEmpty(this.rightValue)); 098 } 099}