001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.publish.shared; 029 030import org.opencms.util.CmsUUID; 031 032import com.google.common.collect.ComparisonChain; 033import com.google.gwt.user.client.rpc.IsSerializable; 034 035/** 036 * A project bean.<p> 037 * 038 * @since 7.6 039 */ 040public class CmsProjectBean implements IsSerializable, Comparable<CmsProjectBean> { 041 042 /** The default group name. */ 043 private String m_defaultGroupName; 044 045 /** The project description. */ 046 private String m_description; 047 048 /** The project id.*/ 049 private CmsUUID m_id; 050 051 /** The project name.*/ 052 private String m_name; 053 054 /** The rank which is used for sorting projects. */ 055 private int m_rank = 1000; 056 057 /** The project type. */ 058 private int m_type; 059 060 /** 061 * Creates a new project bean.<p> 062 * 063 * @param id the project id 064 * @param type the project type 065 * @param name the project name 066 * @param description the project description 067 **/ 068 public CmsProjectBean(CmsUUID id, int type, String name, String description) { 069 070 m_id = id; 071 m_name = name; 072 m_type = type; 073 m_description = description; 074 } 075 076 /** 077 * For serialization.<p> 078 */ 079 protected CmsProjectBean() { 080 081 // for serialization 082 } 083 084 /** 085 * @see java.lang.Comparable#compareTo(java.lang.Object) 086 */ 087 public int compareTo(CmsProjectBean otherProject) { 088 089 return ComparisonChain.start().compare(m_rank, otherProject.getRank()).compare( 090 m_name, 091 otherProject.getName()).result(); 092 093 } 094 095 /** 096 * The default name to use for publish groups computed from this project, if no other name is available.<p> 097 * 098 * @return the default publish group name 099 */ 100 public String getDefaultGroupName() { 101 102 return m_defaultGroupName; 103 } 104 105 /** 106 * Returns the project description.<p> 107 * 108 * @return the project description 109 */ 110 public String getDescription() { 111 112 return m_description; 113 } 114 115 /** 116 * Returns the id.<p> 117 * 118 * @return the id 119 */ 120 public CmsUUID getId() { 121 122 return m_id; 123 } 124 125 /** 126 * Returns the name.<p> 127 * 128 * @return the name 129 */ 130 public String getName() { 131 132 return m_name; 133 } 134 135 /** 136 * Gets the sorting rank.<p> 137 * 138 * @return the sorting rank 139 */ 140 public int getRank() { 141 142 return m_rank; 143 } 144 145 /** 146 * Returns the project type.<p> 147 * 148 * @return the project type 149 */ 150 public int getType() { 151 152 return m_type; 153 } 154 155 /** 156 * Returns if the project is of the type workflow project.<p> 157 * 158 * @return <code>true</code> if the project is of the type workflow project 159 */ 160 public boolean isWorkflowProject() { 161 162 return m_type == 2; 163 } 164 165 /** 166 * Sets the default publish group name.<p> 167 * 168 * @param defaultGroupName the default publish group name 169 */ 170 public void setDefaultGroupName(String defaultGroupName) { 171 172 m_defaultGroupName = defaultGroupName; 173 } 174 175 /** 176 * Sets the sorting rank.<p> 177 * 178 * @param rank the sorting rank 179 */ 180 public void setRank(int rank) { 181 182 m_rank = rank; 183 } 184}