use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class OrderParameterTest method testPersistObject.
@Test
public void testPersistObject() throws Exception {
_logger.info("Starting persist OrderParameter test");
OrderParameter model = new OrderParameter();
model.setLabel("foo");
model.setFriendlyLabel("my friendly name");
model.setFriendlyValue("my friendly value");
model.setUserInput(false);
model.setValue("my value");
save(model);
model = findById(model.getId());
Assert.assertNotNull(model);
Assert.assertEquals("foo", model.getLabel());
Assert.assertEquals("my friendly name", model.getFriendlyLabel());
Assert.assertEquals("my friendly value", model.getFriendlyValue());
Assert.assertEquals(false, model.getUserInput());
Assert.assertEquals("my value", model.getValue());
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class SortedIndexTest method createOrderParameter.
private static OrderParameter createOrderParameter(String label, String value, Integer sortedIndex) {
OrderParameter model = new OrderParameter();
model.setId(URIUtil.createId(OrderParameter.class));
model.setLabel(label);
model.setFriendlyLabel("my friendly name");
model.setFriendlyValue("my friendly value");
model.setUserInput(false);
model.setValue(value);
model.setSortedIndex(sortedIndex);
return model;
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class OrderService method getOrder.
@GET
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public OrderRestRep getOrder(@PathParam("id") String id) {
Order order = queryResource(uri(id));
StorageOSUser user = getUserFromContext();
verifyAuthorizedInTenantOrg(uri(order.getTenant()), user);
List<OrderParameter> orderParameters = orderManager.getOrderParameters(order.getId());
return map(order, orderParameters);
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class OrderService method dumpOrder.
private void dumpOrder(PrintStream out, Order order) {
out.print(order.toString());
out.println("Parameters");
out.println("----------");
List<OrderParameter> parameters = orderManager.getOrderParameters(order.getId());
for (OrderParameter parameter : parameters) {
out.print(parameter.toString());
}
out.println("Execution State");
out.println("---------------");
ExecutionState state = orderManager.getOrderExecutionState(order.getExecutionStateId());
if (state != null) {
out.print(state.toString());
}
out.println("Logs");
out.println("----");
out.println(" Execution Logs");
if (state != null) {
List<ExecutionLog> elogs = orderManager.getOrderExecutionLogs(order);
for (ExecutionLog elog : elogs) {
out.print(elog.toString());
}
}
out.println(" Execution Task Logs");
if (state != null) {
List<ExecutionTaskLog> tlogs = orderManager.getOrderExecutionTaskLogs(order);
for (ExecutionTaskLog tlog : tlogs) {
out.print(tlog.toString());
}
}
}
use of com.emc.storageos.db.client.model.uimodels.OrderParameter in project coprhd-controller by CoprHD.
the class ExecutionUtils method createContext.
public static void createContext(ModelClient modelClient, Order order) {
// Ensure there is no existing context
destroyContext();
// Initialize the execution state for this order
ExecutionState state = modelClient.executionStates().findById(order.getExecutionStateId());
state.setStartDate(new Date());
ExecutionContext context = currentContext();
context.setOrder(order);
context.setModelClient(modelClient);
context.setExecutionState(state);
URI scheduledEventId = order.getScheduledEventId();
if (scheduledEventId != null) {
ScheduledEvent event = modelClient.findById(ScheduledEvent.class, scheduledEventId);
context.setScheduledEvent(event);
}
CatalogService catalogService = modelClient.catalogServices().findById(order.getCatalogServiceId());
if (null != catalogService) {
context.setServiceName(catalogService.getLabel());
}
List<OrderParameter> orderParameters = modelClient.orderParameters().findByOrderId(order.getId());
Map<String, Object> params = Maps.newLinkedHashMap();
for (OrderParameter param : orderParameters) {
params.put(param.getLabel(), param.getValue());
}
context.setParameters(params);
}
Aggregations