001/* 002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others. 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-2.1.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 * Thomas Roger <troger@nuxeo.com> 016 */ 017 018package org.nuxeo.ecm.multi.tenant; 019 020import java.util.ArrayList; 021import java.util.Arrays; 022import java.util.List; 023 024import org.apache.commons.lang.builder.EqualsBuilder; 025import org.apache.commons.lang.builder.HashCodeBuilder; 026import org.apache.commons.lang.builder.ToStringBuilder; 027import org.nuxeo.common.xmap.annotation.XNode; 028import org.nuxeo.common.xmap.annotation.XNodeList; 029import org.nuxeo.common.xmap.annotation.XObject; 030import org.nuxeo.ecm.core.api.security.SecurityConstants; 031import static org.nuxeo.ecm.core.api.security.SecurityConstants.EVERYONE; 032 033/** 034 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 035 * @since 5.6 036 */ 037@XObject("configuration") 038public class MultiTenantConfiguration { 039 040 @XNode("tenantDocumentType") 041 protected String tenantDocumentType; 042 043 @XNode("membersGroupPermission") 044 protected String membersGroupPermission = SecurityConstants.READ; 045 046 @XNode("enabledByDefault") 047 protected boolean enabledByDefault = false; 048 049 @XNodeList(value = "prohibitedGroups/group", type = ArrayList.class, componentType = String.class) 050 private List<String> prohibitedGroups = new ArrayList<String>(Arrays.asList("members", EVERYONE)); 051 052 public String getTenantDocumentType() { 053 return tenantDocumentType; 054 } 055 056 public String getMembersGroupPermission() { 057 return membersGroupPermission; 058 } 059 060 public boolean isEnabledByDefault() { 061 return enabledByDefault; 062 } 063 064 @Override 065 public int hashCode() { 066 return HashCodeBuilder.reflectionHashCode(this); 067 } 068 069 @Override 070 public boolean equals(Object obj) { 071 return EqualsBuilder.reflectionEquals(this, obj); 072 } 073 074 @Override 075 public String toString() { 076 return ToStringBuilder.reflectionToString(this); 077 } 078 079 public List<String> getProhibitedGroups() { 080 return prohibitedGroups; 081 } 082 083}