source: branches/ant-install-branch/gsdl3/src/java/org/greenstone/gsdl3/gs3build/metadata/AbstractIdentifierFactory.java@ 9858

Last change on this file since 9858 was 6287, checked in by cs025, 20 years ago

Various changes to the METS structures and identifier factories to
move towards updateable structures and to add section support.

  • Property svn:keywords set to Author Date Id Revision
File size: 687 bytes
Line 
1package org.greenstone.gsdl3.gs3build.metadata;
2
3public abstract class AbstractIdentifierFactory
4{
5 private String idPrelude;
6 private int idSeqNo;
7
8 public AbstractIdentifierFactory(String idPrelude)
9 { this.idPrelude = idPrelude;
10 this.idSeqNo = 1;
11 }
12
13 public String getNextIdentifier()
14 { int id = this.idSeqNo ++;
15
16 return idPrelude + Integer.toString(id);
17 }
18
19 public void noteIdentifier(String identifier)
20 { if (!identifier.startsWith(this.idPrelude))
21 return;
22
23 identifier = identifier.substring(this.idPrelude.length());
24
25 int value = Integer.parseInt(identifier);
26 if (value >= this.idSeqNo) {
27 this.idSeqNo = value + 1;
28 }
29 }
30}
Note: See TracBrowser for help on using the repository browser.