project35.soa.id
Class DefaultIDGeneratorService

java.lang.Object
  extended by project35.soa.id.DefaultIDGeneratorService
All Implemented Interfaces:
java.io.Serializable, 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.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)
See Also:
Serialized Form

Constructor Summary
DefaultIDGeneratorService()
           
 
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(java.net.URL 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

DefaultIDGeneratorService

public DefaultIDGeneratorService()
Method Detail

setIDPrefix

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

Parameters:
identifierPrefix - the prefix that is used to create key values

excludeKey

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
Parameters:
keyToExclude - an identifier value that can't be generated by the ID Generator service

getParameters

public Parameter[] getParameters()

generateKey

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
Parameters:
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.

getInitialisationParameters

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

initialiseService

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