Java - BINs y JSON

 
Vista:

BINs y JSON

Publicado por intentoJava (1 intervención) el 19/12/2014 00:10:18
Buenas me han dado esta tarea como primera fase para encontrar un curro de programador em Java, pero ando bastante perdidillo, aun me estoy iniciando en este mundo.

Lo que he hecho es un pasar un BIN desde un JSP y recibirlo en un servlet a su vez este valida el formato del BIN y quiero aunque eso todavía no lo he conseguido que el servlet genere el JSON.
El planteamiento que he hecho no se si es acertado o voy totalmente desencaminado.

Una ayudita por favor.

Esta es la tarea que me han mandado:

Task

● Develop a Java solution that:
● Implements two APIs as defined by the interface in figure 2
● Validates BIN input values
● Calls the book enquiry on the back end system - see figure 3 for the interface
● You will be provided with a skeleton project


Specification

Books are allocated a Book Identification Number, BIN, which has this format: AAA-999-999;
i.e. three uppercase letters, a hyphen, three digits, a hyphen and three digits.

A back end system exposes a book enquiry API. This API takes a BIN as input and returns a
JSON string. The structure of the JSON is illustrated in figure 1. The book element will not be
present when the book is not in the library.

------------------------------------------------------------
{
“BIN” : “TYK­268­921”,
“isInLibrary” : true,
“book” : {
“title” : “Clean Code”,
“author” : “Bob Martin”,
“availableFrom” : “2014­12­25”
}
}
Figure1

package com.novacroft.library.front_office;
public interface BookAvailabilityService {
Boolean isBookInLibrary(String bookIdentificationNumber);
Date whenIsBookAvailable(String bookIdentificationNumber);
}
Figure 2

------------------------------------------------------------

package com.novacroft.library.back_office;
public interface Librarian {
String bookEnquiry(String bookIdentificationNumber);
}

Figure 3

------------------------------------------------------------

Gracias y saludos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder