KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > archive > cumulus > CumulusHistoryArchive


1 /*
2  * Created on Dec 1, 2006
3  */

4 package com.openedit.archive.cumulus;
5
6 import java.util.Iterator JavaDoc;
7
8 import com.openedit.OpenEditException;
9 import com.openedit.archive.Archive;
10 import com.openedit.archive.history.HistoryArchive;
11 import com.openedit.archive.history.HistoryRecord;
12 import com.openedit.archive.history.UsageHistory;
13
14 public class CumulusHistoryArchive extends HistoryArchive
15 {
16     
17     public void save(Archive inArchive, UsageHistory inCols) throws OpenEditException
18     {
19         super.save(inArchive, inCols);
20         
21         String JavaDoc history = inCols.getProduct().get("Version History");
22         //Build strinng for Version History
23
if( history == null)
24         {
25             history = "";
26         }
27         for (Iterator JavaDoc iterator = inCols.getRecordData(); iterator.hasNext();)
28         {
29             HistoryRecord record = (HistoryRecord) iterator.next();
30             //"Date" tab "Description" tab "Audience" tab "Type of Use" tab "User Name" tab "Form #" tab "Final/FPO" return
31
String JavaDoc fields = record.get("date") +"\t" + record.get("comments") + "\t" + record.get("use") + "\t" + record.get("use2") +"\t"+
32                             record.get("username") +"\t" + record.get("formID") + "\t" + record.get("isfpo") +"\r";
33             
34             if( history.indexOf(fields) == -1)
35             {
36                 if( history.length() > 0 && !history.endsWith("\r"))
37                 {
38                     history = history + "\r";
39                 }
40                 history = history + fields;
41             }
42         }
43         inCols.getProduct().putProperty("Version History", history);
44         //Add in any records that we have in the history that are not already in there
45

46         inArchive.getStore().getProductArchive().saveProduct(inCols.getProduct());
47         inArchive.getStore().getMirrorProductArchive().saveProduct(inCols.getProduct());
48         
49     }
50     
51 }
52
Popular Tags