Search in sources :

Example 31 with ItemManager

use of gov.usgs.cida.coastalhazards.jpa.ItemManager in project coastal-hazards by USGS-CIDA.

the class TutorialRouter method showActionCenterTutorial.

/**
 * Sends the client to the item info page with a header to notify the client
 * to start a tour
 *
 * @param id
 * @return
 */
@GET
@Produces(MediaType.TEXT_HTML)
@Path("/item/{itemId}")
public Response showActionCenterTutorial(@PathParam("itemId") String id) {
    Response response;
    Map<String, Object> map;
    Item item;
    try (ItemManager mgr = new ItemManager()) {
        item = mgr.load(id);
    }
    if (item == null) {
        response = Response.status(Response.Status.NOT_FOUND).build();
    } else {
        map = new HashMap<>();
        map.put("item", item);
        map.put("tutorial", "true");
        response = Response.ok(new Viewable("/WEB-INF/jsp/ui/back/index.jsp", map)).build();
    }
    return response;
}
Also used : Response(javax.ws.rs.core.Response) Item(gov.usgs.cida.coastalhazards.model.Item) ItemManager(gov.usgs.cida.coastalhazards.jpa.ItemManager) Viewable(org.glassfish.jersey.server.mvc.Viewable) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ItemManager (gov.usgs.cida.coastalhazards.jpa.ItemManager)31 Item (gov.usgs.cida.coastalhazards.model.Item)26 Path (javax.ws.rs.Path)24 GET (javax.ws.rs.GET)22 Produces (javax.ws.rs.Produces)21 Response (javax.ws.rs.core.Response)21 HashMap (java.util.HashMap)11 NotFoundException (javax.ws.rs.NotFoundException)9 StatusManager (gov.usgs.cida.coastalhazards.jpa.StatusManager)8 Status (gov.usgs.cida.coastalhazards.model.util.Status)8 JsonSyntaxException (com.google.gson.JsonSyntaxException)7 BadRequestException (gov.usgs.cida.coastalhazards.exception.BadRequestException)7 Viewable (org.glassfish.jersey.server.mvc.Viewable)7 Gson (com.google.gson.Gson)6 JsonObject (com.google.gson.JsonObject)5 AliasManager (gov.usgs.cida.coastalhazards.jpa.AliasManager)5 Alias (gov.usgs.cida.coastalhazards.model.Alias)5 RolesAllowed (javax.annotation.security.RolesAllowed)5 ThumbnailManager (gov.usgs.cida.coastalhazards.jpa.ThumbnailManager)4 IOException (java.io.IOException)4