[New] Now the inspector can inspect from Agent to Element overviews
When the strolch restful classes are registered, the following API is enabled: strolch/inspector - overview of the realms strolch/inspector/{realm} - ovierview of the elements in a realm strolch/inspector/{realm}/order - overview of the orders strolch/inspector/{realm}/resource - overview of the resources strolch/inspector/{realm}/resource/{type} - overview of the resource types strolch/inspector/{realm}/order/{type} - overview of the order types strolch/inspector/{realm}/resource/{type}/{id} - get resource overview strolch/inspector/{realm}/order/{type}/{id} - get an order overview Getting details of the Resources and Orders is coming next
This commit is contained in:
parent
54494a9070
commit
d155a8753b
|
@ -15,21 +15,37 @@
|
|||
*/
|
||||
package li.strolch.rest.inspector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.GenericEntity;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import li.strolch.agent.api.ComponentContainer;
|
||||
import li.strolch.agent.api.OrderMap;
|
||||
import li.strolch.agent.api.ResourceMap;
|
||||
import li.strolch.agent.impl.StrolchRealm;
|
||||
import li.strolch.exception.StrolchException;
|
||||
import li.strolch.model.Order;
|
||||
import li.strolch.model.Resource;
|
||||
import li.strolch.persistence.api.StrolchTransaction;
|
||||
import li.strolch.rest.inspector.model.AgentOverview;
|
||||
import li.strolch.rest.inspector.model.ElementMapOverview;
|
||||
import li.strolch.rest.inspector.model.ElementMapType;
|
||||
import li.strolch.rest.inspector.model.ModelOverview;
|
||||
import li.strolch.rest.inspector.model.ElementMapsOverview;
|
||||
import li.strolch.rest.inspector.model.OrderOverview;
|
||||
import li.strolch.rest.inspector.model.RealmDetail;
|
||||
import li.strolch.rest.inspector.model.RealmOverview;
|
||||
import li.strolch.rest.inspector.model.ResourceOverview;
|
||||
import li.strolch.rest.inspector.model.StrolchElementOverview;
|
||||
import li.strolch.rest.inspector.model.TypeDetail;
|
||||
import li.strolch.rest.inspector.model.TypeOverview;
|
||||
import ch.eitchnet.utils.dbc.DBC;
|
||||
|
||||
/**
|
||||
|
@ -38,30 +54,266 @@ import ch.eitchnet.utils.dbc.DBC;
|
|||
@Path("strolch/inspector")
|
||||
public class Inspector {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Root path of the inspector
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Returns the root element, which is an overview of the configured realms
|
||||
* </p>
|
||||
*
|
||||
* @return the root element, which is an overview of the configured realms
|
||||
*
|
||||
* @see AgentOverview
|
||||
*/
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getRoot(@QueryParam("realm") String realm) {
|
||||
public Response getAgent() {
|
||||
|
||||
ComponentContainer container = AgentRef.getInstance().getContainer();
|
||||
Set<String> realmNames = container.getRealmNames();
|
||||
List<RealmOverview> realmOverviews = new ArrayList<>(realmNames.size());
|
||||
for (String realmName : realmNames) {
|
||||
|
||||
StrolchRealm realm = container.getRealm(realmName);
|
||||
try (StrolchTransaction tx = realm.openTx()) {
|
||||
long size = 0;
|
||||
size += realm.getResourceMap().querySize(tx);
|
||||
size += realm.getOrderMap().querySize(tx);
|
||||
RealmOverview realmOverview = new RealmOverview(realmName, size);
|
||||
realmOverviews.add(realmOverview);
|
||||
}
|
||||
}
|
||||
|
||||
AgentOverview agentOverview = new AgentOverview(realmOverviews);
|
||||
GenericEntity<AgentOverview> entity = new GenericEntity<AgentOverview>(agentOverview, AgentOverview.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Realm inspector
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Returns the overview of a specific relam
|
||||
* </p>
|
||||
*
|
||||
* @param realm
|
||||
* the realm for which the overview is to be returned
|
||||
*
|
||||
* @return the overview of a specific relam
|
||||
*
|
||||
* @see RealmDetail
|
||||
*/
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}")
|
||||
public Response getRealm(@PathParam("realm") String realm) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
ModelOverview modelOverview = new ModelOverview();
|
||||
|
||||
List<ElementMapsOverview> elementMapOverviews = new ArrayList<>(2);
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
|
||||
ResourceMap resourceMap = strolchRealm.getResourceMap();
|
||||
ElementMapOverview resourceOverview = new ElementMapOverview(ElementMapType.RESOURCE);
|
||||
ElementMapsOverview resourceOverview = new ElementMapsOverview(ElementMapType.RESOURCE);
|
||||
resourceOverview.setNrOfElements(resourceMap.querySize(tx));
|
||||
resourceOverview.setTypes(resourceMap.getTypes(tx));
|
||||
modelOverview.getElementMapOverviews().add(resourceOverview);
|
||||
elementMapOverviews.add(resourceOverview);
|
||||
|
||||
OrderMap orderMap = strolchRealm.getOrderMap();
|
||||
ElementMapOverview orderOverview = new ElementMapOverview(ElementMapType.ORDER);
|
||||
ElementMapsOverview orderOverview = new ElementMapsOverview(ElementMapType.ORDER);
|
||||
orderOverview.setNrOfElements(orderMap.querySize(tx));
|
||||
orderOverview.setTypes(orderMap.getTypes(tx));
|
||||
modelOverview.getElementMapOverviews().add(orderOverview);
|
||||
elementMapOverviews.add(orderOverview);
|
||||
}
|
||||
|
||||
GenericEntity<ModelOverview> entity = new GenericEntity<ModelOverview>(modelOverview, ModelOverview.class) {
|
||||
RealmDetail modelOverview = new RealmDetail(elementMapOverviews);
|
||||
GenericEntity<RealmDetail> entity = new GenericEntity<RealmDetail>(modelOverview, RealmDetail.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Resource inspector
|
||||
* </p>
|
||||
* <p>
|
||||
* Returns an overview of the {@link Resource Resources}. This is a list of all the types and the size each type has
|
||||
* </p>
|
||||
*
|
||||
* @param realm
|
||||
* the realm for which the resource overview is to be returned
|
||||
*
|
||||
* @return an overview of the {@link Resource Resources}. This is a list of all the types and the size each type has
|
||||
*
|
||||
* @see ElementMapOverview
|
||||
*/
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}/resource")
|
||||
public Response getResourcesOverview(@PathParam("realm") String realm) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
|
||||
ElementMapOverview resourcesOverview;
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
ResourceMap resourceMap = tx.getResourceMap();
|
||||
Set<String> types = resourceMap.getTypes(tx);
|
||||
List<TypeOverview> typeOverviews = new ArrayList<>(types.size());
|
||||
for (String type : types) {
|
||||
long size = resourceMap.querySize(tx, type);
|
||||
TypeOverview typeOverview = new TypeOverview(type, size);
|
||||
typeOverviews.add(typeOverview);
|
||||
}
|
||||
|
||||
resourcesOverview = new ElementMapOverview(ElementMapType.RESOURCE.getName(), typeOverviews);
|
||||
}
|
||||
|
||||
GenericEntity<ElementMapOverview> entity = new GenericEntity<ElementMapOverview>(resourcesOverview,
|
||||
ElementMapOverview.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Order inspector
|
||||
* </p>
|
||||
* <p>
|
||||
* Returns an overview of the {@link Order Orderss}. This is a list of all the types and the size each type has
|
||||
* </p>
|
||||
*
|
||||
* @param realm
|
||||
* the realm for which the order overview is to be returned
|
||||
*
|
||||
* @return an overview of the {@link Order Orders}. This is a list of all the types and the size each type has
|
||||
*
|
||||
* @see ElementMapOverview
|
||||
*/
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}/order")
|
||||
public Response getOrdersOverview(@PathParam("realm") String realm) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
|
||||
ElementMapOverview ordersOverview;
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
OrderMap orderMap = tx.getOrderMap();
|
||||
Set<String> types = orderMap.getTypes(tx);
|
||||
List<TypeOverview> typeOverviews = new ArrayList<>(types.size());
|
||||
for (String type : types) {
|
||||
long size = orderMap.querySize(tx, type);
|
||||
TypeOverview typeOverview = new TypeOverview(type, size);
|
||||
typeOverviews.add(typeOverview);
|
||||
}
|
||||
|
||||
ordersOverview = new ElementMapOverview(ElementMapType.ORDER.getName(), typeOverviews);
|
||||
}
|
||||
|
||||
GenericEntity<ElementMapOverview> entity = new GenericEntity<ElementMapOverview>(ordersOverview,
|
||||
ElementMapOverview.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
// TODO for the get element type details, we should not simply query all objects, but rather find a solution to query only the id, name, type and date, state for the order
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}/resource/{type}")
|
||||
public Response getResourceTypeDetails(@PathParam("realm") String realm, @PathParam("type") String type) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
|
||||
TypeDetail typeDetail;
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
List<Resource> byType = tx.getResourceMap().getElementsBy(tx, type);
|
||||
List<StrolchElementOverview> elementOverviews = new ArrayList<>(byType.size());
|
||||
for (Resource resource : byType) {
|
||||
ResourceOverview resourceOverview = new ResourceOverview(resource.getId(), resource.getName(),
|
||||
resource.getType());
|
||||
elementOverviews.add(resourceOverview);
|
||||
}
|
||||
typeDetail = new TypeDetail(type, elementOverviews);
|
||||
}
|
||||
|
||||
GenericEntity<TypeDetail> entity = new GenericEntity<TypeDetail>(typeDetail, TypeDetail.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}/order/{type}")
|
||||
public Response getOrderTypeDetails(@PathParam("realm") String realm, @PathParam("type") String type) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
|
||||
TypeDetail typeDetail;
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
List<Order> byType = tx.getOrderMap().getElementsBy(tx, type);
|
||||
List<StrolchElementOverview> elementOverviews = new ArrayList<>(byType.size());
|
||||
for (Order order : byType) {
|
||||
OrderOverview orderOverview = new OrderOverview(order.getId(), order.getName(), order.getType(),
|
||||
order.getDate(), order.getState());
|
||||
elementOverviews.add(orderOverview);
|
||||
}
|
||||
typeDetail = new TypeDetail(type, elementOverviews);
|
||||
}
|
||||
|
||||
GenericEntity<TypeDetail> entity = new GenericEntity<TypeDetail>(typeDetail, TypeDetail.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}/resource/{type}/{id}")
|
||||
public Response getResource(@PathParam("realm") String realm, @PathParam("type") String type,
|
||||
@PathParam("id") String id) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
|
||||
Resource resource;
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
resource = tx.getResourceMap().getBy(tx, type, id);
|
||||
}
|
||||
if (resource == null) {
|
||||
throw new StrolchException("No Resource exists for " + type + "/" + id);
|
||||
}
|
||||
|
||||
ResourceOverview resourceOverview = new ResourceOverview(resource.getId(), resource.getName(),
|
||||
resource.getType());
|
||||
GenericEntity<ResourceOverview> entity = new GenericEntity<ResourceOverview>(resourceOverview,
|
||||
ResourceOverview.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("{realm}/order/{type}/{id}")
|
||||
public Response getOrder(@PathParam("realm") String realm, @PathParam("type") String type,
|
||||
@PathParam("id") String id) {
|
||||
DBC.PRE.assertNotEmpty("Realm must be set!", realm);
|
||||
StrolchRealm strolchRealm = AgentRef.getInstance().getContainer().getRealm(realm);
|
||||
|
||||
Order order;
|
||||
try (StrolchTransaction tx = strolchRealm.openTx()) {
|
||||
order = tx.getOrderMap().getBy(tx, type, id);
|
||||
}
|
||||
if (order == null) {
|
||||
throw new StrolchException("No Order exists for " + type + "/" + id);
|
||||
}
|
||||
|
||||
OrderOverview orderOverview = new OrderOverview(order.getId(), order.getName(), order.getType(),
|
||||
order.getDate(), order.getState());
|
||||
GenericEntity<OrderOverview> entity = new GenericEntity<OrderOverview>(orderOverview, OrderOverview.class) {
|
||||
};
|
||||
return Response.ok().entity(entity).build();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "Agent")
|
||||
public class AgentOverview {
|
||||
|
||||
@XmlElement(name = "realms")
|
||||
private List<RealmOverview> realms;
|
||||
|
||||
public AgentOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
public AgentOverview(List<RealmOverview> realms) {
|
||||
this.realms = realms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the realms
|
||||
*/
|
||||
public List<RealmOverview> getRealms() {
|
||||
return this.realms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param realms
|
||||
* the realms to set
|
||||
*/
|
||||
public void setRealms(List<RealmOverview> realms) {
|
||||
this.realms = realms;
|
||||
}
|
||||
}
|
|
@ -15,102 +15,84 @@
|
|||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement
|
||||
@XmlRootElement(name = "ElementMap")
|
||||
public class ElementMapOverview {
|
||||
|
||||
@XmlAttribute(name = "name")
|
||||
private String name;
|
||||
|
||||
@XmlAttribute(name = "elementMapType")
|
||||
private ElementMapType elementMapType;
|
||||
|
||||
@XmlAttribute(name = "types")
|
||||
private Set<String> types;
|
||||
|
||||
@XmlAttribute(name = "nrOfElements")
|
||||
private long nrOfElements;
|
||||
@XmlAttribute(name = "elementMapName")
|
||||
private String elementMapName;
|
||||
@XmlAttribute(name = "size")
|
||||
private long size;
|
||||
@XmlElement(name = "types", type = TypeOverview.class)
|
||||
private List<TypeOverview> typeOverviews;
|
||||
|
||||
public ElementMapOverview() {
|
||||
// empty constructor for JAXB
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementMapType
|
||||
* @param elementMapName
|
||||
* @param typeOverviews
|
||||
*/
|
||||
public ElementMapOverview(ElementMapType elementMapType) {
|
||||
super();
|
||||
this.elementMapType = elementMapType;
|
||||
this.name = elementMapType.getName();
|
||||
public ElementMapOverview(String elementMapName, List<TypeOverview> typeOverviews) {
|
||||
this.elementMapName = elementMapName;
|
||||
this.typeOverviews = typeOverviews;
|
||||
this.size = this.typeOverviews.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
* @return the elementMapName
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
public String getElementMapName() {
|
||||
return this.elementMapName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
* @param elementMapName
|
||||
* the elementMapName to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
public void setElementMapName(String elementMapName) {
|
||||
this.elementMapName = elementMapName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the elementMapType
|
||||
* @return the size
|
||||
*/
|
||||
public ElementMapType getElementMapType() {
|
||||
return this.elementMapType;
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementMapType
|
||||
* the elementMapType to set
|
||||
* @param size
|
||||
* the size to set
|
||||
*/
|
||||
public void setElementMapType(ElementMapType elementMapType) {
|
||||
this.elementMapType = elementMapType;
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the types
|
||||
* @return the typeOverviews
|
||||
*/
|
||||
public Set<String> getTypes() {
|
||||
return this.types;
|
||||
public List<TypeOverview> getTypeOverviews() {
|
||||
return this.typeOverviews;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param types
|
||||
* the types to set
|
||||
* @param typeOverviews
|
||||
* the typeOverviews to set
|
||||
*/
|
||||
public void setTypes(Set<String> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nrOfElements
|
||||
*/
|
||||
public long getNrOfElements() {
|
||||
return this.nrOfElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nrOfElements
|
||||
* the nrOfElements to set
|
||||
*/
|
||||
public void setNrOfElements(long nrOfElements) {
|
||||
this.nrOfElements = nrOfElements;
|
||||
public void setTypeOverviews(List<TypeOverview> typeOverviews) {
|
||||
this.typeOverviews = typeOverviews;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "ElementMaps")
|
||||
public class ElementMapsOverview {
|
||||
|
||||
@XmlAttribute(name = "name")
|
||||
private String name;
|
||||
|
||||
@XmlAttribute(name = "elementMapType")
|
||||
private ElementMapType elementMapType;
|
||||
|
||||
@XmlAttribute(name = "nrOfElements")
|
||||
private long nrOfElements;
|
||||
|
||||
@XmlElement(name = "types")
|
||||
private Set<String> types;
|
||||
|
||||
public ElementMapsOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementMapType
|
||||
*/
|
||||
public ElementMapsOverview(ElementMapType elementMapType) {
|
||||
super();
|
||||
this.elementMapType = elementMapType;
|
||||
this.name = elementMapType.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the elementMapType
|
||||
*/
|
||||
public ElementMapType getElementMapType() {
|
||||
return this.elementMapType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementMapType
|
||||
* the elementMapType to set
|
||||
*/
|
||||
public void setElementMapType(ElementMapType elementMapType) {
|
||||
this.elementMapType = elementMapType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the types
|
||||
*/
|
||||
public Set<String> getTypes() {
|
||||
return this.types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param types
|
||||
* the types to set
|
||||
*/
|
||||
public void setTypes(Set<String> types) {
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nrOfElements
|
||||
*/
|
||||
public long getNrOfElements() {
|
||||
return this.nrOfElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nrOfElements
|
||||
* the nrOfElements to set
|
||||
*/
|
||||
public void setNrOfElements(long nrOfElements) {
|
||||
this.nrOfElements = nrOfElements;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import li.strolch.model.State;
|
||||
import ch.eitchnet.utils.iso8601.ISO8601FormatFactory;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "Order")
|
||||
public class OrderOverview extends StrolchElementOverview {
|
||||
|
||||
@XmlAttribute(name = "date")
|
||||
private String date;
|
||||
@XmlAttribute(name = "state")
|
||||
private State state;
|
||||
|
||||
public OrderOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param name
|
||||
* @param type
|
||||
*/
|
||||
public OrderOverview(String id, String name, String type, Date date, State state) {
|
||||
super(id, name, type);
|
||||
this.state = state;
|
||||
this.date = ISO8601FormatFactory.getInstance().formatDate(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
public String getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date
|
||||
* the date to set
|
||||
*/
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the state
|
||||
*/
|
||||
public State getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state
|
||||
* the state to set
|
||||
*/
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -27,20 +26,24 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement
|
||||
public class ModelOverview {
|
||||
@XmlRootElement(name = "Realm")
|
||||
public class RealmDetail {
|
||||
|
||||
@XmlElement
|
||||
private List<ElementMapOverview> elementMapOverviews;
|
||||
@XmlElement(name = "ElementMaps")
|
||||
private List<ElementMapsOverview> elementMapOverviews;
|
||||
|
||||
public ModelOverview() {
|
||||
this.elementMapOverviews = new ArrayList<>();
|
||||
public RealmDetail() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
public RealmDetail(List<ElementMapsOverview> elementMapOverviews) {
|
||||
this.elementMapOverviews = elementMapOverviews;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the elementMapOverviews
|
||||
*/
|
||||
public List<ElementMapOverview> getElementMapOverviews() {
|
||||
public List<ElementMapsOverview> getElementMapOverviews() {
|
||||
return this.elementMapOverviews;
|
||||
}
|
||||
|
||||
|
@ -48,7 +51,7 @@ public class ModelOverview {
|
|||
* @param elementMapOverviews
|
||||
* the elementMapOverviews to set
|
||||
*/
|
||||
public void setElementMapOverviews(List<ElementMapOverview> elementMapOverviews) {
|
||||
public void setElementMapOverviews(List<ElementMapsOverview> elementMapOverviews) {
|
||||
this.elementMapOverviews = elementMapOverviews;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "RealmOverview")
|
||||
public class RealmOverview {
|
||||
|
||||
@XmlAttribute(name = "realmName")
|
||||
private String realmName;
|
||||
@XmlAttribute(name = "size")
|
||||
private long size;
|
||||
|
||||
public RealmOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
public RealmOverview(String realmName, long size) {
|
||||
this.realmName = realmName;
|
||||
this.size = size;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the realmName
|
||||
*/
|
||||
public String getRealmName() {
|
||||
return this.realmName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param realmName
|
||||
* the realmName to set
|
||||
*/
|
||||
public void setRealmName(String realmName) {
|
||||
this.realmName = realmName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size
|
||||
*/
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param size
|
||||
* the size to set
|
||||
*/
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlRootElement(name = "Resource")
|
||||
public class ResourceOverview extends StrolchElementOverview {
|
||||
|
||||
public ResourceOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param name
|
||||
* @param type
|
||||
*/
|
||||
public ResourceOverview(String id, String name, String type) {
|
||||
super(id, name, type);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlSeeAlso({ ResourceOverview.class, OrderOverview.class })
|
||||
public abstract class StrolchElementOverview {
|
||||
|
||||
@XmlAttribute(name = "id", required = true)
|
||||
private String id;
|
||||
@XmlAttribute(name = "name", required = true)
|
||||
private String name;
|
||||
@XmlAttribute(name = "type", required = true)
|
||||
private String type;
|
||||
|
||||
public StrolchElementOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param name
|
||||
* @param type
|
||||
*/
|
||||
public StrolchElementOverview(String id, String name, String type) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElements;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "Types")
|
||||
public class TypeDetail {
|
||||
|
||||
@XmlAttribute(name = "type")
|
||||
private String type;
|
||||
|
||||
@XmlElements(value = { @XmlElement(name = "Orders", type = OrderOverview.class),
|
||||
@XmlElement(name = "Resources", type = ResourceOverview.class) })
|
||||
private List<StrolchElementOverview> elementOverviews;
|
||||
|
||||
public TypeDetail() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* @param elementOverviews
|
||||
*/
|
||||
public TypeDetail(String type, List<StrolchElementOverview> elementOverviews) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.elementOverviews = elementOverviews;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the elementOverviews
|
||||
*/
|
||||
public List<StrolchElementOverview> getElementOverviews() {
|
||||
return this.elementOverviews;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param elementOverviews
|
||||
* the elementOverviews to set
|
||||
*/
|
||||
public void setElementOverviews(List<StrolchElementOverview> elementOverviews) {
|
||||
this.elementOverviews = elementOverviews;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package li.strolch.rest.inspector.model;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement(name = "Types")
|
||||
public class TypeOverview {
|
||||
|
||||
@XmlAttribute(name = "type")
|
||||
private String type;
|
||||
|
||||
@XmlAttribute(name = "size")
|
||||
private long size;
|
||||
|
||||
public TypeOverview() {
|
||||
// no-arg constructor for JAXB
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* @param size
|
||||
*/
|
||||
public TypeOverview(String type, long size) {
|
||||
this.type = type;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size
|
||||
*/
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param size
|
||||
* the size to set
|
||||
*/
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue