Java 类org.springframework.web.bind.annotation.ModelAttribute 实例源码

项目:dss-demonstrations    文件:SignatureController.java   
@RequestMapping(value = "/download", method = RequestMethod.GET)
public String downloadSignedFile(@ModelAttribute("signedDocument") InMemoryDocument signedDocument, HttpServletResponse response) {
    try {
        MimeType mimeType = signedDocument.getMimeType();
        if (mimeType != null) {
            response.setContentType(mimeType.getMimeTypeString());
        }
        response.setHeader("Content-Transfer-Encoding", "binary");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + signedDocument.getName() + "\"");
        Utils.copy(new ByteArrayInputStream(signedDocument.getBytes()), response.getOutputStream());

    } catch (Exception e) {
        logger.error("An error occured while pushing file in response : " + e.getMessage(), e);
    }
    return null;
}
项目:lemon    文件:MsgInfoController.java   
@RequestMapping("msg-info-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    page = msgInfoManager.pagedQuery(page, propertyFilters);

    List<MsgInfo> msgInfos = (List<MsgInfo>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("msg info");
    tableModel.addHeaders("id", "name");
    tableModel.setData(msgInfos);
    exportor.export(request, response, tableModel);
}
项目:lemon    文件:StampInfoController.java   
@RequestMapping("stamp-info-save")
public String save(@ModelAttribute StampInfo stampInfo,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    StampInfo dest = null;

    Long id = stampInfo.getId();

    if (id != null) {
        dest = stampInfoManager.get(id);
        beanMapper.copy(stampInfo, dest);
    } else {
        dest = stampInfo;
        dest.setTenantId(tenantId);
    }

    stampInfoManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/stamp/stamp-info-list.do";
}
项目:lemon    文件:MsgInfoController.java   
@RequestMapping("msg-info-listSent")
public String listSent(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap, Model model) {
    String userId = currentUserHolder.getUserId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);

    propertyFilters.add(new PropertyFilter("EQS_senderId", userId));
    page.setOrder("DESC");
    page.setOrderBy("createTime");
    page = msgInfoManager.pagedQuery(page, propertyFilters);

    model.addAttribute("page", page);

    return "msg/msg-info-listSent";
}
项目:spring_mvc_demo    文件:InputController.java   
@RequestMapping(value = "/addStudent",method = RequestMethod.POST)
    public String addStudent(@ModelAttribute("student") @Validated Student student, BindingResult bindingResult,ModelMap model){
//        if(bindingResult.hasErrors()){
//            return "addStudent";
//        }
        System.out.println("id = "+student.getId());
        model.addAttribute("id",student.getId());
        model.addAttribute("name",student.getName());
        model.addAttribute("age",student.getAge());
        model.addAttribute("receivePaper",student.isReceivePaper());
        model.addAttribute("gender",student.getGender());
        model.addAttribute("color",student.getColor());
        model.addAttribute("city",student.getCity());
        model.addAttribute("tec",student.getTec());
        return "result";
    }
项目:lemon    文件:TrainInfoController.java   
@RequestMapping("train-info-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = trainInfoManager.pagedQuery(page, propertyFilters);

    List<TrainInfo> trainInfos = (List<TrainInfo>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("train info");
    tableModel.addHeaders("id", "name");
    tableModel.setData(trainInfos);
    exportor.export(request, response, tableModel);
}
项目:lemon    文件:GroupInfoController.java   
@RequestMapping("group-info-save")
public String save(@ModelAttribute GroupInfo groupInfo,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    GroupInfo dest = null;
    Long id = groupInfo.getId();

    if (id != null) {
        dest = groupInfoManager.get(id);
        beanMapper.copy(groupInfo, dest);
    } else {
        dest = groupInfo;
        dest.setTenantId(tenantId);
    }

    groupInfoManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/group/group-info-list.do";
}
项目:SpringTutorial    文件:AccountsController.java   
@RequestMapping(value = "/logon.sf", method = RequestMethod.POST)
public String logonMethod(
        @ModelAttribute("logon") Logon logon,
        BindingResult result, SessionStatus status) {

    logonValidator.validate(logon, result);

    if (result.hasErrors()) {
        //if validator failed
        return "login";
    } else {
        status.setComplete();
        //form success
        return "securepage";
    }
}
项目:lemon    文件:FormTemplateController.java   
@RequestMapping("form-template-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = formTemplateManager.pagedQuery(page, propertyFilters);

    List<FormTemplate> dynamicModels = (List<FormTemplate>) page
            .getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("dynamic model");
    tableModel.addHeaders("id", "name");
    tableModel.setData(dynamicModels);
    exportor.export(request, response, tableModel);
}
项目:lemon    文件:ContractInfoController.java   
@RequestMapping("contract-info-save")
public String save(@ModelAttribute ContractInfo contractInfo,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    ContractInfo dest = null;

    Long id = contractInfo.getId();

    if (id != null) {
        dest = contractInfoManager.get(id);
        beanMapper.copy(contractInfo, dest);
    } else {
        dest = contractInfo;
        dest.setTenantId(tenantId);
    }

    contractInfoManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/contract/contract-info-list.do";
}
项目:lemon    文件:BpmConfOperationController.java   
@RequestMapping("bpm-conf-operation-save")
public String save(@ModelAttribute BpmConfOperation bpmConfOperation,
        @RequestParam("bpmConfNodeId") Long bpmConfNodeId) {
    if ((bpmConfOperation.getValue() == null)
            || "".equals(bpmConfOperation.getValue())) {
        return "redirect:/bpm/bpm-conf-operation-list.do?bpmConfNodeId="
                + bpmConfNodeId;
    }

    bpmConfOperation.setBpmConfNode(bpmConfNodeManager.get(bpmConfNodeId));
    bpmConfOperationManager.save(bpmConfOperation);

    BpmConfOperation dest = bpmConfOperation;
    String taskDefinitionKey = dest.getBpmConfNode().getCode();
    String processDefinitionId = dest.getBpmConfNode().getBpmConfBase()
            .getProcessDefinitionId();
    String operation = dest.getValue();
    taskDefinitionConnector.addOperation(taskDefinitionKey,
            processDefinitionId, operation);

    return "redirect:/bpm/bpm-conf-operation-list.do?bpmConfNodeId="
            + bpmConfNodeId;
}
项目:lemon    文件:BudgetInfoController.java   
@RequestMapping("budget-info-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = budgetInfoManager.pagedQuery(page, propertyFilters);

    List<BudgetInfo> budgetInfos = (List<BudgetInfo>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("budget info");
    tableModel.addHeaders("id", "name");
    tableModel.setData(budgetInfos);
    exportor.export(request, response, tableModel);
}
项目:message-crypto    文件:MessageController.java   
/**
 * Maps and handles custom behavior in the Edit page (POST mode)
 * @param message The information that is bound to the HTML form and used to update the database
 * @return Custom message sent to the client - in this case, a redirect
 */
@RequestMapping(value="/edit", method=RequestMethod.POST)
public String submit(@ModelAttribute Message message)
{
    try
    {
        String username = Util.getUsername();
        message.setUsername(username);

        message = encryptMessage(message);
        messageRepository.save(message);

        // TO-DO: redirect and show a success message
        return "redirect:/cpanel.html";
    }
    catch(DataIntegrityViolationException ex) // message is too long for DB field
    {
        return "redirect:/edit?error";
    }
}
项目:lemon    文件:TemplateFieldController.java   
@RequestMapping("template-field-save")
public String save(@ModelAttribute TemplateField templateField,
        @RequestParam("infoId") Long infoId,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    Long id = templateField.getId();
    TemplateField dest = null;

    if (id != null) {
        dest = templateFieldManager.get(id);
        beanMapper.copy(templateField, dest);
    } else {
        dest = templateField;
        dest.setTenantId(tenantId);
    }

    dest.setTemplateInfo(templateInfoManager.get(infoId));

    templateFieldManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/template/template-field-list.do";
}
项目:lemon    文件:PimInfoController.java   
@RequestMapping("pim-info-save")
public String save(@ModelAttribute PimInfo pimInfo,
        RedirectAttributes redirectAttributes) {
    String userId = currentUserHolder.getUserId();
    String tenantId = tenantHolder.getTenantId();
    Long id = pimInfo.getId();
    PimInfo dest = null;

    if (id != null) {
        dest = pimInfoManager.get(id);
        beanMapper.copy(pimInfo, dest);
    } else {
        dest = pimInfo;
        dest.setUserId(userId);
        dest.setTenantId(tenantId);
    }

    pimInfoManager.save(dest);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/pim/pim-info-list.do";
}
项目:Spring-Security-Third-Edition    文件:EventsController.java   
/**
 * Populates the form for creating an event with valid information. Useful so that users do not have to think when
 * filling out the form for testing.
 *
 * @param createEventForm
 * @return
 */
@RequestMapping(value = "/new", params = "auto")
public String createEventFormAutoPopulate(@ModelAttribute CreateEventForm createEventForm) {
    // provide default values to make user submission easier
    createEventForm.setSummary("A new event....");
    createEventForm.setDescription("This was autopopulated to save time creating a valid event.");
    createEventForm.setWhen(Calendar.getInstance());

    // make the attendee not the current user
    CalendarUser currentUser = userContext.getCurrentUser();
    int attendeeId = currentUser.getId() == 0 ? 1 : 0;
    CalendarUser attendee = calendarService.getUser(attendeeId);
    createEventForm.setAttendeeEmail(attendee.getEmail());

    return "events/create";
}
项目:lemon    文件:SendsmsConfigController.java   
@RequestMapping("sendsms-config-save")
public String save(@ModelAttribute SendsmsConfig sendsmsConfig,
        RedirectAttributes redirectAttributes) {
    Long id = sendsmsConfig.getId();
    SendsmsConfig dest = null;

    if (id != null) {
        dest = sendsmsConfigManager.get(id);
        beanMapper.copy(sendsmsConfig, dest);
    } else {
        dest = sendsmsConfig;
    }

    sendsmsConfigManager.save(dest);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/sendsms/sendsms-config-list.do";
}
项目:lemon    文件:WorkcalRuleController.java   
@RequestMapping("workcal-rule-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = workcalRuleManager.pagedQuery(page, propertyFilters);

    List<WorkcalRule> workcalRules = (List<WorkcalRule>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("workcalRule");
    tableModel.addHeaders("id", "name");
    tableModel.setData(workcalRules);
    exportor.export(request, response, tableModel);
}
项目:lemon    文件:DictTypeController.java   
@RequestMapping("dict-type-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = dictTypeManager.pagedQuery(page, propertyFilters);

    List<DictType> dictTypes = (List<DictType>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("dict info");
    tableModel.addHeaders("id", "name", "stringValue", "description");
    tableModel.setData(dictTypes);
    exportor.export(request, response, tableModel);
}
项目:lemon    文件:BusinessInfoController.java   
@RequestMapping("business-info-save")
public String save(@ModelAttribute BusinessInfo businessInfo,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    BusinessInfo dest = null;

    Long id = businessInfo.getId();

    if (id != null) {
        dest = businessInfoManager.get(id);
        beanMapper.copy(businessInfo, dest);
    } else {
        dest = businessInfo;
        dest.setTenantId(tenantId);
    }

    businessInfoManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/business/business-info-list.do";
}
项目:lemon    文件:JobController.java   
@RequestMapping("job-save")
public String save(@ModelAttribute JobUser jobUser,
        @RequestParam("jobId") long jobId,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    JobUser dest = null;
    Long id = jobUser.getId();

    if (id != null) {
        dest = jobUserManager.get(id);
        beanMapper.copy(jobUser, dest);
    } else {
        dest = jobUser;
        dest.setTenantId(tenantId);
    }

    dest.setJobInfo(jobInfoManager.get(jobId));

    jobUserManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/org/job-list.do";
}
项目:lemon    文件:AccountOnlineController.java   
@RequestMapping("account-online-save")
public String save(@ModelAttribute AccountOnline accountOnline,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    AccountOnline dest = null;

    Long id = accountOnline.getId();

    if (id != null) {
        dest = accountOnlineManager.get(id);
        beanMapper.copy(accountOnline, dest);
    } else {
        dest = accountOnline;
        dest.setTenantId(tenantId);
    }

    accountOnlineManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/user/account-online-list.do";
}
项目:Spring-Security-Third-Edition    文件:EventsController.java   
/**
 * Populates the form for creating an event with valid information. Useful so that users do not have to think when
 * filling out the form for testing.
 *
 * @param createEventForm
 * @return
 */
@RequestMapping(value = "/new", params = "auto")
public String createEventFormAutoPopulate(@ModelAttribute CreateEventForm createEventForm) {
    // provide default values to make user submission easier
    createEventForm.setSummary("A new event....");
    createEventForm.setDescription("This was autopopulated to save time creating a valid event.");
    createEventForm.setWhen(Calendar.getInstance());

    // make the attendee not the current user
    CalendarUser currentUser = userContext.getCurrentUser();
    int attendeeId = currentUser.getId() == 0 ? 1 : 0;
    CalendarUser attendee = calendarService.getUser(attendeeId);
    createEventForm.setAttendeeEmail(attendee.getEmail());

    return "events/create";
}
项目:AntiSocial-Platform    文件:AdminController.java   
@RequestMapping(value = "/category/create", method = RequestMethod.POST)
public String createCategory(@Valid @ModelAttribute CategoryDTO categoryDTO, BindingResult br, RedirectAttributes attr){
    if(br.hasErrors()){
        StringBuilder errorMsg = new StringBuilder();
        for(ObjectError i : br.getAllErrors()){
            errorMsg.append(i.getDefaultMessage());
        }
        attr.addFlashAttribute("error", errorMsg.toString());
        return "redirect:/oups";
    }

    Category category = new Category();
    category.setCategoryName(categoryDTO.getCategoryNew());
    try{
        categoryService.saveCategory(category);
        categoryService.uploadCategoryStarterFiles(categoryDTO.getCategoryNew());
    }catch (Exception e){
        attr.addFlashAttribute("error", "Could not create category. Please contact our support team.");
        return "redirect:/oups";
    }

    attr.addFlashAttribute("categoryDTO", categoryDTO);
    return "redirect:/admin";

}
项目:lemon    文件:BpmCategoryController.java   
@RequestMapping("bpm-category-save")
public String save(@ModelAttribute BpmCategory bpmCategory,
        RedirectAttributes redirectAttributes) {
    BpmCategory dest = null;
    Long id = bpmCategory.getId();

    if (id != null) {
        dest = bpmCategoryManager.get(id);
        beanMapper.copy(bpmCategory, dest);
    } else {
        dest = bpmCategory;

        String tenantId = tenantHolder.getTenantId();
        dest.setTenantId(tenantId);
    }

    bpmCategoryManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/bpm/bpm-category-list.do";
}
项目:lemon    文件:SeatInfoController.java   
@RequestMapping("seat-info-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = seatInfoManager.pagedQuery(page, propertyFilters);

    List<SeatInfo> seatInfos = (List<SeatInfo>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("seat info");
    tableModel.addHeaders("id", "name");
    tableModel.setData(seatInfos);
    exportor.export(request, response, tableModel);
}
项目:Towan    文件:RegisterController.java   
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String doRegister(@Valid @ModelAttribute UserModel newUserModel, BindingResult bindingResult, Model model) {

    if (newUserModel.getPassword().length() < 14)
        return "register2";
    else {

        // Password encryption
        newUserModel.setPassword(passwordEncoder.encode(newUserModel.getPassword()));
        userRepository.save(newUserModel);

        // Create user-role for the user
        UserRoleModel role = new UserRoleModel();
        role.setRole("ROLE_USER");
        role.setUser(newUserModel);
        userRoleRepository.save(role);

        //Send verification mail
        SimpleMailMessage msg = new SimpleMailMessage(this.customMailMessage);
        msg.setTo(newUserModel.getEmail_address());
        msg.setText(String.format(msg.getText(), newUserModel.getUsername(), "http://localhost:8080/Towan/verification?id="+newUserModel.getUserId()));
        this.mailSender.send(msg);

        return "verifyInfo";
    }
}
项目:pathological-reports    文件:OwnerController.java   
@RequestMapping("list-owners")
public ModelAndView findUsers(@ModelAttribute("owner") FindOwnerDTO owner,
                              @RequestParam(name = "initialPage", value = "", required = false) String initialPage) {

    ModelAndView mv = new ModelAndView("users/list-owners");
    mv.addObject("navActive", NavIds.getInstance().getOwners());

    int page = 0;
    int size = 5;

    if (StringUtils.isNumeric(initialPage)) {
        page = Integer.valueOf(initialPage);
    }

    mv.addObject("owners", ownerService.findBy(owner, page, size));

    return mv;
}
项目:lemon    文件:WhitelistTypeController.java   
@RequestMapping("whitelist-type-save")
public String save(@ModelAttribute WhitelistType whitelistType,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    Long id = whitelistType.getId();
    WhitelistType dest = null;

    if (id != null) {
        dest = whitelistTypeManager.get(id);
        beanMapper.copy(whitelistType, dest);
    } else {
        dest = whitelistType;
        dest.setTenantId(tenantId);
    }

    whitelistTypeManager.save(dest);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/whitelist/whitelist-type-list.do";
}
项目:media_information_service    文件:MainController.java   
@PostMapping("/result_game")
public String mediaGameSubmit(@ModelAttribute Media media, Model model, HttpServletRequest request ) {
    LinkedList<GameInfo> a = null;
    String maxResult= media.getMaxResult();
    if(media.getTitle().equals("")) return "media_game";
    if (maxResult.equals("")) maxResult="10";
    try {
        a = APIOperations.gameGetInfo(media.getTitle(),maxResult,media.getOrderBy());
    } catch (UnirestException e) {
        e.printStackTrace();
        return String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR);
    }

    RabbitSend.sendMediaRequest(media.getTitle(),"Game",request);
    if (a.size()==0) return "no_result";
    model.addAttribute("mediaList", a);
    return "result_game";
}
项目:lemon    文件:PartyStructController.java   
@RequestMapping("party-struct-list")
public String list(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap, Model model) {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = partyStructManager.pagedQuery(page, propertyFilters);

    List<PartyStructType> partyStructTypes = partyStructTypeManager.findBy(
            "tenantId", tenantId);
    model.addAttribute("page", page);
    model.addAttribute("partyStructTypes", partyStructTypes);

    return "party/party-struct-list";
}
项目:lemon    文件:LeaveInfoController.java   
@RequestMapping("leave-info-save")
public String save(@ModelAttribute LeaveInfo leaveInfo,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    LeaveInfo dest = null;

    Long id = leaveInfo.getId();

    if (id != null) {
        dest = leaveInfoManager.get(id);
        beanMapper.copy(leaveInfo, dest);
    } else {
        dest = leaveInfo;
        dest.setTenantId(tenantId);
    }

    leaveInfoManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/leave/leave-info-list.do";
}
项目:lemon    文件:BpmMailTemplateController.java   
@RequestMapping("bpm-mail-template-save")
public String save(@ModelAttribute BpmMailTemplate bpmMailTemplate,
        RedirectAttributes redirectAttributes) {
    BpmMailTemplate dest = null;
    Long id = bpmMailTemplate.getId();

    if (id != null) {
        dest = bpmMailTemplateManager.get(id);
        beanMapper.copy(bpmMailTemplate, dest);
    } else {
        dest = bpmMailTemplate;
    }

    bpmMailTemplateManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/bpm/bpm-mail-template-list.do";
}
项目:lemon    文件:ReportInfoController.java   
@RequestMapping("report-info-save")
public String save(@ModelAttribute ReportInfo reportInfo,
        @RequestParam("queryId") Long queryId,
        RedirectAttributes redirectAttributes) {
    String userId = currentUserHolder.getUserId();
    String tenantId = tenantHolder.getTenantId();
    Long id = reportInfo.getId();
    ReportInfo dest = null;

    if (id != null) {
        dest = reportInfoManager.get(id);
        beanMapper.copy(reportInfo, dest);
    } else {
        dest = reportInfo;
    }

    dest.setReportQuery(reportQueryManager.get(queryId));
    reportInfoManager.save(dest);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/report/report-info-list.do";
}
项目:lemon    文件:BpmMailTemplateController.java   
@RequestMapping("bpm-mail-template-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    page = bpmMailTemplateManager.pagedQuery(page, propertyFilters);

    List<BpmMailTemplate> bpmCategories = (List<BpmMailTemplate>) page
            .getResult();
    TableModel tableModel = new TableModel();
    tableModel.setName("bpm-process");
    tableModel.addHeaders("id", "name");
    tableModel.setData(bpmCategories);
    exportor.export(request, response, tableModel);
}
项目:lemon    文件:ProductInfoController.java   
@RequestMapping("product-info-save")
public String save(@ModelAttribute ProductInfo productInfo,
        @RequestParam Map<String, Object> parameterMap,
        RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    ProductInfo dest = null;

    Long id = productInfo.getId();

    if (id != null) {
        dest = productInfoManager.get(id);
        beanMapper.copy(productInfo, dest);
    } else {
        dest = productInfo;
        dest.setTenantId(tenantId);
    }

    productInfoManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
            "保存成功");

    return "redirect:/product/product-info-list.do";
}
项目:karate    文件:SignInController.java   
@PostMapping
public String signInPost(@ModelAttribute SignIn signin) {
    if ("john".equals(signin.getUsername()) && "secret".equals(signin.getPassword())) {
        return "success";
    } else {
        return "failure";
    }
}
项目:pokemon    文件:UserController.java   
@RequestMapping(value="/updateFullProfile", method = RequestMethod.POST)
  public AsyncResponseEntity<User> updateFullProfile(@ModelAttribute User user, @ModelAttribute UserImageDto imageDto) {
    return makeAsyncResponse(userService.edit(user, imageDto).map(i->{
    publishMessage(i.getId(), i);
    return i;
}), HttpStatus.ACCEPTED);
  }
项目:profile-manager    文件:LayoutController.java   
@RequestMapping(value = "/create", method = { RequestMethod.POST })
public String crea(@ModelAttribute User user) {
   Role userRole = new Role();
   userRole.setId(Role.USER_ROLE_ID);
   user.getRoles().add(userRole);
   user.setPassword(DigestUtils.md5Hex(user.getPassword()));
   userService.create(user);

   // authenticate the user and redirect on the welcome page
   new AuthenticationHolder().updateUser(userService.findByPK(user.getId()));

   return "redirect:/dashboard";
}
项目:Blockchain-Academic-Verification-Service    文件:UnilogResource.java   
@PostMapping(value = "/complete/registration", headers = "Accept=application/json", params = "action=Activate")
@ResponseStatus(value = HttpStatus.ACCEPTED)
public String completeInstitutionRegistration(@ModelAttribute final RegistrationRequest request, final Map<String, Object> model) {
    LOGGER.info("Applying to register by potential institution");
    String validationResult = userService.validatePassword(request.getNewPassword(), request.getRepeatedNewPassword());
    if (!validationResult.equals("success")) {
        model.put("passwordError", true);
        model.put("passwordErrorMessage", validationResult);
    } else if (!userService.completeInstitutionRegistration(request)) {
        model.put("invalidEmail", true);
    } else {
        model.put("activated", true);
    }
    return "registration";
}