Java Code Examples for org.springframework.web.bind.annotation.RequestMethod

The following are top voted examples for showing how to use org.springframework.web.bind.annotation.RequestMethod. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: newblog   File: BlogController.java   View source code 12 votes vote down vote up
@RequestMapping(method = RequestMethod.GET, path = "/getblogdetail")
public ModelAndView getBlogDetail(Integer blogid) {       //博客具体内容
    ModelAndView modelAndView = new ModelAndView();
    Blog blog = blogService.getBlogDetail(blogid);
    Blog preblog = blogService.preBlog(blogid);
    if (preblog != null) {
        modelAndView.addObject("preblog", preblog);
    }
    Blog nextblog = blogService.nextBlog(blogid);
    if (nextblog != null) {
        modelAndView.addObject("nextblog", nextblog);
    }
    modelAndView.addObject("blog", blog);
    modelAndView.setViewName("blogdetail");
    return modelAndView;
}
 
Example 2
Project: oneops   File: CmRestController.java   View source code 8 votes vote down vote up
@RequestMapping(value="/cm/simple/cis/states", method = RequestMethod.PUT)
@ResponseBody
public String updateCiStateBulk(
		@RequestParam(value="ids", required = true) String ids,
		@RequestParam(value="newState", required = true) String newState,
		@RequestParam(value="relationName", required = false) String relName,
		@RequestParam(value="direction", required = false) String direction,
		@RequestParam(value="recursive", required = false) Boolean recursive,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) {
	
	String[] idsStr = ids.split(",");
    Long[] ciIds = new Long[idsStr.length];
    for (int i=0; i<idsStr.length; i++) {
            ciIds[i] = Long.valueOf(idsStr[i]);
    }
	cmManager.updateCiStateBulk(ciIds, newState, relName, direction, recursive != null, userId);
	return "{\"updated\"}";	
}
 
Example 3
Project: spring-grow   File: AdministrationUserController.java   View source code 7 votes vote down vote up
@RequestMapping(value = "/update", method = { RequestMethod.POST })
public String update(@ModelAttribute User user) {
   User persistentUser = userService.findByPK(user.getId());
   boolean expireUserSession = !user.isActive() || !CollectionUtils.isEqualCollection(user.getRoles(), persistentUser.getRoles());
   persistentUser.setFirstname(user.getFirstname());
   persistentUser.setLastname(user.getLastname());
   persistentUser.setEmail(user.getEmail());
   persistentUser.setRoles(user.getRoles());
   persistentUser.setActive(user.isActive());
   persistentUser.setPasswordExpired(user.isPasswordExpired());
   userService.update(persistentUser);
   
   if (expireUserSession){
      // expire user session
      sessionService.expireUserSession(persistentUser);
   }else{
      // update user information without expiring her session
      sessionService.updateUserSession(persistentUser);
   }
   
   return "redirect:/administration/user/list?success=true";
}
 
Example 4
Project: mumu   File: SystemExportModelController.java   View source code 7 votes vote down vote up
/**
 * 选择表下的字段列表
 * @param tableName 表名
 * @return
 */
@ResponseBody
@RequestMapping(value={"/select"},method=RequestMethod.GET)
public List<SysDBField> exportSelect(String tableName){
	List<SysDBField> fields=null;
	if(tableName==null||"".equals(tableName)){
		//获取所有的表
		List<SysDBTable> tables = commonService.getAllTable();
		if(tables!=null&&tables.size()>0){
			fields = commonService.getAllField(tables.get(0).getTableName());
		}
	}else{
		fields = commonService.getAllField(tableName);
	}
	return fields;
}
 
Example 5
Project: devops-cstack   File: MonitoringController.java   View source code 7 votes vote down vote up
/**
 * Is a wrapper to cAdvisor API
 *
 * @return
 * @throws ServiceException
 * @throws CheckException
 */
@RequestMapping(value = "/api/machine", method = RequestMethod.GET)
public void infoMachine(HttpServletRequest request, HttpServletResponse response)
		throws ServiceException, CheckException {
	String responseFromCAdvisor = monitoringService.getJsonMachineFromCAdvisor();
	try {
		response.getWriter().write(responseFromCAdvisor);
		response.flushBuffer();
	} catch (Exception e) {
		logger.error("error during write and flush response", responseFromCAdvisor);
	}

}
 
Example 6
Project: spring-tutorial   File: EmployeeController.java   View source code 7 votes vote down vote up
@RequestMapping(value = "/employee", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<MyResponse> addEmployee(@RequestBody Employee employee) {
	MyResponse resp = new MyResponse();
	empService.create(employee);
	if(HttpStatus.OK.is2xxSuccessful()){
		resp.setStatus(HttpStatus.OK.value());
		resp.setMessage("Succesfuly created an employee object");
		return new ResponseEntity<MyResponse>(resp, HttpStatus.OK);
	}
	else{
		resp.setStatus(HttpStatus.OK.value());
		resp.setMessage("Error while creating an employee object");
		return new ResponseEntity<MyResponse>(resp, HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}
 
Example 7
Project: esup-sgc   File: ManagerCardController.java   View source code 7 votes vote down vote up
@PreAuthorize("hasRole('ROLE_MANAGER') or hasRole('ROLE_LIVREUR')")
@RequestMapping(value="/multiDelivery", method=RequestMethod.POST)
@Transactional
public String multiDelivery(@RequestParam List<Long> listeIds, Model uiModel) {
	
	for(Long id : listeIds){
		try {
			Card card = Card.findCard(id);
			card.setDeliveredDate(new Date());
			card.merge();
		} catch (Exception e) {
			log.info("La carte avec l'id suivant n'a pas été marquée comme livrée : " + id, e);
		}
	}
	uiModel.asMap().clear();
	return "redirect:/manager/";
}
 
Example 8
Project: chatbot   File: AdminController.java   View source code 7 votes vote down vote up
@RequestMapping(method=RequestMethod.POST, path="/admin/chat-list", produces = "application/json")
public @ResponseBody List<ChatList> actionChatList(@RequestParam String userId, @RequestParam String page) {
    try {
        return helper.getChatDB().getViewRequestBuilder("chats", "getChatList")
                .newRequest(Key.Type.COMPLEX, ChatList.class)
                .startKey(Key.complex(userId))
                .endKey(Key.complex(userId, "\ufff0"))
                .inclusiveEnd(true)
                .limit(MAX_SIZE)
                .skip((Integer.parseInt(page) - 1) * MAX_SIZE)
                .build().getResponse().getValues();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return new ArrayList<ChatList>();
}
 
Example 9
Project: spring-boot-jjwt   File: AuthenticationREST.java   View source code 7 votes vote down vote up
@RequestMapping(value = "auth", method = RequestMethod.POST)
public ResponseEntity<?> auth(@RequestBody AuthRequest ar) {
	
	final Authentication authentication = authenticationManager.authenticate(
		new UsernamePasswordAuthenticationToken(ar.getUsername(), ar.getPassword())
	);
	SecurityContextHolder.getContext().setAuthentication(authentication);
	
	User u = userRepository.findByUsername(ar.getUsername());
	if (u != null) {
		String token = jwtTokenUtil.generateToken(u);
		return ResponseEntity.ok(new AuthResponse(token));
	} else {
		return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
	}
}
 
Example 10
Project: iotplatform   File: AssetController.java   View source code 6 votes vote down vote up
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/customer/asset/{assetId}", method = RequestMethod.DELETE)
@ResponseBody
public Asset unassignAssetFromCustomer(@PathVariable("assetId") String strAssetId) throws IoTPException {
  checkParameter("assetId", strAssetId);
  try {
    AssetId assetId = new AssetId(toUUID(strAssetId));
    Asset asset = checkAssetId(assetId);
    if (asset.getCustomerId() == null || asset.getCustomerId().getId().equals(ModelConstants.NULL_UUID)) {
      throw new IncorrectParameterException("Asset isn't assigned to any customer!");
    }
    return checkNotNull(assetService.unassignAssetFromCustomer(assetId));
  } catch (Exception e) {
    throw handleException(e);
  }
}
 
Example 11
Project: sdoc   File: SdocController.java   View source code 6 votes vote down vote up
@RequestMapping(value = "/sdoc/api/detail/{groupIndex}/{beanName}/{apiIndex}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Options details(HttpServletRequest req, @PathVariable Integer groupIndex, @PathVariable String beanName,
        @PathVariable int apiIndex) throws Exception {
    Options options = new Options();
    Documentation documentation = documentScanner.getDocumentations().get(groupIndex);
    if (documentation == null) {
        return options;
    }
    List<Options> optionsList = documentation.getOptionsMap().get(beanName);
    if (optionsList != null) {
        options = optionsList.get(apiIndex);
    }
    return options;
}
 
Example 12
Project: oneops   File: CmRestController.java   View source code 6 votes vote down vote up
@RequestMapping(method=RequestMethod.PUT, value="/cm/simple/relations/{ciRelId}")
@ResponseBody
public CmsCIRelationSimple updateCIRelation(
		@PathVariable long ciRelId,
		@RequestParam(value="value", required = false)  String valueType, 
		@RequestBody CmsCIRelationSimple relSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws CIValidationException {
	
	scopeVerifier.verifyScope(scope, relSimple);
	
	relSimple.setCiRelationId(ciRelId);
	CmsCIRelation rel = cmsUtil.custCIRelationSimple2CIRelation(relSimple, valueType);
	rel.setUpdatedBy(userId);
	CmsCIRelation newRel = cmManager.updateRelation(rel);
	String[] attrProps = null;
	if (relSimple.getRelationAttrProps().size() >0) {
		attrProps = relSimple.getRelationAttrProps().keySet().toArray(new String[relSimple.getRelationAttrProps().size()]);
	}
	return cmsUtil.custCIRelation2CIRelationSimple(newRel, valueType,false, attrProps);
}
 
Example 13
Project: oneops   File: CmRestController.java   View source code 6 votes vote down vote up
@RequestMapping(value="/cm/cis/{ciId}", method = RequestMethod.GET)
@ResponseBody
@ReadOnlyDataAccess
public CmsCI getCIById(
		@PathVariable long ciId,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope) {

	CmsCI ci = cmManager.getCiById(ciId);

	if (ci == null) throw new CmsException(CmsError.CMS_NO_CI_WITH_GIVEN_ID_ERROR,
                                           "There is no ci with this id");

	scopeVerifier.verifyScope(scope, ci);
	
	return ci;
}
 
Example 14
Project: logistimo-web-service   File: WidgetController.java   View source code 6 votes vote down vote up
@RequestMapping(value = "/", method = RequestMethod.POST)
public
@ResponseBody
String create(@RequestBody WidgetModel model, HttpServletRequest request) {
  SecureUserDetails sUser = SecurityUtils.getUserDetails(request);
  Locale locale = sUser.getLocale();
  ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale);
  long domainId = SessionMgr.getCurrentDomain(request.getSession(), sUser.getUsername());
  try {
    IWidget wid = builder.buildWidget(model, domainId, sUser.getUsername());
    IDashboardService ds = Services.getService(DashboardService.class);
    ds.createWidget(wid);
    model.config.wId = wid.getwId();
    IWidget widConfig = builder.updateWidgetConfig(ds, model.config);
    ds.updateWidgetConfig(widConfig);
  } catch (ServiceException e) {
    xLogger.severe("Error creating Widget for " + domainId);
    throw new InvalidServiceException("Error creating Widget for " + domainId);
  }
  return "Widget " + MsgUtil.bold(model.nm) + " " + backendMessages.getString("created.success");
}
 
Example 15
Project: easyadmin   File: RoleController.java   View source code 6 votes vote down vote up
/**
 * 更新角色信息
 * @param role
 * @return
 */
@RequestMapping(value = "edit",method = RequestMethod.POST)
@ResponseBody
public WebResult edit(Role role,HttpSession session){
    boolean success = false;
    AdminUser loginUser = (AdminUser) session.getAttribute("loginUser");

    if(role.getId() != null){
        role.setCreator(loginUser.getId());
        success = roleService.update(role);
    }else {
        role.setUpdateUser(loginUser.getId());
        role.setUpdateTime(new Date());
        success = roleService.insert(role);
    }
    if(success){
        return WebResult.success();
    }else{
        return WebResult.unKnown();
    }
}
 
Example 16
Project: Webstore   File: UserController.java   View source code 6 votes vote down vote up
@RequestMapping(value = { "/register" }, method = RequestMethod.POST)
public String saveUserAccount(@Valid User user, BindingResult result, ModelMap model) {

    if (result.hasErrors() || result==null) {
        return "register";
    }
    if(!userService.isUserSSOUnique(user.getId(), user.getSsoId())){
        FieldError ssoError =new FieldError("user","ssoId",messageSource.getMessage("non.unique.ssoId", new String[]{user.getSsoId()}, Locale.getDefault()));
        result.addError(ssoError);
        return "register";
    }

    userService.saveCustomerAccount(user);

    model.addAttribute("success", "Użytkownik " + user.getFirstName() + " "+ user.getLastName() + " został zarejestrowany.");
    model.addAttribute("loggedinuser", getPrincipal());
    return "registrationsuccess";
}
 
Example 17
Project: EvoMaster   File: StringsRest.java   View source code 6 votes vote down vote up
@RequestMapping(
        value = "/contains/{s}",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON
)
public StringsResponseDto contains(
        @PathVariable("s") String s
){
    StringsResponseDto dto = new StringsResponseDto();
    if(s == null || s.isEmpty()){
        dto.valid = false;
    }
    else if(s.length() == 3 && "123456789".contains(s)){
        dto.valid = true;
    } else {
        dto.valid = false;
    }

    return dto;
}
 
Example 18
Project: logistimo-web-service   File: DomainConfigController.java   View source code 6 votes vote down vote up
@RequestMapping(value = "/general", method = RequestMethod.GET)
public
@ResponseBody
GeneralConfigModel getGeneralConfig(
    @RequestParam(name = "domain_id", required = false) Long domainId)
    throws ServiceException {
  SecureUserDetails sUser = getUserDetails();
  Locale locale = sUser.getLocale();
  ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale);
  Long
      dId =
      (null == domainId) ? SecurityUtils.getCurrentDomainId() : domainId;
  if (!usersService.hasAccessToDomain(sUser.getUsername(), dId)) {
    xLogger.warn("User {0} does not have access to domain id {1}", sUser.getUsername(), domainId);
    throw new InvalidDataException("User does not have access to domain");
  }
  try {
    return builder.buildGeneralConfigModel(dId, locale, sUser.getTimezone());
  } catch (ServiceException | ConfigurationException e) {
    xLogger.severe("Error in fetching general configuration", e);
    throw new InvalidServiceException(backendMessages.getString("general.config.fetch.error"));
  }
}
 
Example 19
Project: apollo-custom   File: ReleaseController.java   View source code 6 votes vote down vote up
@PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName)")
@RequestMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases", method = RequestMethod.POST)
public OpenReleaseDTO createRelease(@PathVariable String appId, @PathVariable String env,
                                    @PathVariable String clusterName,
                                    @PathVariable String namespaceName,
                                    @RequestBody NamespaceReleaseModel model,
                                    HttpServletRequest request) {

  checkModel(model != null);
  RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model
          .getReleaseTitle()),
      "Params(releaseTitle and releasedBy) can not be empty");

  if (userService.findByUserId(model.getReleasedBy()) == null) {
    throw new BadRequestException("user(releaseBy) not exists");
  }

  model.setAppId(appId);
  model.setEnv(Env.fromString(env).toString());
  model.setClusterName(clusterName);
  model.setNamespaceName(namespaceName);

  return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(model));
}
 
Example 20
Project: monarch   File: IndexCommandsController.java   View source code 6 votes vote down vote up
@RequestMapping(method = RequestMethod.POST, value = "/indexes", params = "op=create-defined")
@ResponseBody
public String createDefinedIndexes(
    @RequestParam(value = CliStrings.CREATE_DEFINED_INDEXES__GROUP,
        required = false) final String groupName,
    @RequestParam(value = CliStrings.CREATE_DEFINED_INDEXES__MEMBER,
        required = false) final String memberNameId) {
  CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_DEFINED_INDEXES);

  if (hasValue(groupName)) {
    command.addOption(CliStrings.CREATE_DEFINED_INDEXES__GROUP, groupName);
  }

  if (hasValue(memberNameId)) {
    command.addOption(CliStrings.CREATE_DEFINED_INDEXES__MEMBER, memberNameId);
  }

  return processCommand(command.toString());
}
 
Example 21
Project: xmall   File: AddressController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/member/addressList",method = RequestMethod.POST)
@ApiOperation(value = "获得所有收货地址")
public Result<List<TbAddress>> addressList(@RequestBody TbAddress tbAddress){

    List<TbAddress> list=addressService.getAddressList(tbAddress.getUserId());
    return new ResultUtil<List<TbAddress>>().setData(list);
}
 
Example 22
Project: Spring-Security-Third-Edition   File: SignupController.java   View source code 5 votes vote down vote up
@RequestMapping(value="/signup/new",method=RequestMethod.POST)
public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use.");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    logger.info("CalendarUser: {}", user);

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
Example 23
Project: docker-dash   File: ConnectionsApi.java   View source code 5 votes vote down vote up
@ApiOperation(value = "Get all groups", notes = "Return docker containers, compose", response = Groups.class, tags={ "Docker", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "successful operation", response = Groups.class),
    @ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })

@RequestMapping(value = "/connections/{connection}/get-all",
    produces = { "application/json" }, 
    method = RequestMethod.GET)
ResponseEntity<Groups> getAll(@ApiParam(value = "", required = true) @PathVariable("connection") String connection);
 
Example 24
Project: logistimo-web-service   File: LinkedDomainController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public
@ResponseBody
String deleteDomainLinks(@RequestParam Long domainId) {
  if (domainId != null) {
    IDomainLink parentDomainLink;
    try {
      DomainsService ds = Services.getService(DomainsServiceImpl.class);
      parentDomainLink = ds.getDomainLinks(domainId, IDomainLink.TYPE_PARENT, 0).get(0);
      List<IDomainLink>
          childLinksOfParent =
          ds.getDomainLinks(parentDomainLink.getLinkedDomainId(), IDomainLink.TYPE_CHILD, 0);
      boolean hasChild = childLinksOfParent.size() > 1;
      ds.deleteDomainLink(parentDomainLink, hasChild);
      Map<String, String> params = new HashMap<>();
      params.put("domainId", String.valueOf(parentDomainLink.getLinkedDomainId()));
      params.put("childDomainIds", String.valueOf(domainId));
      params.put("type", "remove");
      AppFactory.get().getTaskService()
          .schedule(ITaskService.QUEUE_DEFAULT, DOMAIN_LINK_UPDATE_TASK_URL, params,
              ITaskService.METHOD_POST);
      return "Removing domain from parent is scheduled successfully. " + MsgUtil.newLine()
          + MsgUtil.newLine() +
          "NOTE: It will take some time to complete.";
    } catch (Exception e) {
      xLogger.severe("Unable to remove the domain link", e);
      throw new InvalidServiceException("Unable to remove domain link");
    }
  }
  return "success";
}
 
Example 25
Project: poppynotes   File: NotesApi.java   View source code 5 votes vote down vote up
@ApiOperation(value = "Get Note", notes = "Fetches Note with defined Id.", response = CompleteNote.class, tags = {
		"Notes", })
@ApiResponses(value = { @ApiResponse(code = 200, message = "Note entity.", response = CompleteNote.class),
		@ApiResponse(code = 400, message = "Bad request (validation failed).", response = Error.class),
		@ApiResponse(code = 401, message = "Unauthorized (need to log in / get token).", response = Void.class),
		@ApiResponse(code = 403, message = "Forbidden (no rights to access resource).", response = Void.class),
		@ApiResponse(code = 404, message = "Entity not found.", response = Error.class),
		@ApiResponse(code = 409, message = "Request results in a conflict.", response = Error.class),
		@ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) })
@RequestMapping(value = "/api/v1/notes/{noteId}", produces = { "application/json" }, method = RequestMethod.GET)
ResponseEntity<CompleteNote> apiV1NotesNoteIdGet(
		@ApiParam(value = "Unique identifier of a Note.", required = true) @PathVariable("noteId") String noteId,
		@RequestHeader(value = "userId", required = true) Long userId)
		throws NoteNotFoundException, AccessingOtherUsersNotesException;
 
Example 26
Project: Spring-5.0-Cookbook   File: LoginController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/login.html", method = RequestMethod.GET)
public String login(@RequestParam(name = "error", required = false) String error, Model model) {
	try {
		if (error.equalsIgnoreCase("true")) {
			String errorMsg = "Login Error";
			model.addAttribute("errorMsg", errorMsg);
		}else{
			model.addAttribute("errorMsg", error);
		}
	} catch (NullPointerException e) {
		return "login_form";
	}

	return "login_form";
}
 
Example 27
Project: c4sg-services   File: SlackController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/isJoinedChat", method = RequestMethod.GET)
@ApiOperation(value = "Find user by ID", notes = "Returns a user")
public String getUser(
		@ApiParam(value = "emailID of user", required = true) @RequestParam(required = true) String email) {
	Boolean isJoinedChat = slackClientService.isJoinedChat(email);
	if (isJoinedChat) {
		return "Y";
	} else {
		return "N";
	}
}
 
Example 28
Project: NGB-master   File: PersonController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/register", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(
        value = "Registers a user in the system",
        notes = "Registers a user in the system")
public Result<Person> register(@RequestBody final Person person) {
    personManager.savePerson(person);
    return Result.success(person);
}
 
Example 29
Project: BIMplatform   File: ModelController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "queryOutputTemplate", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> queryOutputTemplate(Integer rid, Long otid) {
	ResultUtil result = new ResultUtil();
	OutputTemplateVo outputTemplateVo = bimService.queryOutputTemplate(rid, otid);
	result.setSuccess(true);
	result.setData(outputTemplateVo);
	return result.getResult();
}
 
Example 30
Project: mensa-api   File: MensaWebController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "search", method = RequestMethod.GET)
  public ModelAndView findDishes(@QuerydslPredicate(root = Dish.class) Predicate predicate, @PageableDefault(sort = {"date"}, direction = Sort.Direction.DESC) Pageable pageable, ModelAndView modelAndView) {
Sort realSort = pageable.getSort().and(new Sort(Sort.Direction.ASC, "id"));
PageRequest pageRequest = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), realSort);
Page<Dish> page = dishRepo.findAll(predicate, pageRequest);
List<DishWebDTO> dishes = page.getContent().stream().map(dishDtoFactory::create).collect(Collectors.toList());
modelAndView.addObject("page", page);
modelAndView.addObject("dishes", dishes);
modelAndView.addObject("labels", getLabelsFromDishes());
modelAndView.addObject("categories", getCategoriesFromDishes());
modelAndView.addObject("mensas", mensaRepo.findAllByOrderByName());
      modelAndView.setViewName("search");
      return modelAndView;
  }
 
Example 31
Project: FCat   File: SessionController.java   View source code 5 votes vote down vote up
@ApiOperation(value = "测试保存用户动态验证码" )
@RequestMapping(value = "login", method = RequestMethod.GET)
public JSONObject login(String username) {
    String password = String.valueOf(RandomStringUtils.randomNumeric(6));
    LoginUser loginUser = loginUserService.saveLoginUser(username,password);
    LoginUser loginUser1 = loginUserService.getLoginUser(username);
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("设置redis中的loginUser",loginUser);
    System.out.println(loginUser);
    jsonObject.put("读取redis中loginUser",loginUser1);
    System.out.println(loginUser1);
    return jsonObject;
}
 
Example 32
Project: logistimo-web-service   File: OrderApprovalsController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "", method = RequestMethod.GET)
public
@ResponseBody
RestResponsePage<ApprovalModel> getApprovals(
    @RequestParam(defaultValue = PageParams.DEFAULT_OFFSET_STR) int offset,
    @RequestParam(defaultValue = PageParams.DEFAULT_SIZE_STR) int size,
    @RequestParam(required = false, name = "entity_id") Long entityId,
    @RequestParam(required = false, name = "order_id") Long orderId,
    @RequestParam(required = false, name = "status") String status,
    @RequestParam(required = false, name = "expiring_in") Integer expiringIn,
    @RequestParam(required = false, name = "request_type") Integer requestType,
    @RequestParam(required = false, name = "requester_id") String requesterId,
    @RequestParam(required = false, name = "approver_id") String approverId,
    @RequestParam(required = false, value = "embed") String[] embed)
    throws ServiceException, ObjectNotFoundException {

  RestResponsePage<Approval> approvals = getOrderApprovalsAction.invoke(
      (OrderApprovalFilters) new OrderApprovalFilters()
          .setEntityId(entityId)
          .setOrderId(orderId)
          .setRequestType(requestType)
          .setExpiringInMinutes(expiringIn)
          .setStatus(status)
          .setRequesterId(requesterId)
          .setApproverId(approverId)
          .setDomainId(SecurityUtils.getCurrentDomainId())
          .setOffset(offset)
          .setSize(size));

  return builder.buildApprovalsModel(approvals, embed);
}
 
Example 33
Project: bruxelas   File: UserController.java   View source code 5 votes vote down vote up
@RequestMapping(value="/login", method=RequestMethod.GET)
public String login(HttpSession session) {
	logger.info( "login()..." );
	User user = this.userService.findByEmail("[email protected]");
	if(user == null) {
		throw new RuntimeException("Usuario default não encontrado no Banco. Execute o script do README");
	}
	session.setAttribute("userLogged", user );
	return "redirect:/";
}
 
Example 34
Project: sjk   File: AppController.java   View source code 5 votes vote down vote up
/**
 * 根据cpu类型,phoneId,subCatalog新增包列表
 * 
 * @param cputype
 * @param phoneId
 * @param brand
 * @param product
 * @return
 */
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = { "/apppack-list.json", "/cdn/apppack-list.json" }, method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String getPackageListByCpu(@RequestParam(required = false) Integer cputype,
        @RequestParam(required = false) String phoneId, @RequestParam(required = false) String subCatalog) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        if (null == cputype && null == phoneId && null == subCatalog && null == subCatalog) {
            // List<AppForAllBigGameVo> appList =
            // appService.getAllAppList();
            // List<BigGamePacks> getAllBigGameList =
            // bigGamePackService.getAllBigGameList(); // mybaties
            List<BigGamePacks> getAllBigGameList = bigGamePackService.getBigGamePakcList(); // list查询后进行封装
            output.put("data", getAllBigGameList);
        } else {
            // List<AppForAllBigGameVo> applist =
            // appService.getApplistByParams(cputype, phoneId, subCatalog);
            List<BigGamePacks> applist = bigGamePackService.getApplistByParams(cputype, phoneId, subCatalog);
            output.put("data", applist);
        }
        server.put("code", OK.getCode());
        server.put("msg", OK.getMsg());
    } catch (Exception e) {
        server.put("code", ERROR.getCode());
        server.put("msg", ERROR.getMsg());
        logger.error("Exception", e);
    }

    return output.toJSONString(jsonStyle);
}
 
Example 35
Project: EventSoft   File: AdminController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/eliminar-evento/{id}", method = RequestMethod.GET)
public String eliminarEvento(@PathVariable("id") Long id, Model model) {
    if (id > 0) {
        Contexto contexto = FactoriaComandos.getInstance().crearComando(ELIMINAR_EVENTO).execute(id);

        if (contexto.getEvento() == ELIMINAR_EVENTO) {
            return "redirect:/administracion/admin";
        } else {
            return "error-500";
        }
    }
    return "redirect:/administracion/admin";

}
 
Example 36
Project: oneops   File: DjRestController.java   View source code 5 votes vote down vote up
@RequestMapping(value="/dj/simple/rfcs/count", method = RequestMethod.GET)
@ResponseBody
public String getRfcCountForNs(
		@RequestParam(value = "nsPath" , required = true) String nsPath,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope) {

		scopeVerifier.verifyScope(scope, nsPath);

	return "{\"ci\":" + djManager.getRfcCiCountByNs(nsPath) +
		   ",\"relation\":" + djManager.getRfcRelationCountByNs(nsPath) + "}";
}
 
Example 37
Project: kafka-webview   File: LoginController.java   View source code 5 votes vote down vote up
/**
 * POST Requests handle submitting new user registration form.
 */
@RequestMapping(path = "/me", method = RequestMethod.GET)
public String me(Authentication auth) {
    if (isLoggedIn()) {
        return "redirect:/";
    }
    final CustomUserDetails userDetails = getLoggedInUser();
    final User user = userDetails.getUserModel();

    logger.info("User: {}", user);
    logger.info("User Role: {}", user.getRole().name());
    logger.info("Authorities: {}", auth.getAuthorities());
    return "redirect:/";
}
 
Example 38
Project: PowerApi   File: PermissionController.java   View source code 5 votes vote down vote up
@RequiresPermissions("permission:delete")
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String delete(ModelMap modelMap,
                     @RequestParam(value = "id", required = false, defaultValue = "") Long id) {
    permissionService.deletePermission(id);
    return "redirect:/permission/all";
}
 
Example 39
Project: sztw   File: ManageController.java   View source code 5 votes vote down vote up
@RequestMapping(value = "/createClub", method = RequestMethod.POST)
public String createClub(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("file") MultipartFile file){
    BaseFile baseFile = new BaseFile();
    baseFile.upload(file, FOLDER_OFFICE_EXCEL+"importFile");
    String fileNamee = file.getOriginalFilename();
    clubService.createClub("importFile", fileNamee.substring(0, fileNamee.lastIndexOf(".")));
    return ajaxReturn(response, null);
}
 
Example 40
Project: SSMFrameBase   File: UserController.java   View source code 5 votes vote down vote up
/**
 * 用户登录
 * @param req
 * @return
 * @throws BusinessException
 */
@RequestMapping(value = "/user/doLogin", method=RequestMethod.POST)
@ResponseBody
public JSON doLogin(@RequestBody @Valid UserLoginReq req, HttpSession session) throws BusinessException {
	User user = userService.doLogin(req);
	session.setAttribute(Constant.SESSION_USER, user);
	User newUser = new User();
	newUser.setId(user.getId());
	newUser.setUsername(user.getUsername());
	return JsonUtil.newJson().addData("data", newUser).toJson();
}