use of de.rwth.idsg.steve.web.dto.OcppTagForm in project steve by RWTH-i5-IDSG.
the class OcppTagsController method getDetails.
@RequestMapping(value = DETAILS_PATH, method = RequestMethod.GET)
public String getDetails(@PathVariable("ocppTagPk") int ocppTagPk, Model model) {
OcppTagRecord record = ocppTagRepository.getRecord(ocppTagPk);
OcppTagForm form = new OcppTagForm();
form.setOcppTagPk(record.getOcppTagPk());
form.setIdTag(record.getIdTag());
DateTime expiryDate = record.getExpiryDate();
if (expiryDate != null) {
form.setExpiration(expiryDate.toLocalDateTime());
}
form.setBlocked(record.getBlocked());
form.setNote(record.getNote());
String parentIdTag = record.getParentIdTag();
if (parentIdTag == null) {
parentIdTag = ControllerHelper.EMPTY_OPTION;
}
form.setParentIdTag(parentIdTag);
model.addAttribute("inTransaction", record.getInTransaction());
model.addAttribute("ocppTagForm", form);
setTags(model);
return "data-man/ocppTagDetails";
}
use of de.rwth.idsg.steve.web.dto.OcppTagForm in project steve by RWTH-i5-IDSG.
the class OcppTagsController method addGet.
@RequestMapping(value = ADD_PATH, method = RequestMethod.GET)
public String addGet(Model model) {
setTags(model);
model.addAttribute("ocppTagForm", new OcppTagForm());
model.addAttribute("batchInsertForm", new OcppTagBatchInsertForm());
return "data-man/ocppTagAdd";
}
use of de.rwth.idsg.steve.web.dto.OcppTagForm in project steve by RWTH-i5-IDSG.
the class OcppTagsController method addBatchPost.
@RequestMapping(value = ADD_BATCH_PATH, method = RequestMethod.POST)
public String addBatchPost(@Valid @ModelAttribute("batchInsertForm") OcppTagBatchInsertForm form, BindingResult result, Model model) {
if (result.hasErrors()) {
setTags(model);
model.addAttribute("ocppTagForm", new OcppTagForm());
return "data-man/ocppTagAdd";
}
ocppTagRepository.addOcppTagList(form.getIdList());
return toOverview();
}
Aggregations