Search in sources :

Example 1 with OcppTagForm

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";
}
Also used : OcppTagRecord(jooq.steve.db.tables.records.OcppTagRecord) OcppTagForm(de.rwth.idsg.steve.web.dto.OcppTagForm) DateTime(org.joda.time.DateTime) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with OcppTagForm

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";
}
Also used : OcppTagForm(de.rwth.idsg.steve.web.dto.OcppTagForm) OcppTagBatchInsertForm(de.rwth.idsg.steve.web.dto.OcppTagBatchInsertForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with OcppTagForm

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();
}
Also used : OcppTagForm(de.rwth.idsg.steve.web.dto.OcppTagForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

OcppTagForm (de.rwth.idsg.steve.web.dto.OcppTagForm)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 OcppTagBatchInsertForm (de.rwth.idsg.steve.web.dto.OcppTagBatchInsertForm)1 OcppTagRecord (jooq.steve.db.tables.records.OcppTagRecord)1 DateTime (org.joda.time.DateTime)1