View Javadoc
1 /* 2 Bloof - visualize the evolution of your software project 3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de> 4 http://bloof.sf.net/ 5 6 This program is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along with 15 this program; if not, write to the Free Software Foundation, Inc., 16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 18 $RCSfile: Project.java,v $ 19 Created on $Date: 2003/09/06 08:46:35 $ 20 */ 21 package net.sf.bloof.script; 22 23 import java.util.HashMap; 24 import java.util.HashSet; 25 import java.util.Iterator; 26 27 import net.sf.bloof.Bloof; 28 import net.sf.bloof.db.DbAccess; 29 import net.sf.bloof.db.DefaultDbAccess; 30 import net.sf.bloof.metrics.Filter; 31 import net.sf.bloof.scm.ScmAccess; 32 33 /*** 34 * 35 * @author Lukasz Pekacki <pekacki@users.sourceforge.net> 36 * @version $Id: Project.java,v 1.1 2003/09/06 08:46:35 pekacki Exp $ 37 */ 38 public class Project { 39 40 public Project(HashMap aParams) { 41 mScmAccess = (ScmAccess) aParams.get(PARAM_SCM_ACCESS); 42 mName = (String) aParams.get(PARAM_PROJECT_NAME); 43 mUserName = (String) aParams.get(PARAM_USERNAME); 44 mPassword = (String) aParams.get(PARAM_PASSWORD); 45 mUrl = (String) aParams.get(PARAM_URL); 46 mFileGroups = aParams.containsKey(PARAM_FILE_GROUPS) ? (HashSet) aParams.get(PARAM_FILE_GROUPS) : new HashSet(); 47 mDeveloperGroups = aParams.containsKey(PARAM_DEVEL_GROUPS) ? (HashSet) aParams.get(PARAM_DEVEL_GROUPS) : new HashSet(); 48 mTimeIntervals = aParams.containsKey(PARAM_TIME_INTERVALS) ? (HashSet) aParams.get(PARAM_TIME_INTERVALS) : new HashSet(); 49 } 50 51 public void addGroup(Filter f) { 52 switch (f.getFilterType()) { 53 case Filter.FILE: { 54 mFileGroups.add(f); 55 break; 56 } 57 case Filter.DEVELOPER: { 58 mDeveloperGroups.add(f); 59 break; 60 } 61 case Filter.TIMESPAN: { 62 mTimeIntervals.add(f); 63 break; 64 } 65 } 66 mHasBeenChanged = true; 67 68 69 } 70 71 public DbAccess getDbAcces() { 72 if (mUrl != null) { 73 return new DefaultDbAccess(mName, mUserName,mPassword, mUrl); 74 } else { 75 return Bloof.INTERNAL_DATABASE; 76 } 77 } 78 79 public Iterator getDeveloperGroups() { 80 return mDeveloperGroups.iterator(); 81 } 82 83 public Iterator getFileGroups() { 84 return mFileGroups.iterator(); 85 } 86 /*** 87 * @return 88 */ 89 public String getName() { 90 return mName; 91 } 92 93 /*** 94 * @return 95 */ 96 public String getPassword() { 97 return mPassword; 98 } 99 100 public ScmAccess getScmAccess() { 101 return mScmAccess; 102 } 103 104 public Iterator getTimeIntervals() { 105 return mTimeIntervals.iterator(); 106 } 107 108 /*** 109 * @return 110 */ 111 public String getUrl() { 112 return mUrl; 113 } 114 115 /*** 116 * @return 117 */ 118 public String getUserName() { 119 return mUserName; 120 } 121 /*** 122 * @return 123 */ 124 public boolean hasBeenModified() { 125 return mHasBeenChanged; 126 } 127 128 /*** 129 * @param f 130 */ 131 public void removeDeveloperFilter(Filter f) { 132 mDeveloperGroups.remove(f); 133 mHasBeenChanged = true; 134 135 } 136 /*** 137 * @param f 138 */ 139 public void removeFileFilter(Filter f) { 140 mFileGroups.remove(f); 141 mHasBeenChanged = true; 142 143 } 144 145 /*** 146 * @param f 147 */ 148 public void removeTimeFilter(Filter f) { 149 mTimeIntervals.remove(f); 150 151 } 152 153 public String toString() { 154 return mName; 155 } 156 157 public void setModified() { 158 mHasBeenChanged = true; 159 } 160 161 public static final String PARAM_PROJECT_NAME = "project name", 162 PARAM_USERNAME = "user name", 163 PARAM_URL = "url", 164 PARAM_PASSWORD = "password", 165 PARAM_SCM_ACCESS = "scm access", 166 PARAM_FILE_GROUPS = "file groups", 167 PARAM_DEVEL_GROUPS = "devel groups", 168 PARAM_TIME_INTERVALS = "time intervals"; 169 private HashSet mFileGroups, mDeveloperGroups, mTimeIntervals; 170 private boolean mHasBeenChanged = false; 171 private String mName, mUserName, mPassword, mUrl; 172 private ScmAccess mScmAccess; 173 174 }

This page was automatically generated by Maven