001/* 002 * Copyright (c) 2006-2011 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 Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * bstefanescu 011 */ 012package org.nuxeo.ecm.automation.server; 013 014import org.nuxeo.common.utils.StringUtils; 015import org.nuxeo.common.xmap.annotation.XNode; 016import org.nuxeo.common.xmap.annotation.XObject; 017 018/** 019 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 020 */ 021@XObject("binding") 022public class RestBinding { 023 024 /** 025 * The operation (chain) name 026 */ 027 @XNode("@name") 028 protected String name; 029 030 @XNode("@chain") 031 protected boolean chain; 032 033 @XNode("@disabled") 034 protected boolean isDisabled; 035 036 @XNode("secure") 037 protected boolean isSecure; 038 039 @XNode("administrator") 040 protected boolean isAdministrator; 041 042 protected String[] groups; 043 044 public void setName(String name) { 045 this.name = name; 046 } 047 048 public void setDisabled(boolean isDisabled) { 049 this.isDisabled = isDisabled; 050 } 051 052 public void setSecure(boolean isHttps) { 053 this.isSecure = isHttps; 054 } 055 056 public void setAdministrator(boolean isAdministrator) { 057 this.isAdministrator = isAdministrator; 058 } 059 060 public void setGroups(String[] groups) { 061 this.groups = groups; 062 } 063 064 public void setChain(boolean chain) { 065 this.chain = chain; 066 } 067 068 public boolean isChain() { 069 return chain; 070 } 071 072 @XNode("groups") 073 public void setGroups(String list) { 074 list = list.trim(); 075 if (list != null && list.length() > 0) { 076 this.groups = StringUtils.split(list, ',', true); 077 } 078 } 079 080 public boolean isDisabled() { 081 return isDisabled; 082 } 083 084 public boolean isAdministrator() { 085 return isAdministrator; 086 } 087 088 public boolean isSecure() { 089 return isSecure; 090 } 091 092 public String[] getGroups() { 093 return groups; 094 } 095 096 public boolean hasGroups() { 097 return groups != null && groups.length > 0; 098 } 099 100 public String getName() { 101 return name; 102 } 103 104}