Changeset 2475
- Timestamp:
- Jul 31, 2006, 5:59:05 PM (17 years ago)
- Location:
- branches/dominic_annotations
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/dominic_annotations/src/core/net/sf/basedb/core/AnnotationType.java
r2410 r2475 361 361 { 362 362 return getData().getDefaultValue(); 363 363 364 } 364 365 /** -
branches/dominic_annotations/src/core/net/sf/basedb/core/AnnotationTypeCategory.java
r2400 r2475 25 25 package net.sf.basedb.core; 26 26 27 import java.util.Collections;28 import java.util.Set;29 30 31 27 import net.sf.basedb.core.data.AnnotationTypeCategoryData; 32 import net.sf.basedb.core.query.EntityQuery;33 28 import net.sf.basedb.core.query.Hql; 34 29 import net.sf.basedb.core.query.Restrictions; … … 39 34 annotation type category contains other (@link AnnotationTypes} items 40 35 <p> 41 An annotation type can belong to more than one annotation type cat geory.36 An annotation type can belong to more than one annotation type category. 42 37 Therefore a many to many relationship exist between <code>Annotationtype</code> and 43 38 <code>AnnotationTypeCategory</code>. … … 66 61 @param annotationtypecategory 67 62 */ 68 publicAnnotationTypeCategory(AnnotationTypeCategoryData annotationtypecategory) {63 AnnotationTypeCategory(AnnotationTypeCategoryData annotationtypecategory) { 69 64 super(annotationtypecategory); 70 65 } … … 87 82 /** 88 83 Gets an <code>AnnotationTypeCategory</code> item when you know the id. 89 90 84 @param dc The <code>DbControl</code> which will be used for 91 85 permission checking and database access … … 149 143 /** 150 144 Add an annotationtype to this category 151 @param annotation type to add145 @param annotation type to add 152 146 @throws PermissionDeniedException If the logged in user doesn't 153 147 have {@link Permission#WRITE} permission for the annotationtype category and … … 157 151 */ 158 152 public void addAnnotationType(AnnotationType annotationtype) 159 throws InvalidDataException 153 throws InvalidDataException, PermissionDeniedException 160 154 { 161 155 checkPermission(Permission.WRITE); … … 166 160 167 161 /** 168 Remove an annotation type from this category162 Remove an annotation type from this category 169 163 @param annotationtype to remove 170 164 @throws PermissionDeniedException If the logged in user doesn't … … 212 206 return query; 213 207 } 214 215 /**216 Gets the categorydescription. This is simply a somewhat detailed description217 The user can choose not to give this detailed description.218 @return a (@link String) Object219 */220 221 public String getCategoryDescription()222 {223 return getData().getCategoryDescription().trim();224 }225 226 /**227 228 Sets the maximum length of the categorydescription property.229 Check the length against this value before calling230 {@link #setCategoryDescription(String)} to avoid exceptions231 232 */233 public static final int MAX_CATEGORYDESCRIPTION_LENGTH = AnnotationTypeCategoryData.MAX_CATEGORYDESCRIPTION_LENGTH;234 235 /**236 Sets the categorydescription for this <code>AnnotationTypeCategory</code>.237 @throws PermissionDeniedException If the logged in user doesn't have238 write permission239 @throws InvalidDataException If the new value is longer than240 {@link #MAX_CATEGORYDESCRIPTION_LENGTH}241 @throws BaseException If there is another error242 */243 public void setCategoryDescription(String categoryDescription)244 throws PermissionDeniedException, InvalidDataException, BaseException245 {246 checkPermission(Permission.WRITE);247 getData().setCategoryDescription(248 StringUtil.setNullableString(249 categoryDescription,"categoryDescription",MAX_CATEGORYDESCRIPTION_LENGTH));250 }251 252 253 208 } -
branches/dominic_annotations/src/core/net/sf/basedb/core/Install.java
r2400 r2475 515 515 createLabel("Biotin", "", rootUser, keyEveryoneUse); 516 516 517 //Anno attion type categories517 //Annotation type categories 518 518 519 519 if (progress != null) progress.display((int)(18*progress_factor), "--Creating annotation type categories..."); 520 AnnotationTypeCategoryData categoryGeneral = createAnnotationTypeCategory("General", "Default category for annotation types.",520 AnnotationTypeCategoryData categoryGeneral = createAnnotationTypeCategory("General", 521 521 "This category holds annotation types that have not been classified into established groups", 522 522 rootUser,keyEveryoneUse ); 523 AnnotationTypeCategoryData categoryOther = createAnnotationTypeCategory("Other", "Other category for annotation types.", 524 "This category holds annotation types that have not been classified into established groups", 525 rootUser,keyEveryoneUse ); 526 527 523 528 524 // Annotation types 529 525 Item[] wells = new Item[] { Item.WELL }; … … 533 529 wells, useRadio, false, rootUser, keyEveryoneUse,categoryGeneral ); 534 530 createAnnotationType("Bands", "", Type.STRING, 1, new String[] { "Not done", "Good", "Missing", "Multiple" }, 535 wells, useRadio, false, rootUser, keyEveryoneUse, categoryOther);531 wells, useRadio, false, rootUser, keyEveryoneUse, null ); 536 532 createAnnotationType("Bacterial growth", "", Type.STRING, 1, new String[] { "Not done", "Yes", "No" }, 537 wells, useRadio, false, rootUser, keyEveryoneUse, categoryOther);533 wells, useRadio, false, rootUser, keyEveryoneUse, null ); 538 534 createAnnotationType("Comment", "", Type.STRING, 1, null, 539 535 wells, null, false, rootUser, keyEveryoneUse, categoryGeneral ); … … 1487 1483 Create an {@link AnnotationTypeCategory}. 1488 1484 */ 1489 private static AnnotationTypeCategoryData createAnnotationTypeCategory(String name, String categoryDescription,1490 String description,UserData owner, ItemKeyData shareTo)1485 private static AnnotationTypeCategoryData createAnnotationTypeCategory(String name, String description, 1486 UserData owner, ItemKeyData shareTo) 1491 1487 { 1492 1488 org.hibernate.Transaction tx = null; … … 1512 1508 atc.setName(name); 1513 1509 atc.setDescription(description); 1514 atc.setCategoryDescription(categoryDescription);1515 1510 atc.setOwner(owner); 1516 1511 atc.setItemKey(shareTo); -
branches/dominic_annotations/src/core/net/sf/basedb/core/data/AnnotationTypeCategoryData.java
r2358 r2475 1 /* $Id: AnnotationTypeCategoryData.java 1 2006-04-17 Dominic Oyeniran$1 /* $Id: AnnotationTypeCategoryData.java 1 2006-04-17 dominic $ 2 2 3 3 Copyright (C) Authors contributing to this file. … … 38 38 public class AnnotationTypeCategoryData 39 39 extends CommonData 40 41 40 42 41 { 43 42 public AnnotationTypeCategoryData() 44 43 {} 45 46 public static int MAX_CATEGORYDESCRIPTION_LENGTH = 255;47 private String categoryDescription;48 49 /**50 Get the category description property.51 @hibernate.property column="`category_description`" type="string"52 length="255" not-null="false"53 */54 public String getCategoryDescription()55 {56 return categoryDescription;57 }58 59 public void setCategoryDescription(String categoryDescription)60 {61 this.categoryDescription = categoryDescription;62 }63 64 44 65 45 private Set<AnnotationTypeData> annotationTypes; … … 81 61 return annotationTypes; 82 62 } 83 /* 84 In this case, the set method() is private, so that hibernate can keep track 85 of the objects it creates in the collection and only returns ,thru the get method(), 86 this objects. 87 */ 63 88 64 void setAnnotationTypes(Set<AnnotationTypeData> annotationtypes) 89 65 { … … 91 67 } 92 68 93 94 69 } -
branches/dominic_annotations/src/core/net/sf/basedb/core/data/AnnotationTypeData.java
r2345 r2475 204 204 this.enumerationValues = enumerationValues; 205 205 } 206 /* 207 * Newly added properties(fields) and mappings added by Dominic Oyeniran 208 * for handling annotation categories. 209 * 210 */ 206 211 207 212 208 private Set<AnnotationTypeCategoryData> category; … … 219 215 */ 220 216 221 Set<AnnotationTypeCategoryData> getCategory() {217 public Set<AnnotationTypeCategoryData> getCategory() { 222 218 if ( category==null) 223 219 { … … 226 222 return category; 227 223 } 228 /* 229 the set method() without scope resolution is private and this is done so that 230 hibernate can keep track of the objects it creates in the collection 231 and also can 'only' return this object thru the get method(). 232 */ 224 233 225 void setCategory(Set<AnnotationTypeCategoryData> category) { 234 226 this.category = category; 235 227 } 236 237 228 238 229 private Set<ExperimentData> experiments; 239 230 /** -
branches/dominic_annotations/src/test/TestAnnotationTypeCategory.java
r2357 r2475 1 1 /* 2 $Id: TestAnnotationTypeCategory.java 1 2006-05-11 Dominic Oyeniran$2 $Id: TestAnnotationTypeCategory.java 1 2006-05-11 dominic $ 3 3 4 4 Copyright (C) Authors contributing to this file. … … 38 38 public class TestAnnotationTypeCategory { 39 39 40 private static boolean works; 40 static boolean works=true; 41 41 42 42 43 /** … … 46 47 TestUtil.checkArgs(args); 47 48 TestUtil.begin(); 48 test_all();49 works=test_all(); 49 50 TestUtil.stop(); 50 51 } … … 54 55 works=true; 55 56 int categoryid= 0; 56 write("++ +++++++++++++Testing annotation types categories+++++++++++++++++");57 write("++Testing annotation types categories"); 57 58 write_header(); 58 59 // Standard tests: create, load, list annotation type categories 59 categoryid= test_create(test_createAnnotationTypes(Type.INT, 10, Item.SAMPLE, null, true)); 60 int id_int=TestAnnotationType.test_create(Type.INT, 10, Item.SAMPLE, null, true); 61 categoryid= test_create(id_int); 60 62 test_load (categoryid); 61 63 … … 65 67 66 68 // Standard test: Delete 67 //test_delete(categoryid); 69 test_delete(categoryid); 70 TestAnnotationType.test_delete(id_int); 68 71 write("++Testing annotation types categories"+(works ? "OK" : "Failed")+"\n"); 69 70 72 return works; 71 73 } 72 74 73 74 static int test_create(AnnotationType at) 75 static int test_create(int annotationTypeId) 75 76 { 76 77 if (!TestUtil.hasPermission(Permission.CREATE, Item.ANNOTATIONTYPECATEGORY)) return 0; … … 80 81 { 81 82 dc = TestUtil.getDbControl(); 83 AnnotationType at = AnnotationType.getById(dc, annotationTypeId); 82 84 AnnotationTypeCategory atgc= AnnotationTypeCategory.getNew(dc); 83 85 atgc.setName("Test Category"); 84 atgc.setCategoryDescription("+++Just simply testing the categories+++");85 atgc.setDescription(" testing done on" + new Date().toString());86 //atgc.setCategoryDescription("Just simply testing the categories+++"); 87 atgc.setDescription("Added at :" + new Date().toString()); 86 88 atgc.addAnnotationType(at); 87 89 dc.saveItem(atgc); … … 105 107 106 108 return id; 107 }108 109 110 static AnnotationType test_createAnnotationTypes(Type type, Object defaultValue, Item itemType, Object[] enumValues, boolean setAll)111 {112 /*113 the failed create permission problems will cause a null exception watch out!"!!!114 it causes this method to return null when called.115 */116 if (!TestUtil.hasPermission(Permission.CREATE, Item.ANNOTATIONTYPE)) return null;117 AnnotationType at =null;118 DbControl dc = null;119 try120 {121 dc = TestUtil.getDbControl();122 at = AnnotationType.getNew(dc, type);123 if(setAll)124 {125 at.setName("Test annotation type: "+type);126 at.setDescription("Added at "+new Date());127 at.setMultiplicity(1);128 at.setRequiredForMiame(true);129 at.setHeight(10);130 at.setWidth(60);131 }132 if (enumValues != null)133 {134 at.setEnumeration(true);135 at.setValues(Arrays.asList(enumValues));136 at.setDisplayAsList(true);137 }138 if (defaultValue != null) at.setDefaultValue(defaultValue.toString());139 at.enableForItem(itemType);140 dc.saveItem(at);141 dc.commit();142 write("--Create annotation type OK");143 }144 catch (Throwable ex)145 {146 write("--Create annotation type FAILED");147 ex.printStackTrace();148 works = false;149 }150 finally151 {152 if (dc != null) dc.close();153 }154 return at;155 109 } 156 110 … … 232 186 } 233 187 234 235 188 236 189 static void write(String message) 237 190 { … … 243 196 if (!TestUtil.getSilent()) 244 197 { 245 write(" \tID \tName \tDescription\tCategory Desccription"); 246 write("-- \t-- \t--------- \t-----------\t---------------------"); 247 } 248 } 198 write(" \tID \tName \tDescription"); 199 write("-- \t-- \t--------- \t-----------"); 200 } 201 } 202 249 203 static void write_item(int i, AnnotationTypeCategory atgc) 250 204 throws BaseException 251 205 { 252 206 if (!TestUtil.getSilent()) 253 write(i+":\t"+atgc.getId()+"\t"+atgc.getName()+"\t"+atgc.getDescription()+"\t"+atgc.getCategoryDescription()); 254 } 255 207 write(i+":\t"+atgc.getId()+"\t"+atgc.getName()+"\t"+atgc.getDescription()); 208 } 256 209 257 210 -
branches/dominic_annotations/src/test/TestUtil.java
r2357 r2475 52 52 { 53 53 login = "root"; 54 //password = "root";55 password ="ab26oy";54 password = "root"; 55 56 56 client = "net.sf.basedb.clients.test"; 57 57 -
branches/dominic_annotations/www/admin/annotationtypecategories/edit_category.jsp
r2468 r2475 200 200 </tr> 201 201 <tr valign=top> 202 <td class="prompt">Short Description</td> 203 <td nowrap> 204 <textarea <%=clazz%> rows="2" cols="20" name="categoryDescription" wrap="virtual" 205 ><%=HTML.encodeTags(annotationTypeCategory == null ? cc.getPropertyValue("categoryDescription") : annotationTypeCategory.getCategoryDescription())%></textarea> 206 </td> 207 </tr> 208 <tr valign=top> 209 <td class="prompt">Detailed Description</td> 202 <td class="prompt">Description</td> 210 203 <td nowrap> 211 204 <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual" -
branches/dominic_annotations/www/admin/annotationtypecategories/index.jsp
r2400 r2475 58 58 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 59 59 <%! 60 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name, categoryDescription");60 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,description"); 61 61 private static final Item itemType = Item.ANNOTATIONTYPECATEGORY; 62 62 %> … … 147 147 annotationTypeCategory.setName(Values.getStringOrNull(request.getParameter("name"))); 148 148 annotationTypeCategory.setDescription(Values.getStringOrNull(request.getParameter("description"))); 149 annotationTypeCategory.setCategoryDescription(Values.getStringOrNull(request.getParameter("categoryDescription"))); 150 149 151 150 //Members tab 152 151 String[] removeAnnotationTypes = Values.getString(request.getParameter("removeAnnotationTypes")).split(","); -
branches/dominic_annotations/www/admin/annotationtypecategories/list_categories.jsp
r2356 r2475 213 213 property="description" 214 214 datatype="string" 215 title="Full Description" 216 sortable="true" 217 filterable="true" 218 exportable="true" 219 /> 220 <tbl:columndef 221 id="categoryDescription" 222 property="categoryDescription" 223 datatype="string" 224 title="Short Description" 215 title="Description" 225 216 sortable="true" 226 217 filterable="true" … … 375 366 <tbl:cell column="name"><div class="link" onclick="itemOnClick(event, <%=itemId%>)" title="View this annotation type category (use CTRL, ALT or SHIFT to edit)"><%=name%></div></tbl:cell> 376 367 <tbl:cell column="owner"><base:propertyvalue item="<%=item%>" property="owner.name" /></tbl:cell> 377 <tbl:cell column="categoryDescription"><%=item.getCategoryDescription()== null ? "<i>- none -</i>" : HTML.encodeTags(item.getCategoryDescription())%></tbl:cell>378 368 <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> 379 369 </tbl:row> -
branches/dominic_annotations/www/admin/annotationtypecategories/view_category.jsp
r2400 r2475 196 196 </tr> 197 197 <tr> 198 <td class="prompt">Short Description</td> 199 <td><%=HTML.niceFormat(annotationTypeCategory.getCategoryDescription())%></td></td> 200 </tr> 201 <tr> 202 <td class="prompt">Full Description</td> 198 <td class="prompt">Description</td> 203 199 <td><%=HTML.niceFormat(annotationTypeCategory.getDescription())%></td> 204 200 </tr> -
branches/dominic_annotations/www/admin/annotationtypes/view_annotationtype.jsp
r2400 r2475 240 240 %> 241 241 <h4>Membership</h4> 242 Th ere are no members of this role(or, you don't have permission to view them).242 This annotation type isn't a member of any category (or, you don't have permission to view them). 243 243 <% 244 244 } … … 277 277 <tbl:cell column="name"><%=Base.getEncodedName(annotationtypecategory, false, annotationTypeCategoryLink)%></tbl:cell> 278 278 <tbl:cell column="type">Category</tbl:cell> 279 <tbl:cell column="description"><%=HTML.encodeTags(annotationtypecategory.get CategoryDescription())%></tbl:cell>279 <tbl:cell column="description"><%=HTML.encodeTags(annotationtypecategory.getDescription())%></tbl:cell> 280 280 </tbl:row> 281 281 <% -
branches/dominic_annotations/www/admin/groups/edit_group.jsp
r2345 r2475 170 170 function initMembers() 171 171 { 172 alert('Enter initmembers'); 172 173 var members = document.forms['group'].members; 173 174 Link.addNewSection(members, new Section('U', 'Users')); -
branches/dominic_annotations/www/common/annotations/annotate.jsp
r2469 r2475 355 355 </div> 356 356 <base:icon image="hasvalues.gif" /> = has value(s) 357 <b>Here We Are ooooooooooooooo</b>358 357 </td> 359 358 <td width="50%">
Note: See TracChangeset
for help on using the changeset viewer.