← Back to team overview

slub.team team mailing list archive

[Merge] lp:~henning-gerhardt/goobi-production/rest-webapi into lp:goobi-production

 

Ralf Claussnitzer has proposed merging lp:~henning-gerhardt/goobi-production/rest-webapi into lp:goobi-production.

Requested reviews:
  Saxon State Library Team (slub.team)

For more details, see:
https://code.launchpad.net/~henning-gerhardt/goobi-production/rest-webapi/+merge/116691
-- 
https://code.launchpad.net/~henning-gerhardt/goobi-production/rest-webapi/+merge/116691
Your team Saxon State Library Team is requested to review the proposed merge of lp:~henning-gerhardt/goobi-production/rest-webapi into lp:goobi-production.
=== modified file 'WEB-INF/web.xml'
--- WEB-INF/web.xml	2012-04-20 06:57:46 +0000
+++ WEB-INF/web.xml	2012-07-25 16:09:22 +0000
@@ -312,4 +312,20 @@
 		<location>/newpages/error.jsf</location>
 	</error-page>
 
+    <servlet>
+        <servlet-name>Goobi REST Service based on Jersey</servlet-name>
+        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>com.sun.jersey.config.property.packages</param-name>
+            <param-value>org.goobi.webapi.resources</param-value>
+        </init-param>
+        <!-- explanation of load-on-startup: http://stackoverflow.com/a/1298984 -->
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>Goobi REST Service based on Jersey</servlet-name>
+        <url-pattern>/rest/*</url-pattern>
+    </servlet-mapping>
+
 </web-app>

=== added file 'lib/asm-3.1.jar'
Binary files lib/asm-3.1.jar	1970-01-01 00:00:00 +0000 and lib/asm-3.1.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-bundle-1.12.jar'
Binary files lib/jersey-bundle-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-bundle-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-client-1.12.jar'
Binary files lib/jersey-client-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-client-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-core-1.12.jar'
Binary files lib/jersey-core-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-core-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-json-1.12.jar'
Binary files lib/jersey-json-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-json-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-multipart-1.12.jar'
Binary files lib/jersey-multipart-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-multipart-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-server-1.12.jar'
Binary files lib/jersey-server-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-server-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jersey-servlet-1.12.jar'
Binary files lib/jersey-servlet-1.12.jar	1970-01-01 00:00:00 +0000 and lib/jersey-servlet-1.12.jar	2012-07-25 16:09:22 +0000 differ
=== added file 'lib/jsr311-api-1.1.1.jar'
Binary files lib/jsr311-api-1.1.1.jar	1970-01-01 00:00:00 +0000 and lib/jsr311-api-1.1.1.jar	2012-07-25 16:09:22 +0000 differ
=== added directory 'src/org/goobi/webapi'
=== added directory 'src/org/goobi/webapi/beans'
=== added file 'src/org/goobi/webapi/beans/GoobiProcessInformation.java'
--- src/org/goobi/webapi/beans/GoobiProcessInformation.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/beans/GoobiProcessInformation.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.beans;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class GoobiProcessInformation  {
+
+	private String identifier;
+
+	private String title;
+
+	public GoobiProcessInformation() {}
+
+	public GoobiProcessInformation(String identifier, String title) {
+		this.identifier = identifier;
+		this.title = title;
+	}
+
+	public String getIdentifier() {
+		return identifier;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setIdentifier(String identifier) {
+		this.identifier = identifier;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+}

=== added file 'src/org/goobi/webapi/beans/GoobiProcessStateInformation.java'
--- src/org/goobi/webapi/beans/GoobiProcessStateInformation.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/beans/GoobiProcessStateInformation.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.beans;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class GoobiProcessStateInformation {
+
+	private Integer sequence;
+	private Integer state;
+	private String title;
+
+	public GoobiProcessStateInformation() {}
+
+	public GoobiProcessStateInformation(Integer sequence, Integer state, String title) {
+		this.sequence = sequence;
+		this.state = state;
+		this.title = title;
+	}
+
+	public Integer getSequence() {
+		return sequence;
+	}
+
+	public void setSequence(Integer sequence) {
+		this.sequence = sequence;
+	}
+
+	public Integer getState() {
+		return state;
+	}
+
+	public void setState(Integer state) {
+		this.state = state;
+	}
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+}

=== added directory 'src/org/goobi/webapi/models'
=== added file 'src/org/goobi/webapi/models/GoobiProcess.java'
--- src/org/goobi/webapi/models/GoobiProcess.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/models/GoobiProcess.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,83 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.models;
+
+import de.sub.goobi.beans.Prozess;
+import de.sub.goobi.helper.Helper;
+
+import org.apache.log4j.Logger;
+import org.goobi.webapi.beans.GoobiProcessInformation;
+import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.transform.Transformers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GoobiProcess {
+
+	private static final Logger myLogger = Logger.getLogger(GoobiProcess.class);
+
+	public static List<GoobiProcessInformation> getAllProcesses()	{
+		Session session;
+		List<GoobiProcessInformation> result;
+
+		result = new ArrayList<GoobiProcessInformation>();
+		session = Helper.getHibernateSession();
+
+		try {
+
+			Criteria criteria = session
+					.createCriteria(Prozess.class)
+					.createAlias("vorlagen", "v")
+					.createAlias("vorlagen.eigenschaften", "ve")
+					.createAlias("werkstuecke", "w")
+					.createAlias("werkstuecke.eigenschaften", "we")
+					.add(Restrictions.or(Restrictions.eq("we.titel", "PPN digital a-Satz"), Restrictions.eq("we.titel", "PPN digital f-Satz")))
+					.add(Restrictions.eq("ve.titel", "Titel"))
+					.addOrder(Order.asc("we.wert"))
+					.setProjection(Projections.projectionList()
+							.add(Projections.property("we.wert"), "identifier")
+							.add(Projections.property("ve.wert"), "title")
+					)
+					.setResultTransformer(Transformers.aliasToBean(GoobiProcessInformation.class))
+					;
+
+			@SuppressWarnings(value="unchecked")
+			List<GoobiProcessInformation> list = (List<GoobiProcessInformation>) criteria.list();
+
+			if ((list != null) && (list.size() > 0)) {
+				result.addAll(list);
+			}
+		} catch (HibernateException he) {
+			myLogger.error("Catched Hibernate exception: " + he.getMessage());
+		}
+
+		return result;
+	}
+
+}

=== added file 'src/org/goobi/webapi/models/GoobiProcessState.java'
--- src/org/goobi/webapi/models/GoobiProcessState.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/models/GoobiProcessState.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,91 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.models;
+
+import de.sub.goobi.beans.Schritt;
+import de.sub.goobi.helper.Helper;
+
+import org.apache.log4j.Logger;
+
+import org.goobi.webapi.beans.GoobiProcessStateInformation;
+import org.goobi.webapi.validators.IdentifierPpn;
+import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.transform.Transformers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GoobiProcessState {
+
+	private static final Logger myLogger = Logger.getLogger(GoobiProcessState.class);
+
+	public static List<GoobiProcessStateInformation> getProcessState(String ppnIdentifier) {
+		List<GoobiProcessStateInformation> result;
+		Session session;
+
+		result = new ArrayList<GoobiProcessStateInformation>();
+		session = Helper.getHibernateSession();
+
+		if (!IdentifierPpn.isValid(ppnIdentifier)) {
+			myLogger.warn("Invalid PPN " + ppnIdentifier + " given!");
+			return result;
+		}
+
+		try {
+
+			Criteria criteria = session
+					.createCriteria(Schritt.class)
+					.createAlias("prozess", "p")
+					.createAlias("prozess.werkstuecke", "w")
+					.createAlias("prozess.werkstuecke.eigenschaften", "we")
+					.add(Restrictions.or(Restrictions.eq("we.titel", "PPN digital a-Satz"), Restrictions.eq("we.titel", "PPN digital f-Satz")))
+					.add(Restrictions.eq("we.wert", ppnIdentifier))
+					.addOrder(Order.asc("reihenfolge"))
+					.setProjection(Projections.projectionList()
+							.add(Projections.property("reihenfolge"), "sequence")
+							.add(Projections.property("bearbeitungsstatus"), "state")
+							.add(Projections.property("titel"), "title")
+					)
+					.setResultTransformer(Transformers.aliasToBean(GoobiProcessStateInformation.class))
+					;
+
+			@SuppressWarnings(value = "unchecked")
+			List<GoobiProcessStateInformation> list = (List<GoobiProcessStateInformation>) criteria.list();
+
+			if ((list != null) && (list.size() > 0)) {
+				result.addAll(list);
+			}
+		} catch (HibernateException he) {
+			myLogger.error("Catched Hibernate exception: " + he.getMessage());
+		}
+
+		return result;
+	}
+
+
+}

=== added directory 'src/org/goobi/webapi/resources'
=== added file 'src/org/goobi/webapi/resources/ProcessState.java'
--- src/org/goobi/webapi/resources/ProcessState.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/resources/ProcessState.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.resources;
+
+import com.sun.jersey.api.NotFoundException;
+import org.goobi.webapi.models.GoobiProcessState;
+import org.goobi.webapi.beans.GoobiProcessStateInformation;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+import java.util.List;
+
+public class ProcessState {
+
+	@Context UriInfo uriInfo;
+	@Context Request request;
+	String ppnIdentifier;
+
+	public ProcessState(UriInfo uriInfo, Request request, String ppnIdentifier) {
+		this.uriInfo = uriInfo;
+		this.request = request;
+		this.ppnIdentifier = ppnIdentifier;
+	}
+
+	@GET
+	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+	public List<GoobiProcessStateInformation> getProzessState() {
+		List<GoobiProcessStateInformation> listStates;
+
+		listStates = GoobiProcessState.getProcessState(ppnIdentifier);
+
+		if ((listStates == null) || (listStates.size() == 0)) {
+			throw new NotFoundException("No such Goobi process.");
+		}
+
+		return listStates;
+	}
+
+}

=== added file 'src/org/goobi/webapi/resources/ProcessesState.java'
--- src/org/goobi/webapi/resources/ProcessesState.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/resources/ProcessesState.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.resources;
+
+import com.sun.jersey.api.NotFoundException;
+import org.goobi.webapi.models.GoobiProcess;
+import org.goobi.webapi.beans.GoobiProcessInformation;
+import org.goobi.webapi.validators.IdentifierPpn;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.UriInfo;
+import java.util.ArrayList;
+import java.util.List;
+
+@Path("/processState")
+public class ProcessesState {
+
+	@Context UriInfo uriInfo;
+	@Context Request request;
+
+	@GET
+	@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+	public List<GoobiProcessInformation> getProcesses(){
+		List<GoobiProcessInformation> processes = new ArrayList<GoobiProcessInformation>();
+
+		processes.addAll(GoobiProcess.getAllProcesses());
+
+		return processes;
+	}
+
+	@Path("{ppnIdentifier}")
+	public ProcessState getProcessState(@PathParam("ppnIdentifier") String ppnIdentifier) {
+		if (IdentifierPpn.isValid((ppnIdentifier))) {
+			return new ProcessState(uriInfo, request, ppnIdentifier);
+		} else {
+			throw new NotFoundException("Given PPN is invalid.");
+		}
+	}
+}

=== added directory 'src/org/goobi/webapi/validators'
=== added file 'src/org/goobi/webapi/validators/IdentifierPpn.java'
--- src/org/goobi/webapi/validators/IdentifierPpn.java	1970-01-01 00:00:00 +0000
+++ src/org/goobi/webapi/validators/IdentifierPpn.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.validators;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class IdentifierPpn {
+
+	public static boolean isValid(String identifier) {
+		Boolean result;
+		int flags = Pattern.CASE_INSENSITIVE;
+		Pattern pattern;
+		Matcher matcher;
+
+		if ((identifier == null) || (identifier.length() == 0)) {
+			result = false;
+		} else {
+			pattern = Pattern.compile("^[0-9]{8}[0-9LXYZ]{1}$", flags);
+			matcher = pattern.matcher(identifier);
+			result = matcher.matches();
+		}
+
+		return result;
+	}
+
+}

=== added directory 'test/src/org/goobi/webapi'
=== added directory 'test/src/org/goobi/webapi/validators'
=== added file 'test/src/org/goobi/webapi/validators/IdentifierPpnTest.java'
--- test/src/org/goobi/webapi/validators/IdentifierPpnTest.java	1970-01-01 00:00:00 +0000
+++ test/src/org/goobi/webapi/validators/IdentifierPpnTest.java	2012-07-25 16:09:22 +0000
@@ -0,0 +1,79 @@
+/*
+ * This file is part of the Goobi Application - a Workflow tool for the support of
+ * mass digitization.
+ *
+ * Visit the websites for more information.
+ *     - http://gdz.sub.uni-goettingen.de
+ *     - http://www.goobi.org
+ *     - http://launchpad.net/goobi-production
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details. You
+ * should have received a copy of the GNU General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package org.goobi.webapi.validators;
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+public class IdentifierPpnTest {
+
+	@Test
+	public void givenValidePpnShouldCorrect() {
+		String identifier = "32578597X";
+
+		Assert.assertTrue("Given PPN " + identifier + " should be correct.", IdentifierPpn.isValid(identifier));
+	}
+
+	@Test
+	public void lowerCaseValidPpnShouldBeCorrect() {
+		String identifier = "32578597x";
+
+		Assert.assertTrue("Given lowercase PPN " + identifier + " should be correct.", IdentifierPpn.isValid(identifier));
+
+	}
+
+	@Test
+	public void invalidPpnShouldBeFalse() {
+		String identifier = "32578597A";
+
+		Assert.assertFalse("Given PPN " + identifier + " should be invalid.", IdentifierPpn.isValid(identifier));
+	}
+
+	@Test
+	public void emptyStringValueShouldBeFalse() {
+		String identifier = "";
+
+		Assert.assertFalse("Empty string value should be invalid.", IdentifierPpn.isValid(identifier));
+	}
+
+	@Test
+	public void nullValueValidatedAsFalse() {
+		String identifier = null;
+
+		Assert.assertFalse("Null value should be invalid.", IdentifierPpn.isValid(identifier));
+	}
+
+	@Test
+	public void toShortPpnShouldNotBeCorrect() {
+		String identifier = "123";
+
+		Assert.assertFalse("To short PPN " + identifier + " should be invalid.", IdentifierPpn.isValid(identifier));
+	}
+
+	@Test
+	public void toLongPpnShouldNotBeCorrect() {
+		String identifier = "1234567890";
+
+		Assert.assertFalse("To long PPN " + identifier + " should be invalid.", IdentifierPpn.isValid(identifier));
+	}
+}


Follow ups