source: trunk/greenstone3-extensions/gs3build/src/org/greenstone/gsdl3/gs3build/collection/BuildIDFactory.java@ 12188

Last change on this file since 12188 was 12188, checked in by kjdon, 18 years ago

Initial revision

  • Property svn:keywords set to Author Date Id Revision
File size: 817 bytes
Line 
1package org.greenstone.gsdl3.gs3build.collection;
2
3import java.util.GregorianCalendar;
4
5import org.greenstone.gsdl3.gs3build.BuildManager;
6import org.greenstone.gsdl3.gs3build.doctypes.DocumentID;
7import org.greenstone.gsdl3.gs3build.doctypes.DocumentInterface;
8
9public class BuildIDFactory implements IDFactoryInterface
10{
11 int sequenceNumber;
12
13 public BuildIDFactory(BuildManager manager)
14 {
15 GregorianCalendar today = new GregorianCalendar();
16
17 String oldBuild = manager.getLastBuildSequence();
18 if (oldBuild != null)
19 { this.sequenceNumber = Integer.parseInt(oldBuild);
20 }
21 else
22 { this.sequenceNumber = 0;
23 }
24 }
25
26 public DocumentID getDocumentID(DocumentInterface document)
27 { String value = new String(Integer.toString(this.sequenceNumber));
28 this.sequenceNumber ++;
29 return new DocumentID(value);
30 }
31}
Note: See TracBrowser for help on using the repository browser.