001/* 002 * ModeShape (http://www.modeshape.org) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.modeshape.web.shared; 017 018import java.io.Serializable; 019 020/** 021 * Node property object descriptor. 022 * 023 * @author kulikov 024 */ 025public class JcrProperty implements Serializable { 026 private static final long serialVersionUID = 1L; 027 private String name; 028 private String type; 029 private String value; 030 private String displayValue; 031 private boolean isProtected; 032 private boolean isMultiValue; 033 034 public JcrProperty() { 035 } 036 037 /** 038 * Creates new property object. 039 * 040 * @param name the name of the property. 041 * @param type text description for the type 042 * @param value text view of the value. 043 * @param displayValue the value to display 044 */ 045 public JcrProperty( String name, 046 String type, 047 String value, 048 String displayValue) { 049 this.name = name; 050 this.type = type; 051 this.value = value; 052 this.displayValue = displayValue; 053 } 054 055 /** 056 * Gets name of the property. 057 * 058 * @return name of the property. 059 */ 060 public String getName() { 061 return name; 062 } 063 064 /** 065 * Gets property type. 066 * 067 * @return type of the property. 068 */ 069 public String getType() { 070 return type; 071 } 072 073 /** 074 * Gets value of the property. 075 * 076 * @return value 077 */ 078 public String getValue() { 079 return value; 080 } 081 082 /** 083 * Modifies name of the property. 084 * 085 * @param name the new name for the property. 086 */ 087 public void setName( String name ) { 088 this.name = name; 089 } 090 091 /** 092 * Modifies type of the property. 093 * 094 * @param type the new type of the property. 095 */ 096 public void setType( String type ) { 097 this.type = type; 098 } 099 100 /** 101 * Modifies value of the property. 102 * 103 * @param value 104 */ 105 public void setValue( String value ) { 106 this.value = value; 107 } 108 109 public String getDisplayValue() { 110 return displayValue; 111 } 112 113 public boolean isMultiValue() { 114 return this.isMultiValue; 115 } 116 117 /** 118 * Marks property as multiple or single value. 119 * 120 * @param isMultiValue true if property has multiple value 121 */ 122 public void setMultiValue( boolean isMultiValue ) { 123 this.isMultiValue = isMultiValue; 124 } 125 126 public boolean isProtected() { 127 return this.isProtected; 128 } 129 130 /** 131 * Marks property either protected or not. 132 * 133 * @param isProtected true if property is protected false otherwise. 134 */ 135 public void setProtected( boolean isProtected ) { 136 this.isProtected = isProtected; 137 } 138 139 /** 140 * Test this property for binary type. 141 * 142 * @return true if this property is of binary type. 143 */ 144 public boolean isBinary() { 145 return this.type.equalsIgnoreCase("Binary"); 146 } 147}