Changeset 2165
- Timestamp:
- Apr 18, 2006, 12:27:06 PM (17 years ago)
- Location:
- trunk/src/core/net/sf/basedb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/dtd/helpfile.dtd
r2159 r2165 1 1 <!-- 2 $Id: help export.dtd,2004/07/28 12:30:49 nicklas Exp $2 $Id: helpfile.dtd,2004/07/28 12:30:49 nicklas Exp $ 3 3 4 4 BioArray Software Environment (BASE) - http://base.thep.lu.se/ … … 22 22 Boston, MA 02111-1307, USA. 23 23 --> 24 <!ELEMENT helpexport (helpitem*) > 24 <!ELEMENT helptexts (helpitem*)> 25 <!ATTLIST helptexts 26 clientExternalID CDATA #REQUIRED 27 > 25 28 26 <!ELEMENT helpitem ( property)>29 <!ELEMENT helpitem (name,description)> 27 30 <!ATTLIST helpitem 28 id ID#REQUIRED31 externalID CDATA #REQUIRED 29 32 > 30 33 31 <!ELEMENT property EMPTY > 32 <!ATTLIST property 33 version CDATA #REQUIRED 34 name CDATA #REQUIRED 35 description CDATA #REQUIRED 36 clientid CDATA #REQUIRED 37 externalid CDATA #REQUIRED 38 > 34 <!ELEMENT name (#CDATA)> 35 <!ELEMENT description (#CDATA)> -
trunk/src/core/net/sf/basedb/plugins/HelpExporter.java
r2159 r2165 274 274 Writer helpExportStream = new OutputStreamWriter(file.getUploadStream(false), "UTF-8"); 275 275 helpExportStream.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 276 xmlOut.output(new DocType("helpexport", "helpfile.dtd"), helpExportStream); 277 helpExportStream.write("\n<helpexport>\n"); 276 xmlOut.output(new DocType("helptexts", "helpfile.dtd"), helpExportStream); 277 Element helpRoot = new Element("helptexts"); 278 helpRoot.setAttribute("clientExternalID", client.getExternalId()); 278 279 279 280 //Transform the helpitems to XML elements … … 294 295 exportedHelpItems++; 295 296 Help helpItem = (Help)result.next(); 296 int helpId = helpItem.getId();297 297 Element newHelpElement = new Element("helpitem"); 298 newHelpElement.setAttribute(" id", "help_" + helpId);298 newHelpElement.setAttribute("externalID", helpItem.getExternalId()); 299 299 300 //Add the helpitem's properties to the helpitem element 301 Element property = new Element("property"); 302 property.setAttribute("version", helpItem.getVersion() + ""); 303 property.setAttribute("name", helpItem.getName()); 304 property.setAttribute("description", helpItem.getDescription()); 305 property.setAttribute("clientid", helpItem.getClient().getId() + ""); 306 property.setAttribute("externalid", helpItem.getExternalId()); 307 newHelpElement.addContent(property); 300 Element name = new Element("name"); 301 Element description = new Element("description"); 308 302 309 xmlOut.output(newHelpElement, helpExportStream); 310 helpExportStream.write("\n"); 303 name.setText(helpItem.getName()); 304 description.setText(helpItem.getDescription()); 305 306 newHelpElement.addContent(name); 307 newHelpElement.addContent(description); 308 309 helpRoot.addContent(newHelpElement); 311 310 progress.display(percentDone,""); 312 311 } … … 320 319 321 320 //Finish the XML document, close the stream and commit to DB 322 helpExportStream.write("</helpexport>");321 xmlOut.output(helpRoot, helpExportStream); 323 322 helpExportStream.flush(); 324 323 helpExportStream.close(); … … 336 335 } 337 336 338 p ublicint getPercentPerItem(ItemQuery<Help> query, DbControl dc)337 private int getPercentPerItem(ItemQuery<Help> query, DbControl dc) 339 338 { 340 339 query.setReturnTotalCount(true); 341 340 query.setFirstResult(0); 342 341 query.setMaxResults(0); 343 int nrOfItem = (query.iterate(dc).getTotalCount()); 344 return (100/nrOfItem); 342 int nrOfItem = (query.iterate(dc).getTotalCount()); 343 if (nrOfItem > 0) 344 { 345 return (100/nrOfItem); 346 } 347 else 348 { 349 return 100; 350 } 345 351 } 346 352 }
Note: See TracChangeset
for help on using the changeset viewer.