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 com.google.gwt.user.client.rpc.IsSerializable; 019import java.io.Serializable; 020import java.util.ArrayList; 021import java.util.Collection; 022 023/** 024 * Jcr node value object. 025 * 026 * @author kulikov 027 */ 028public class JcrNode implements Serializable, IsSerializable { 029 private static final long serialVersionUID = 1L; 030 031 private String repository; 032 private String workspace; 033 private String name; 034 private String path; 035 private String primaryType; 036 private long childCount; 037 038 private Acl acll; 039 040 private String[] mixins; 041 042 //children nodes 043 private ArrayList<JcrNode> children = new ArrayList<JcrNode>(); 044 private Collection<JcrProperty> properties; 045 private String[] propertyDefs; 046 047 public JcrNode() { 048 } 049 050 public JcrNode(String repository, String workspace, String name, String path, String primaryType) { 051 this.repository = repository; 052 this.workspace = workspace; 053 this.name = name; 054 this.path = path; 055 this.primaryType = primaryType; 056 } 057 058 public String getRepository() { 059 return repository; 060 } 061 062 public String getWorkspace() { 063 return workspace; 064 } 065 066 public void setName(String name) { 067 this.name = name; 068 } 069 070 public String getName() { 071 return name; 072 } 073 074 public void setPath(String path) { 075 this.path = path; 076 } 077 078 public String getPath() { 079 return path; 080 } 081 082 public String getPrimaryType() { 083 return primaryType; 084 } 085 086 public Collection<JcrNode> children() { 087 return children; 088 } 089 090 public void addChild(JcrNode child) { 091 children.add(child); 092 } 093 094 public Collection<JcrProperty> getProperties() { 095 return properties; 096 } 097 098 public void setProperties(Collection<JcrProperty> properties) { 099 this.properties = properties; 100 } 101 102 public Acl getAcl() { 103 return acll; 104 } 105 106 public void setAcl(Acl acll) { 107 this.acll = acll; 108 } 109 110 public void setMixins(String[] mixins) { 111 this.mixins = mixins; 112 } 113 114 public String[] getMixins() { 115 return mixins; 116 } 117 118 public boolean hasBinaryContent() { 119 for (JcrProperty p : properties) { 120 if (p.isBinary()) { 121 return true; 122 } 123 } 124 return false; 125 } 126 127 public void setPropertyDefs(String[] propertyDefs) { 128 this.propertyDefs = propertyDefs; 129 } 130 131 public String[] getPropertyDefs() { 132 return propertyDefs; 133 } 134 135 public long getChildCount() { 136 return childCount; 137 } 138 139 public void setChildCount(long childCount) { 140 this.childCount = childCount; 141 } 142}