Search in sources :

Example 16 with Summary

use of gov.usgs.cida.coastalhazards.model.summary.Summary in project coastal-hazards by USGS-CIDA.

the class Item method copyValues.

/**
 * I'm creating a new item rather than modifying references (hence final)
 *
 * @param from item to copy values from
 * @param to item to retain ids for
 * @return new Item that is fully hydrated
 */
public static Item copyValues(final Item from, final Item to) {
    Item item = new Item();
    if (to != null && to.getItemType() != from.getItemType()) {
        throw new UnsupportedOperationException("Cannot change item type");
    }
    String id = from.getId();
    Bbox toBbox = null;
    Summary toSummary = null;
    if (to != null) {
        id = to.getId();
        toBbox = to.getBbox();
        toSummary = to.getSummary();
    }
    item.setId(id);
    item.setItemType(from.getItemType());
    item.setType(from.getType());
    item.setName(from.getName());
    item.setAttr(from.getAttr());
    item.setBbox(Bbox.copyValues(from.getBbox(), toBbox));
    item.setSummary(Summary.copyValues(from.getSummary(), toSummary));
    item.setRibbonable(from.isRibbonable());
    item.setShowChildren(from.isShowChildren());
    item.setEnabled(from.isEnabled());
    item.setServices(from.getServices());
    item.setChildren(from.getChildren());
    item.setDisplayedChildren(from.getDisplayedChildren());
    item.setActiveStorm(from.isActiveStorm());
    item.setFeatured(from.isFeatured());
    return item;
}
Also used : Summary(gov.usgs.cida.coastalhazards.model.summary.Summary)

Aggregations

Summary (gov.usgs.cida.coastalhazards.model.summary.Summary)16 Item (gov.usgs.cida.coastalhazards.model.Item)12 LinkedList (java.util.LinkedList)9 Response (javax.ws.rs.core.Response)9 Service (gov.usgs.cida.coastalhazards.model.Service)7 Tiny (gov.usgs.cida.coastalhazards.model.summary.Tiny)7 HashMap (java.util.HashMap)6 Test (org.junit.Test)6 Gson (com.google.gson.Gson)5 Map (java.util.Map)5 IOException (java.io.IOException)4 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)4 SAXException (org.xml.sax.SAXException)4 JsonSyntaxException (com.google.gson.JsonSyntaxException)3 Layer (gov.usgs.cida.coastalhazards.model.Layer)3 List (java.util.List)3 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 Viewable (org.glassfish.jersey.server.mvc.Viewable)3