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

The following are top voted examples for showing how to use org.springframework.web.bind.annotation.RequestParam. 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: saluki   File: ServiceTestController.java   Source Code and License 8 votes vote down vote up
@RequestMapping(value = "testService", method = RequestMethod.POST)
public Object testService(@RequestParam(value = "ipPort", required = true) String ipPort,
    @RequestBody GrpcServiceTestModel model) throws Exception {
  String serviceUrl = "http://" + ipPort + "/service/test";
  HttpPost request = new HttpPost(serviceUrl);
  request.addHeader("content-type", "application/json");
  request.addHeader("Accept", "application/json");
  try {
    StringEntity entity = new StringEntity(gson.toJson(model), "utf-8");
    entity.setContentEncoding("UTF-8");
    entity.setContentType("application/json");
    request.setEntity(entity);
    HttpResponse httpResponse = httpClient.execute(request);
    if (httpResponse.getStatusLine().getStatusCode() == 200) {
      String minitorJson = EntityUtils.toString(httpResponse.getEntity());
      Object response = gson.fromJson(minitorJson, new TypeToken<Object>() {}.getType());
      return response;
    }
  } catch (Exception e) {
    throw e;
  }
  return null;
}
 
Example 2
Project: mu-workshop-lab3   File: MilkshakeController.java   Source Code and License 7 votes vote down vote up
/**
 * Handle a POST method by creating a new Milkshake.
 *  Queries appropriate fruit service to check for inventory and consume the fruit into the milkshake
 *
 * @param flavor to create
 * @return a newly created Milkshake
 */
@RequestMapping(method = RequestMethod.POST)
public @ResponseBody Milkshake create(@RequestParam Flavor flavor) {

  try {
    FlavorProvider provider = getFlavorProvider(flavor);
    provider.getIngredients();
  } catch (IngredientException e) {
    throw new HttpClientErrorException(HttpStatus.TOO_MANY_REQUESTS, e.getMessage());
  }

  Milkshake milkshake = new Milkshake();
  milkshake.setId(counter.incrementAndGet());
  milkshake.setFlavor(flavor);
  return milkshake;
}
 
Example 3
Project: Spring-Security-Third-Edition   File: LoginController.java   Source Code and License 6 votes vote down vote up
@GetMapping(value = "/login")
public ModelAndView login(
        @RequestParam(value = "error", required = false) String error,
        @RequestParam(value = "logout", required = false) String logout) {

    logger.info("******login(error): {} ***************************************", error);
    logger.info("******login(logout): {} ***************************************", logout);

    ModelAndView model = new ModelAndView();
    if (error != null) {
        model.addObject("error", "Invalid username and password!");
    }

    if (logout != null) {
        model.addObject("message", "You've been logged out successfully.");
    }
    model.setViewName("login");

    return model;

}
 
Example 4
Project: lemon   File: ReportQueryController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("report-query-export")
public void export(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    String userId = currentUserHolder.getUserId();
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_userId", userId));
    page = reportQueryManager.pagedQuery(page, propertyFilters);

    List<ReportQuery> reportQuerys = (List<ReportQuery>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("report subject");
    tableModel.addHeaders("id", "name");
    tableModel.setData(reportQuerys);
    exportor.export(request, response, tableModel);
}
 
Example 5
Project: lemon   File: UserStatusController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("user-status-remove")
public String remove(@RequestParam("selectedItem") List<Long> selectedItem,
        RedirectAttributes redirectAttributes) {
    try {
        List<UserStatus> userStatuses = userStatusManager
                .findByIds(selectedItem);

        for (UserStatus userStatus : userStatuses) {
            userStatusChecker.check(userStatus);
        }

        userStatusManager.removeAll(userStatuses);
        messageHelper.addFlashMessage(redirectAttributes,
                "core.success.delete", "删除成功");
    } catch (CheckUserStatusException ex) {
        logger.warn(ex.getMessage(), ex);
        messageHelper.addFlashMessage(redirectAttributes, ex.getMessage());
    }

    return "redirect:/auth/user-status-list.do";
}
 
Example 6
Project: corporate-game-share   File: GameController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(path = "/games")
public Games searchGames(@RequestParam(value = "console") String console,
                         @RequestParam(value = "name", required = false) String name,
                         @RequestParam(value = "genre", required = false) String genre,
                         @RequestParam(value = "developer", required = false) String developer,
                         @RequestParam(value = "publisher", required = false) String publisher,
                         @RequestParam(required = false, defaultValue = "0") int pageNumber,
                         @RequestParam(required = false, defaultValue = "0") int pageSize) {

    List<SearchCriterion> searchCriteria = new ArrayList<>();
    searchCriteria.add(new SearchCriterion("name", null, "like", name));
    //TODO if GENRES required, a list of search criterion can be created
    searchCriteria.add(new SearchCriterion("genres", null, "contains", genre));
    searchCriteria.add(new SearchCriterion("developer", null, "equal", developer));
    searchCriteria.add(new SearchCriterion("publisher", null, "equal", publisher));
    searchCriteria.add(new SearchCriterion("console", "shortName", "join", console));

    return service.searchGames(searchCriteria, pageNumber, pageSize);
}
 
Example 7
Project: sweiproject-tg2b-1   File: ActivityController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/activity/{id}", method = RequestMethod.PUT)
public Activity update(@PathVariable Long id, @RequestBody Activity input, @RequestParam("username") String username,
                       @RequestParam("password") String password) {
    validateAccountUserExists(username, password);
    final Activity activity = activityRepository.findOne(id);
    if (activity == null) {
        return null;
    } else {
        activity.setText(input.getText());
        activity.setTitle(input.getTitle());
        activity.setAuthor(input.getAuthor());
        activity.setTag1(input.getTag1());
        activity.setTag2(input.getTag2());
        activity.setTag3(input.getTag3());
        activity.setImgBase64(input.getImgBase64());
        return activityRepository.save(activity);
    }
}
 
Example 8
Project: iotplatform   File: EntityRelationController.java   Source Code and License 6 votes vote down vote up
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/relations", method = RequestMethod.GET, params = { "toId", "toType", "relationType" })
@ResponseBody
public List<EntityRelation> findByTo(@RequestParam("toId") String strToId, @RequestParam("toType") String strToType,
    @RequestParam("relationType") String strRelationType,
    @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws IoTPException {
  checkParameter("toId", strToId);
  checkParameter("toType", strToType);
  checkParameter("relationType", strRelationType);
  EntityId entityId = EntityIdFactory.getByTypeAndId(strToType, strToId);
  checkEntityId(entityId);
  RelationTypeGroup typeGroup = parseRelationTypeGroup(strRelationTypeGroup, RelationTypeGroup.COMMON);
  try {
    return checkNotNull(relationService.findByToAndType(entityId, strRelationType, typeGroup).get());
  } catch (Exception e) {
    throw handleException(e);
  }
}
 
Example 9
Project: oneops   File: DpmtRestController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value="/dj/simple/deployments/{dpmtId}/cis", method = RequestMethod.GET)
@ResponseBody
public List<CmsDpmtRecord> getDpmtRecordCis(
		@PathVariable long dpmtId,
		@RequestParam(value="updatedAfter", required = false) Long updatedAfter,
		@RequestParam(value="state", required = false) String state,
		@RequestParam(value="execorder", required = false) Integer execOrder,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){
	
	if (scope != null) {
		CmsDeployment dpmt = djManager.getDeployment(dpmtId);
		scopeVerifier.verifyScope(scope, dpmt);
	}

	if (updatedAfter != null) {
		return djManager.getDpmtRecordCis(dpmtId, new Date(updatedAfter));
	}
	else if (state == null && execOrder==null) {
		return djManager.getDpmtRecordCis(dpmtId);
	} else {
		return djManager.getDpmtRecordCis(dpmtId, state, execOrder);
	}
}
 
Example 10
Project: iotplatform   File: AlarmController.java   Source Code and License 6 votes vote down vote up
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/alarm/highestSeverity/{entityType}/{entityId}", method = RequestMethod.GET)
@ResponseBody
public AlarmSeverity getHighestAlarmSeverity(
        @PathVariable("entityType") String strEntityType,
        @PathVariable("entityId") String strEntityId,
        @RequestParam(required = false) String searchStatus,
        @RequestParam(required = false) String status
) throws IoTPException {
    checkParameter("EntityId", strEntityId);
    checkParameter("EntityType", strEntityType);
    EntityId entityId = EntityIdFactory.getByTypeAndId(strEntityType, strEntityId);
    AlarmSearchStatus alarmSearchStatus = StringUtils.isEmpty(searchStatus) ? null : AlarmSearchStatus.valueOf(searchStatus);
    AlarmStatus alarmStatus = StringUtils.isEmpty(status) ? null : AlarmStatus.valueOf(status);
    if (alarmSearchStatus != null && alarmStatus != null) {
        throw new IoTPException("Invalid alarms search query: Both parameters 'searchStatus' " +
                "and 'status' can't be specified at the same time!", IoTPErrorCode.BAD_REQUEST_PARAMS);
    }
    checkEntityId(entityId);
    try {
        return alarmService.findHighestAlarmSeverity(entityId, alarmSearchStatus, alarmStatus);
    } catch (Exception e) {
        throw handleException(e);
    }
}
 
Example 11
Project: lemon   File: FeedbackInfoController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("feedback-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);
    page = feedbackInfoManager.pagedQuery(page, propertyFilters);

    List<FeedbackInfo> feedbackInfos = (List<FeedbackInfo>) page
            .getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("feedbackInfo");
    tableModel.addHeaders("id", "name");
    tableModel.setData(feedbackInfos);
    exportor.export(request, response, tableModel);
}
 
Example 12
Project: yum   File: FoodsApi.java   Source Code and License 6 votes vote down vote up
@ApiOperation(value = "Gets all foods, optionally return stats per food", notes = "Return a list of all foods", response = FoodWithStats.class, responseContainer = "List", authorizations = {
    @Authorization(value = "Bearer")
}, tags={ "chef", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "A list of foods", response = FoodWithStats.class),
    @ApiResponse(code = 500, message = "An unexpected error occured.", response = FoodWithStats.class) })
@RequestMapping(value = "/foods",
    produces = { "application/json" }, 
    method = RequestMethod.GET)
@CrossOrigin          
 ResponseEntity<FoodsPage> foodsGet( @ApiParam(value = "") @RequestParam(value = "stats", required = false) Boolean stats,
     @ApiParam(value = "Request pagination page") @RequestParam(value = "page", required = false) String page,
     @ApiParam(value = "Request pagination size / num of foods") @RequestParam(value = "size", required = false) String size,
     @ApiParam(value = "Request foodType filter") @RequestParam(value = "foodType", required = false) String foodType,
     @ApiParam(value = "Request archived filter") @RequestParam(value = "archived", required = false) String archived,
     @ApiParam(value = "Request orderBy filter") @RequestParam(value = "orderBy", required = false) String orderBy,
     @ApiParam(value = "Request foods version") @RequestParam(value = "foods_version", required = false) @Valid @Digits( integer=9,  fraction=0 )Integer foods_version,
     @ApiParam(value = "Request orderBy filter") @RequestParam(value = "orderDirection", required = false) String orderDirection) throws ApiException, Exception;
 
Example 13
Project: NGB-master   File: ProjectController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/project/{projectId}", method = RequestMethod.DELETE)
@ResponseBody
@ApiOperation(
        value = "Deletes a project, specified by project ID",
        notes = "Deletes a project with all it's items and bookmarks",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
        value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)
        })
public Result<Boolean> deleteProject(@PathVariable final long projectId,
                                     @RequestParam(name = "force", required = false, defaultValue = "false")
                                             Boolean force) throws IOException {
    Project deletedProject = projectManager.deleteProject(projectId, force);
    return Result.success(true, MessageHelper.getMessage(MessagesConstants.INFO_PROJECT_DELETED, deletedProject
            .getId(), deletedProject.getName()));
}
 
Example 14
Project: sc-generator   File: JsonSchemaController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/generator/preview", method = RequestMethod.POST)
public String preview(@RequestParam(value = "schema") String schema,
                      @RequestParam(value = "targetpackage") String targetpackage,
                      @RequestParam(value = "sourcetype", required = false) final String sourcetype,
                      @RequestParam(value = "annotationstyle", required = false) final String annotationstyle,
                      @RequestParam(value = "usedoublenumbers", required = false) final boolean usedoublenumbers,
                      @RequestParam(value = "includeaccessors", required = false) final boolean includeaccessors,
                      @RequestParam(value = "includeadditionalproperties", required = false) final boolean includeadditionalproperties,
                      @RequestParam(value = "propertyworddelimiters", required = false) final String propertyworddelimiters,
                      @RequestParam(value = "classname") String classname) throws IOException {

    final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    JCodeModel codegenModel = getCodegenModel(schema, targetpackage, sourcetype, annotationstyle, usedoublenumbers, includeaccessors, includeadditionalproperties, propertyworddelimiters, classname);
    codegenModel.build(new CodeWriter() {
        @Override
        public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
            return byteArrayOutputStream;
        }

        @Override
        public void close() throws IOException {
            byteArrayOutputStream.close();
        }
    });
    return byteArrayOutputStream.toString("utf-8");
}
 
Example 15
Project: lemon   File: DiskController.java   Source Code and License 6 votes vote down vote up
/**
 * 详情.
 */
@RequestMapping("disk-view")
public String view(
        @RequestParam("id") Long id,
        @CookieValue(value = "share", required = false) String sharePassword,
        Model model) {
    DiskShare diskShare = diskShareManager.get(id);

    if ("private".equals(diskShare.getShareType())) {
        if (!diskShare.getSharePassword().equals(sharePassword)) {
            return "disk/disk-code";
        }
    }

    model.addAttribute("diskShare", diskShare);

    return "disk/disk-view";
}
 
Example 16
Project: spring-boot-shopping-cart   File: HomeController.java   Source Code and License 6 votes vote down vote up
@GetMapping("/home")
    public ModelAndView home(@RequestParam("pageSize") Optional<Integer> pageSize,
                             @RequestParam("page") Optional<Integer> page) {

        // Evaluate page size. If requested parameter is null, return initial
        // page size
        int evalPageSize = pageSize.orElse(INITIAL_PAGE_SIZE);
        // Evaluate page. If requested parameter is null or less than 0 (to
        // prevent exception), return initial size. Otherwise, return value of
        // param. decreased by 1.
        int evalPage = (page.orElse(0) < 1) ? INITIAL_PAGE : page.get() - 1;

//        Page<Post> posts = postService.findAllPageable(new PageRequest(evalPage, evalPageSize));
        Page<Product> products = productService.findAllProductsPageable(new PageRequest(evalPage, evalPageSize));
        Pager pager = new Pager(products.getTotalPages(), products.getNumber(), BUTTONS_TO_SHOW);

        ModelAndView modelAndView = new ModelAndView();
//        Collection<Post> posts = postService.findNLatestPosts(5);
        modelAndView.addObject("products", products);
        modelAndView.addObject("selectedPageSize", evalPageSize);
        modelAndView.addObject("pageSizes", PAGE_SIZES);
        modelAndView.addObject("pager", pager);
        modelAndView.setViewName("home");
        return modelAndView;
    }
 
Example 17
Project: wangmarket   File: InstallController_.java   Source Code and License 6 votes vote down vote up
/**
 * 服务于第一步,设置当前存储方式(保存)
 * @throws ConfigurationException 
 */
@RequestMapping("/setAttachmentMode")
public String setLocalAttachmentFile(HttpServletRequest request, Model model,
		@RequestParam(value = "mode", required = false, defaultValue="") String mode){
	if(!Global.get("IW_AUTO_INSTALL_USE").equals("true")){
		return error(model, "系统已禁止使用此!");
	}
	
	String m = AttachmentFile.MODE_LOCAL_FILE;	//默认使用服务器进行存储
	if(mode.equals(AttachmentFile.MODE_ALIYUN_OSS)){
		//使用阿里云OSS
		m = AttachmentFile.MODE_ALIYUN_OSS;
	}
	sqlService.executeSql("update system set value = '"+m+"' WHERE name = 'ATTACHMENT_FILE_MODE'");
	
	//更新缓存
	systemService.refreshSystemCache();
	
	return redirect("install/systemSet.do");
}
 
Example 18
Project: lemon   File: ConsoleController.java   Source Code and License 6 votes vote down vote up
/**
 * 上传发布流程定义.
 */
@RequestMapping("console-process-upload")
public String processUpload(@RequestParam("file") MultipartFile file,
        RedirectAttributes redirectAttributes) throws Exception {
    String tenantId = tenantHolder.getTenantId();
    String fileName = file.getOriginalFilename();
    Deployment deployment = processEngine.getRepositoryService()
            .createDeployment()
            .addInputStream(fileName, file.getInputStream())
            .tenantId(tenantId).deploy();
    List<ProcessDefinition> processDefinitions = processEngine
            .getRepositoryService().createProcessDefinitionQuery()
            .deploymentId(deployment.getId()).list();

    for (ProcessDefinition processDefinition : processDefinitions) {
        processEngine.getManagementService().executeCommand(
                new SyncProcessCmd(processDefinition.getId()));
    }

    return "redirect:/bpm/console-listProcessDefinitions.do";
}
 
Example 19
Project: Mastering-Microservices-with-Java-9-Second-Edition   File: RestaurantController.java   Source Code and License 6 votes vote down vote up
/**
 * Fetch restaurants with the specified name. A partial case-insensitive
 * match is supported. So <code>http://.../restaurants/rest</code> will find
 * any restaurants with upper or lower case 'rest' in their name.
 *
 * @param name
 * @return A non-null, non-empty collection of restaurants.
 */
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Collection<Restaurant>> findByName(@RequestParam("name") String name) {
    logger.info(String.format("restaurant-service findByName() invoked:{} for {} ", restaurantService.getClass().getName(), name));
    name = name.trim().toLowerCase();
    Collection<Restaurant> restaurants;
    try {
        restaurants = restaurantService.findByName(name);
    } catch (Exception ex) {
        logger.log(Level.SEVERE, "Exception raised findByName REST Call", ex);
        return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
    }
    return restaurants.size() > 0 ? new ResponseEntity<>(restaurants, HttpStatus.OK)
            : new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
 
Example 20
Project: lemon   File: ModelFieldController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("model-field-input")
public String input(
        @RequestParam(value = "id", required = false) Long id,
        @RequestParam(value = "type", required = false) String whitelistTypeCode,
        Model model) {
    ModelField modelField = null;

    if (id != null) {
        modelField = modelFieldManager.get(id);
        model.addAttribute("model", modelField);
    }

    model.addAttribute("modelInfos", modelInfoManager.getAll());

    return "model/model-field-input";
}
 
Example 21
Project: wangmarket   File: SystemAdminController_.java   Source Code and License 6 votes vote down vote up
/**
 * 新增/修改全局变量,修改system表的单个变量
 * @param id 要修改的变量的id
 */
@RequiresPermissions("adminSystemVariable")
@RequestMapping("variable")
public String variable(
		@RequestParam(value = "id", required = false, defaultValue="0") int id,
		Model model, HttpServletRequest request){
	System system;
	if(id == 0){
		//新增
		system = new System();
		ActionLogCache.insert(request, "进入新增系统变量页面");
	}else{
		//修改
		system = sqlService.findById(System.class, id);
		if(system == null){
			return error(model, "要修改的变量不存在");
		}
		ActionLogCache.insert(request, id, "进入修改系统变量页面", system.getName()+"="+system.getValue());
	}
	
	//编辑页面
	model.addAttribute("system", system);
	return "/iw/admin/system/variable";
}
 
Example 22
Project: MicroServiceProject   File: Application.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/getSimilarMovies", method = RequestMethod.GET)
public String getSimilarMovies(@RequestParam(value = "id") String id)throws Exception{
    int numTopNRanks = 10;
    int itemIdx = rateDao.getItemId(id);
    String str = "";
    List<Map.Entry<Integer, Double>> itemScores = new ArrayList<>();
    List<Integer> rankedItems = new ArrayList<>(itemScores.size());
    for (int u = 0,um = trainMatrix.numColumns();u<um;u++){
        if(u!=itemIdx){
            double score = Sims.jaccard(trainMatrix.getColumns(u),trainMatrix.getColumns(itemIdx));
            itemScores.add(new AbstractMap.SimpleImmutableEntry<Integer,Double>(u,score));
        }
    }
    itemScores = Lists.sortListTopK(itemScores, true, numTopNRanks);
    for (Map.Entry<Integer, Double> kv : itemScores) {
        Integer item = kv.getKey();
        rankedItems.add(item);
    }
    int i;
    for (i = 0; i < rankedItems.size()-1 && i<9; i++) {

        str+=rateDao.getItemId(rankedItems.get(i))+",";
    }
    str+=rateDao.getItemId(rankedItems.get(i));
    return str;
}
 
Example 23
Project: SchTtableServer   File: MiscController.java   Source Code and License 6 votes vote down vote up
/**
     * 获取最新App版本描述信息,同时也用于记录用户基本信息
     * 
     * @param request
     * @param userKey 用户认证KEY
     * @param brand 设备品牌
     * @param model 设备型号
     * @param sdk 系统版本
     * @param appVerName App版本名
     * @param appVerCode App版本号
     * @return
     */
    @RequestMapping("/appver")
    @ResponseBody
    public ResResBean<AppVerVo> checkAppUpdate(HttpServletRequest request,
            @RequestParam(value = "userkey", required = false) String userKey,
            @RequestParam(value = "devicebrand", required = false) String brand,
            @RequestParam(value = "devicemodel", required = false) String model,
            @RequestParam(value = "devicesdk", required = false) Integer sdk,
            @RequestParam(value = "appvername", required = false) String appVerName,
            @RequestParam(value = "appvercode", required = false) Integer appVerCode) {
        System.out.println("GET /misc/appver " + model);
        
        monitorService.addLog(userKey, ExtraUtil.getRemoteHost(request),
                brand, model, sdk, appVerName, appVerCode);
        
//        String dir = request.getServletContext().getRealPath("/");
//        File versionFile = new File(dir + "/WEB-INF/config/appversion.json");
        
//        return ExtraUtil.readFile(versionFile);
        
        return new ResResBean.Builder<AppVerVo>()
                .status(ResResBean.STATUS_SUCCESS)
                .result(appVerService.getLatestApp())
                .build();
    }
 
Example 24
Project: Spring-Security-Third-Edition   File: LoginController.java   Source Code and License 6 votes vote down vote up
public ModelAndView login(
        @RequestParam(value = "error", required = false) String error,
        @RequestParam(value = "logout", required = false) String logout) {

    logger.info("******login(error): {} ***************************************", error);
    logger.info("******login(logout): {} ***************************************", logout);

    ModelAndView model = new ModelAndView();
    if (error != null) {
        model.addObject("error", "Invalid username and password!");
    }

    if (logout != null) {
        model.addObject("message", "You've been logged out successfully.");
    }
    model.setViewName("login");

    return model;

}
 
Example 25
Project: matrix-appservice-email   File: SubscriptionController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = SubscriptionPortalService.BASE_PATH, method = GET)
public String listSubscriptions(Model model, @RequestParam String token) {
    log.info("Subscription list request");

    Optional<_BridgeSubscription> subOpt = subMgr.getWithEmailKey(token);
    if (!subOpt.isPresent()) {
        throw new InvalidEmailKeyException();
    }

    log.info("E-mail token is valid: {}", token);
    String email = subOpt.get().getEmailEndpoint().getIdentity();
    log.info("E-mail user: {}", email);

    List<SubscriptionItem> subs = new ArrayList<>();
    for (_BridgeSubscription sub : subMgr.listForEmail(email)) {
        subs.add(new SubscriptionItem(sub));
    }
    log.info("Found {} subscription(s)", subs.size());

    model.addAttribute("subList", subs);

    return "subscription/list";
}
 
Example 26
Project: che-starter   File: WorkspaceController.java   Source Code and License 6 votes vote down vote up
@ApiOperation(value = "Start an existing workspace. Stop all other workspaces (only one workspace can be running at a time)")
@PatchMapping("/workspace/{name}")
public Workspace startExisting(@PathVariable String name, @RequestParam String masterUrl,
        @RequestParam String namespace,
        @ApiParam(value = "Keycloak token", required = true) @RequestHeader("Authorization") String keycloakToken)
        throws IOException, URISyntaxException, RouteNotFoundException, StackNotFoundException,
        GitHubOAthTokenException, ProjectCreationException, KeycloakException, WorkspaceNotFound {

    KeycloakTokenValidator.validate(keycloakToken);

    String openShiftToken = keycloakClient.getOpenShiftToken(keycloakToken);
    String gitHubToken = keycloakClient.getGitHubToken(keycloakToken);
    String cheServerURL = openShiftClientWrapper.getCheServerUrl(masterUrl, namespace, openShiftToken, keycloakToken);

    Workspace workspace = workspaceClient.startWorkspace(cheServerURL, name, masterUrl, namespace, openShiftToken, keycloakToken);
    setGitHubOAthTokenAndCommitterInfo(cheServerURL, gitHubToken, keycloakToken);
    return workspace;
}
 
Example 27
Project: SkillWill   File: SkillController.java   Source Code and License 6 votes vote down vote up
/**
 * get/suggest skills based on search query -> can be used for autocompletion when user started
 * typing
 */
@ApiOperation(value = "suggest skills", nickname = "suggest skills", notes = "suggest skills")
@ApiResponses({
  @ApiResponse(code = 200, message = "Success"),
  @ApiResponse(code = 500, message = "Failure")
})
@ApiImplicitParams({
  @ApiImplicitParam(name = "search", value = "Name to search", paramType = "query"),
  @ApiImplicitParam(name = "exclude_hidden", value = "Do not return hidden skills", paramType = "query", defaultValue = "true"),
  @ApiImplicitParam(name = "count", value = "Limit the number of skills to find", paramType = "query"),
})
@RequestMapping(path = "/skills", method = RequestMethod.GET)
public ResponseEntity<String> getSkills(@RequestParam(required = false) String search,
  @RequestParam(required = false, defaultValue = "true") boolean exclude_hidden,
  @RequestParam(required = false, defaultValue = "-1") int count) {

  JSONArray skillsArr = new JSONArray(
    skillService.getSkills(search, exclude_hidden, count)
      .stream()
      .map(KnownSkill::toJSON)
      .collect(Collectors.toList())
  );
  return new ResponseEntity<>(skillsArr.toString(), HttpStatus.OK);
}
 
Example 28
Project: leafer   File: FileUploadController.java   Source Code and License 5 votes vote down vote up
@PostMapping("/api/upload")
public ResponseEntity<?> uploadFile(@RequestParam("file") MultipartFile multipartFile) {
    logger.debug("Single file upload!");

    if (multipartFile.isEmpty()) {
        return new ResponseEntity("Please select a file!", HttpStatus.OK);
    }

    try {
        String randomPath = saveUploadedFiles(Arrays.asList(multipartFile));
        return new ResponseEntity(serverAddress + "/leafer/" + randomPath, new HttpHeaders(), HttpStatus.OK);

    } catch (IOException e) {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
}
 
Example 29
Project: lemon   File: BpmProcessController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("bpm-process-remove")
public String remove(@RequestParam("selectedItem") List<Long> selectedItem,
        RedirectAttributes redirectAttributes) {
    List<BpmProcess> bpmCategories = bpmProcessManager
            .findByIds(selectedItem);
    bpmProcessManager.removeAll(bpmCategories);
    messageHelper.addFlashMessage(redirectAttributes,
            "core.success.delete", "删除成功");

    return "redirect:/bpm/bpm-process-list.do";
}
 
Example 30
Project: LT-ABSA   File: ApplicationController.java   Source Code and License 5 votes vote down vote up
/**
 * Processes input text and outputs the classification results.
 * @param text the input text
 * @return returns a HTML document with the analysis of the input
 */
@RequestMapping("/")
String home(@RequestParam(value = "text", defaultValue = "") String text, @RequestParam(value="format", defaultValue ="html") String format) {

    Result result = analyzer.analyzeText(text);

   if (format.compareTo("json") == 0) {
        return generateJSONResponse(result);
   } else {
       return generateHTMLResponse(result);
   }
}
 
Example 31
Project: environment.monitor   File: EnvironmentStatusService.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "aggregated/{environmentName}", method = RequestMethod.GET)
public ResponseEntity<List<AggregatedResourceStatus>> getStatus(
    @PathVariable("environmentName") String environmentName,
    @RequestParam(value = "resources", required = false) Set<String> resources,
    @RequestParam("startDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date startDate,
    @RequestParam("endDate") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date endDate) {

  AggregatedStatusDAO detailDAO = MongoConnector.getInstance().getAggregatedStatusDAO();
  List<AggregatedResourceStatus> aggStatusses = detailDAO.getAggregatedStatuses(environmentName, resources, startDate, endDate);

  return ResponseEntity.ok(aggStatusses);
}
 
Example 32
Project: SpringBoot_Wechat_Sell   File: BuyerProductController.java   Source Code and License 5 votes vote down vote up
@GetMapping("/list")
@Cacheable(cacheNames = "product", key = "#sellerid", condition = "#sellerid.length()>10", unless = "#result.getCode() !=0")
public ResultVO list(@RequestParam(value = "sellerid", required = false) String sellerid) {

    //查询上架的商品
    List<ProductInfo> productInfoList = productService.findUpAll();


    List<Integer> categoryTypeList = productInfoList.stream().map(e -> e.getCategoryType()).collect(Collectors.toList());

    List<ProductCategory> productCategoryList = categoryService.findByCategoryTypeIn(categoryTypeList);


    List<ProductVO> productVOList = new ArrayList<>();
    for (ProductCategory productCategory : productCategoryList) {
        ProductVO productVO = new ProductVO();
        productVO.setCategoryType(productCategory.getCategoryType());
        productVO.setCategoryName(productCategory.getCategoryName());


        List<ProductInfoVO> productInfoVOList = new ArrayList<>();
        for (ProductInfo productInfo : productInfoList) {
            if (productInfo.getCategoryType().equals(productCategory.getCategoryType())) {
                ProductInfoVO productInfoVO = new ProductInfoVO();
                BeanUtils.copyProperties(productInfo, productInfoVO);
                productInfoVOList.add(productInfoVO);
            }
        }
        productVO.setProductInfoVOList(productInfoVOList);
        productVOList.add(productVO);
    }

    return ResultVOUtil.success(productVOList);

}
 
Example 33
Project: product-management-system   File: StoreController.java   Source Code and License 5 votes vote down vote up
/**
 * Create relation between {@link by.kraskovski.pms.domain.model.Stock} and {@link Store}
 */
@PutMapping("/stock-manage")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void addStock(@RequestParam final String storeId,
                     @RequestParam final String stockId) {
    log.info("Start add stock: {} to store: {}", stockId, storeId);
    storeService.addStock(storeId, stockId);
}
 
Example 34
Project: lemon   File: JobUserController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("job-user-input")
public String input(@RequestParam(value = "id", required = false) Long id,
        Model model) {
    String tenantId = tenantHolder.getTenantId();

    if (id != null) {
        JobUser jobUser = jobUserManager.get(id);
        model.addAttribute("model", jobUser);
    }

    model.addAttribute("jobInfos",
            jobInfoManager.findBy("tenantId", tenantId));

    return "org/job-user-input";
}
 
Example 35
Project: oneops   File: CmRestController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(method=RequestMethod.POST, value="/cm/simple/cis")
@ResponseBody
public CmsCISimple createCISimple(
		@RequestParam(value="value", required = false)  String valueType, 
		@RequestBody CmsCISimple ciSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws CIValidationException {	
	
	scopeVerifier.verifyScope(scope, ciSimple);
	
	CmsCI newCi = cmsUtil.custCISimple2CI(ciSimple, valueType);
	newCi.setCiId(0);
	newCi.setCiGoid(null);
	newCi.setCreatedBy(userId);
	try {
		CmsCI ci = cmManager.createCI(newCi);
		updateAltNs(ci.getCiId(), ciSimple);
		logger.debug(ci.getCiId());
		CmsCISimple cmsCISimple = cmsUtil.custCI2CISimple(ci, valueType);
		cmsCISimple.setAltNs(ciSimple.getAltNs());
		return cmsCISimple;
	} catch (DataIntegrityViolationException dive) {
		if (dive instanceof DuplicateKeyException) {
			throw new CIValidationException(CmsError.CMS_DUPCI_NAME_ERROR, dive.getMessage());
		} else {
			throw new CmsException(CmsError.CMS_EXCEPTION, dive.getMessage());
		}
	}
}
 
Example 36
Project: sjk   File: MarketController.java   Source Code and License 5 votes vote down vote up
/**
 * 市场主动护送数据,按下载URL去拉取一个文件
 * 127.0.0.1:9080/sjk-market-collection/market/yingyongso
 * /gen.d?marketName=shoujikong_channel
 * &key=bzHqw2V1MhXXkUddQl77qFa5slxYKhYf&
 * download=http://www.yingyong.so/shoujikong
 * /ijinshan_shoujikongchannel_f855087b4eaf423fb7b2be5413825abb.csv
 * 
 * @param c
 * @return
 */
@RequestMapping(value = "/yingyongso/gen.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String gen(@RequestParam final String marketName, @RequestParam String key,
        @RequestParam final String download) {
    logger.info("Someone requests gen a file!");

    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);

    boolean login = marketSecurityService.allowAccess(marketName, key);
    if (login) {
        server.put("msg", "Login Ok! Handle in deamon...");
        server.put("code", SvrResult.OK.getCode());
        dblogger.info("URL of download: {}", download);
        new Thread(new Runnable() {
            @Override
            public void run() {
                ((NotifyDataServiceImpl) notifyDataServiceImpl).importByUrl(marketName, download);
            }
        }).start();
    } else {
        dblogger.info("{} invalid login!", marketName);
        server.put("msg", SvrResult.CLIENT_ILLEGAL_LOGIN.getMsg());
        server.put("code", SvrResult.CLIENT_ILLEGAL_LOGIN.getCode());
    }
    return output.toJSONString();
}
 
Example 37
Project: wangmarket   File: AdminSiteController.java   Source Code and License 5 votes vote down vote up
/**
 * 网站详情
 * @param id News.id
 * @param model
 * @return
 */
@RequiresPermissions("adminSiteView")
@RequestMapping("view")
public String view(@RequestParam(value = "id", required = true , defaultValue="") int id, Model model){
	Site site = (Site) sqlService.findById(Site.class, id);
	
	model.addAttribute("site", site);
	return "admin/site/view";
}
 
Example 38
Project: TeamNote   File: AdminController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("/changeUserStatus")
@ResponseBody
public String changeUserStatus(@RequestParam("userId") int userId) {
    JsonObject json = new JsonObject();
    if (adminService.changeUserRole(userId) == 1) {
        json.addProperty("result", "success");
    } else {
        json.addProperty("result", "failed");
    }
    return json.toString();
}
 
Example 39
Project: csap-core   File: ServiceRequests.java   Source Code and License 5 votes vote down vote up
@RequestMapping ( KILL_URL )
public ObjectNode killServer (
								@RequestParam ( CSAP.SERVICE_PORT_PARAM ) ArrayList<String> services,
								@RequestParam ( CSAP.HOST_PARAM ) ArrayList<String> hosts,
								@RequestParam ( required = false ) String clean,
								@RequestParam ( required = false ) String keepLogs,
								HttpServletRequest request )
		throws IOException {

	String uiUser = securityConfig.getUserIdFromContext();

	logger.info( "User: {},  hosts: {}, services: {} clean: {}, keepLogs: {} ",
		uiUser, hosts, services, clean, keepLogs );

	ObjectNode resultsJson;

	if ( Application.isJvmInManagerMode() ) {

		resultsJson = serviceCommands.killRemoteRequests(
			uiUser,
			services, hosts,
			clean, keepLogs,
			csapApp.lifeCycleSettings().getAgentUser(),
			csapApp.lifeCycleSettings().getAgentPass() );

	} else {
		resultsJson = serviceCommands.killRequest( uiUser, services, clean, keepLogs, null );
	}

	return resultsJson;

}
 
Example 40
Project: renren-msg   File: MsgBatchInfoController.java   Source Code and License 5 votes vote down vote up
/**
 * 模版信息
 * @param id
 * @return
 */
@RequestMapping("/info/{batchInfoId}")
@RequiresPermissions("msg:batchInfo:info")
//从路径中取变量@PathVariable 看上面的requestMapping,指的就是后面那个同名参数
public R info(@RequestParam Map<String,Object> params,@PathVariable("batchInfoId")String batchInfoId){
	params.put("batchInfoId", batchInfoId);
	Query query = new  Query(params);
	List<MsgEntity> msgList=msgService.queryList(query);
	int total = msgService.queryTotal(params);
	PageUtils pageUtil = new PageUtils(msgList,total,query.getLimit(),query.getPage());
	return R.ok().put("page", pageUtil);
}
 
Example 41
Project: MoviesSearchPos   File: IndexController.java   Source Code and License 5 votes vote down vote up
@GetMapping("/consulta")
public ModelAndView consulta(@RequestParam("titulo") String titulo, @RequestParam("desc") String desc, @RequestParam("ano") Integer ano) {
	ModelAndView mav = new ModelAndView("/consulta");
	mav.addObject("listaFilmes", filmes.getSearchFilmes(titulo, desc, ano));
	System.out.println("Passando por consulta");
	return mav;
}
 
Example 42
Project: BecomeJavaHero   File: Greeter.java   Source Code and License 5 votes vote down vote up
@RequestMapping("/greeting")
public String greeting(
		@RequestParam(value = "name", required = false, defaultValue = "World") 
		String name, 
		Model model) {
	model.addAttribute("name", name);
	return "greeting";
}
 
Example 43
Project: MMall_JAVA   File: ProductController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("list.do")
public ServerResponse<PageInfo> list(@RequestParam(value = "keyword",required = false)String keyword,
                                     @RequestParam(value = "categoryId",required = false)Integer categoryId,
                                     @RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                     @RequestParam(value = "pageSize",defaultValue = "10") int pageSize,
                                     @RequestParam(value = "orderBy",defaultValue = "") String orderBy){
    return iProductService.getProductByKeywordCategory(keyword,categoryId,pageNum,pageSize,orderBy);
}
 
Example 44
Project: uis   File: LecturerEditCourseController.java   Source Code and License 5 votes vote down vote up
@PostMapping("/remove")
private String removeCourse(@RequestParam("courseId") Long courseId, RedirectAttributes redirectAttributes){
	
	try{
		courseService.remove(courseId);
	}catch(ValidationException|BusinessObjectNotFoundException e){
		redirectAttributes.addFlashAttribute("flashMessageNotLocalized", messages.msg("lecturer.course.remove.fail"));
        return "redirect:/lecturer/courses";
	}
	redirectAttributes.addFlashAttribute("flashMessageNotLocalized", messages.msg("lecturer.course.remove.success"));
	return "redirect:/lecturer/courses";
}
 
Example 45
Project: springboot-security-wechat   File: UserController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "重置用户密码", notes = "重置用户密码")
@RequestMapping(method = {RequestMethod.POST}, value = "/resetPassword")
@ResponseBody
public Response setPassword(@RequestParam(value = "userId") String userId,
                            HttpServletRequest request) {
    try {
        userService.resetPassword(Long.valueOf(userId));
    } catch (Exception e) {
        return errorResponse("重置失败", e.toString());
    }
    return successResponse("重置成功", null);
}
 
Example 46
Project: lemon   File: DiskInfoController.java   Source Code and License 5 votes vote down vote up
/**
 * 详情.
 */
@RequestMapping("disk-info-view")
public String view(@RequestParam("id") Long id, Model model) {
    DiskInfo diskInfo = diskInfoManager.get(id);
    model.addAttribute("diskInfo", diskInfo);

    return "disk/disk-info-view";
}
 
Example 47
Project: JenkinsHue   File: BridgeController.java   Source Code and License 5 votes vote down vote up
@Override
@RequestMapping("/{page}/{size}")
public List<BridgeDTO> findBySearchItem(@RequestParam(required = false) String searchItem, @PathVariable int page, @PathVariable int size) {
	if(searchItem == null || searchItem.isEmpty()) {
		return bridgeService.findAll(page, size);
	} else {
		return bridgeService.findBySearchItem(searchItem, page, size);
	}
}
 
Example 48
Project: zhihu-spider   File: QuestionApi.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "知乎问题删除", notes = "知乎问题删除", response = ResultDTO.class, tags = { "ZhihuQuestion", })
@ApiResponses(value = { @ApiResponse(code = 200, message = "请求删除结果", response = ResultDTO.class),
		@ApiResponse(code = 200, message = "返回错误信息", response = ResultDTO.class) })

@RequestMapping(value = "/question/delete", produces = { "application/json" }, method = RequestMethod.DELETE)
ResponseEntity<ResultDTO> questionDeleteDelete(
		@NotNull @ApiParam(value = "问题编号", required = true) @RequestParam(value = "id", required = true) String id);
 
Example 49
Project: easynetcn-cloud   File: JobServiceController.java   Source Code and License 5 votes vote down vote up
@PostMapping("")
public RestResult<Boolean> create(@RequestParam("job_class_name") String jobClassName,
		@RequestParam("job_name") String jobName, @RequestParam("job_group_name") String jobGroupName,
		@RequestParam(value = "job_description", required = false) String jobDescription,
		@RequestParam("trigger_cron_expression") String triggerCronExpression,
		@RequestParam("trigger_name") String triggerName,
		@RequestParam("trigger_group_name") String triggerGroupName,
		@RequestParam(value = "trigger_description", required = false) String triggerDescription) {
	return jobServiceClient.create(jobClassName, jobName, jobGroupName, jobDescription, triggerCronExpression,
			triggerName, triggerGroupName, triggerGroupName);
}
 
Example 50
Project: shoucang   File: PostsController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "", method = GET)
@Timed
public String index(@RequestParam(defaultValue = "1") int page, Model model) {
    if (SecurityUtils.isAuthenticated()) {
        return "redirect:/me";
    }

    return hotPosts(page, model);
}
 
Example 51
Project: apollo-custom   File: CommitController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits", method = RequestMethod.GET)
public List<CommitDTO> find(@PathVariable String appId, @PathVariable String env,
                            @PathVariable String clusterName, @PathVariable String namespaceName,
                            @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "10") int size) {

  RequestPrecondition.checkNumberPositive(size);
  RequestPrecondition.checkNumberNotNegative(page);

  return commitService.find(appId, Env.valueOf(env), clusterName, namespaceName, page, size);

}
 
Example 52
Project: lemon   File: VoteInfoController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("vote-info-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 = voteInfoManager.pagedQuery(page, propertyFilters);

    model.addAttribute("page", page);

    return "vote/vote-info-list";
}
 
Example 53
Project: lemon   File: VisitorInfoController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("visitor-info-input")
public String input(@RequestParam(value = "id", required = false) Long id,
        Model model) {
    if (id != null) {
        VisitorInfo visitorInfo = visitorInfoManager.get(id);
        model.addAttribute("model", visitorInfo);
    }

    return "visitor/visitor-info-input";
}
 
Example 54
Project: lemon   File: BpmMailTemplateController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("bpm-mail-template-list")
public String list(@ModelAttribute Page page,
        @RequestParam Map<String, Object> parameterMap, Model model) {
    List<PropertyFilter> propertyFilters = PropertyFilter
            .buildFromMap(parameterMap);
    page = bpmMailTemplateManager.pagedQuery(page, propertyFilters);
    model.addAttribute("page", page);

    return "bpm/bpm-mail-template-list";
}
 
Example 55
Project: incubator-servicecomb-java-chassis   File: MethodMixupAnnotations.java   Source Code and License 5 votes vote down vote up
@RequestMapping(
    path = "usingRequestMapping/{targetName}",
    method = {RequestMethod.POST},
    consumes = {"text/plain", "application/*"},
    produces = {"text/plain", "application/*"})
public String usingRequestMapping(@RequestBody User srcUser, @RequestHeader String header,
    @PathVariable String targetName, @RequestParam(name = "word") String word, @RequestAttribute String form) {
  return String.format("%s %s %s %s %s", srcUser.name, header, targetName, word, form);
}
 
Example 56
Project: LazyAdmin   File: RoleController.java   Source Code and License 5 votes vote down vote up
@RequiresPermissions("role:delete")
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String delete(ModelMap modelMap,
                     @RequestParam(value = "id", required = false, defaultValue = "") Long id) {
    //删除角色
    roleService.deleteRole(id);
    //删除关联关系
    roleService.deletePermissionByRole(id);
    return "redirect:/role/all";
}
 
Example 57
Project: lemon   File: SeatInfoController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("seat-info-input")
public String input(@RequestParam(value = "id", required = false) Long id,
        Model model) {
    if (id != null) {
        SeatInfo seatInfo = seatInfoManager.get(id);
        model.addAttribute("model", seatInfo);
    }

    return "seat/seat-info-input";
}
 
Example 58
Project: apollo-custom   File: ReleaseHistoryController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/releases/histories/by_release_id_and_operation", method = RequestMethod.GET)
public PageDTO<ReleaseHistoryDTO> findReleaseHistoryByReleaseIdAndOperation(
    @RequestParam("releaseId") long releaseId,
    @RequestParam("operation") int operation,
    Pageable pageable) {

  Page<ReleaseHistory> result = releaseHistoryService.findByReleaseIdAndOperation(releaseId, operation, pageable);

  return transform2PageDTO(result, pageable);
}
 
Example 59
Project: plumdo-stock   File: StockHotPlateResource.java   Source Code and License 5 votes vote down vote up
@GetMapping("/stock-hot-plates")
@ResponseStatus(HttpStatus.OK)
public PageResponse<StockHotPlate> getStockHotPlates(@RequestParam Map<String, String> allRequestParams) {
	Criteria<StockHotPlate> criteria = new Criteria<StockHotPlate>();
	criteria.add(Restrictions.like("plateName", allRequestParams.get("plateName"), true));
	criteria.add(Restrictions.gte("collectTime", ObjectUtils.convertToDate(allRequestParams.get("collectTimeBegin")), true));
	criteria.add(Restrictions.lte("collectTime", ObjectUtils.convertToDate(allRequestParams.get("collectTimeEnd")), true));
	return createPageResponse(stockHotPlateRepository.findAll(criteria, getPageable(allRequestParams)));
}
 
Example 60
Project: QuizZz   File: QuestionController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/{question_id}/correctAnswer", method = RequestMethod.POST)
@PreAuthorize("isAuthenticated()")
@ResponseStatus(HttpStatus.OK)
public void setCorrectAnswer(@PathVariable Long question_id, @RequestParam Long answer_id) {

	Question question = questionService.find(question_id);
	Answer answer = answerService.find(answer_id);
	questionService.setCorrectAnswer(question, answer);
}