/*
 * Copyright 2008-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.broadleafcommerce.openadmin.dto;

import java.io.Serializable;


/**
 * 
 * @author jfischer
 *
 */
public class Property implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    private String name;
    private String value;
    private String displayValue;
    private FieldMetadata metadata = new BasicFieldMetadata();
    private boolean isAdvancedCollection = false;
    private Boolean isDirty = false;
    private String unHtmlEncodedValue;
    private String rawValue;

    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public FieldMetadata getMetadata() {
        return metadata;
    }

    public void setMetadata(FieldMetadata metadata) {
        this.metadata = metadata;
    }

    public String getDisplayValue() {
        return displayValue;
    }

    public void setDisplayValue(String displayValue) {
        this.displayValue = displayValue;
    }

    public Boolean getIsDirty() {
        return isDirty;
    }

    public void setIsDirty(Boolean isDirty) {
        this.isDirty = isDirty;
    }

    public String getUnHtmlEncodedValue() {
        return unHtmlEncodedValue;
    }

    public void setUnHtmlEncodedValue(String unHtmlEncodedValue) {
        this.unHtmlEncodedValue = unHtmlEncodedValue;
    }

    public String getRawValue() {
        return rawValue;
    }

    public void setRawValue(String rawValue) {
        this.rawValue = rawValue;
    }

    public boolean isAdvancedCollection() {
        return isAdvancedCollection;
    }

    public void setAdvancedCollection(boolean advancedCollection) {
        isAdvancedCollection = advancedCollection;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((metadata == null || metadata instanceof CollectionMetadata || ((BasicFieldMetadata) metadata).getMergedPropertyType() == null) ? 0 : ((BasicFieldMetadata) metadata).getMergedPropertyType().hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Property other = (Property) obj;
        if (metadata == null || metadata instanceof CollectionMetadata || ((BasicFieldMetadata) metadata).getMergedPropertyType() == null) {
            if (other.metadata != null && other.metadata instanceof BasicFieldMetadata && ((BasicFieldMetadata) other.metadata).getMergedPropertyType() != null)
                return false;
        } else if (metadata instanceof BasicFieldMetadata && other.metadata instanceof BasicFieldMetadata && !((BasicFieldMetadata) metadata).getMergedPropertyType().equals(((BasicFieldMetadata) other.metadata).getMergedPropertyType()))
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        return true;
    }

}

@@ -842,29 +842,31 @@
 %0A    %0A    pr
-ivate
+otected
  String name
@@ -865,37 +865,39 @@
 ing name;%0A    pr
-ivate
+otected
  String value;%0A 
@@ -893,37 +893,39 @@
 ng value;%0A    pr
-ivate
+otected
  String displayV
@@ -936,21 +936,23 @@
 ;%0A    pr
-ivate
+otected
  FieldMe
@@ -1001,21 +1001,23 @@
 ;%0A    pr
-ivate
+otected
  boolean
@@ -1053,21 +1053,23 @@
 ;%0A    pr
-ivate
+otected
  Boolean
@@ -1084,37 +1084,39 @@
  = false;%0A    pr
-ivate
+otected
  String unHtmlEn
@@ -1133,21 +1133,23 @@
 ;%0A    pr
-ivate
+otected
  String 
@@ -2501,24 +2501,126 @@
 ction;%0A    %7D
+%0A    %0A    @Override%0A    public String toString() %7B%0A        return getName() + %22: %22 + getValue();%0A    %7D
 %0A%0A    @Overr

Add toString method to Property for debugging help