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