Class DefaultIDGeneratorService

  extended by
All Implemented Interfaces:, IDGeneratorService, ServiceClass

public class DefaultIDGeneratorService
extends java.lang.Object
implements IDGeneratorService

default ID generator. A data modeller can specify parameters for prefix and keys to exclude from generation.

Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.

Kevin Garwood (
See Also:
Serialized Form

Constructor Summary
Method Summary
 void excludeKey(java.lang.String keyToExclude)
          excludes a key as a possible value to generate.
 java.lang.String generateKey(Project35FormContext project35FormContext)
          generates an identifier value that Project35 can insert into a field that takes ID values
 Parameter[] getInitialisationParameters()
 Parameter[] getParameters()
 void initialiseService( resourceDirectory, Parameter[] parameters)
 void setIDPrefix(java.lang.String identifierPrefix)
          set the prefix of identifier keys
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DefaultIDGeneratorService()
Method Detail


public void setIDPrefix(java.lang.String identifierPrefix)
set the prefix of identifier keys

identifierPrefix - the prefix that is used to create key values


public void excludeKey(java.lang.String keyToExclude)
Description copied from interface: IDGeneratorService
excludes a key as a possible value to generate. This is used when Project35 reads a file that contains identifiers. This method ensures that the service won't return a value that already appears somewhere in the data set.

Specified by:
excludeKey in interface IDGeneratorService
keyToExclude - an identifier value that can't be generated by the ID Generator service


public Parameter[] getParameters()


public java.lang.String generateKey(Project35FormContext project35FormContext)
Description copied from interface: IDGeneratorService
generates an identifier value that Project35 can insert into a field that takes ID values

Specified by:
generateKey in interface IDGeneratorService
project35FormContext - collection of environment variables that can be used to access different parts of the Project35 application. Information in these variables may help determine the best identifier to return.


public Parameter[] getInitialisationParameters()
Specified by:
getInitialisationParameters in interface ServiceClass


public void initialiseService( resourceDirectory,
                              Parameter[] parameters)
                       throws java.lang.Exception
Specified by:
initialiseService in interface ServiceClass