@Requirement(reqId="DOI_INTER_030", reqName="Interface avec la base de donn\u00e9es de gestion des suffixes DOI") public final class UniqueProjectName extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
UniqueProjectName.UniqueProjectNameHolder
Class to handle the instance
|
Modifier and Type | Field and Description |
---|---|
private static org.apache.logging.log4j.Logger |
LOGGER
logger.
|
Modifier | Constructor and Description |
---|---|
private |
UniqueProjectName()
Constructor
|
Modifier and Type | Method and Description |
---|---|
private int |
convert(long input,
String projectName,
int maxNumber)
Convert the project name into unique long
|
private int |
generateId(int maxNumber)
Creates an Id with an uniform distribution.
|
static UniqueProjectName |
getInstance()
Access to unique INSTANCE of Settings
|
List<DOIProject> |
getProjects()
Returns the projects from the database.
|
List<DOIProject> |
getProjectsFromUser(String userName)
Returns the projects associated to an user from the database.
|
int |
getShortName(String project,
int length)
Build a unique String from the project name
|
private boolean |
isIdUnique(int idToCheck,
String projectName)
Check if the generated suffixID is unique (does not already exists) or
not.
|
public static UniqueProjectName getInstance()
public List<DOIProject> getProjects() throws DOIDbException
DOIDbException
- When a problem occurspublic List<DOIProject> getProjectsFromUser(String userName) throws DOIDbException
userName
- user nameDOIDbException
- When a problem occursprivate int generateId(int maxNumber)
maxNumber
- Number max to generateprivate int convert(long input, String projectName, int maxNumber)
input
- Identifier to convertprojectName
- the project name to convertmaxNumber
- Number max to generatepublic int getShortName(String project, int length) throws DOIDbException
project
- the project namelength
- length of the short name to generate (the short name must
be an int to the length cannot be up to 9)DOIDbException
- When a problem occursprivate boolean isIdUnique(int idToCheck, String projectName)
idToCheck
- the identifier to checkprojectName
- Project associated to the suffixIDCopyright © 2017–2020 CNES. All rights reserved.