@GET @Path("find") @Produces(MediaType.APPLICATION_JSON) public Response find() { JsonArray build = null; try { build = adminClinicService.get().stream().map(h -> Json.createObjectBuilder() .add("firstname", h.getPersonId().getFirstName()) .add("lastname", h.getPersonId().getLastName()) .add("id", h.getAdminClinicId()) .build()) .collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add) .build(); } catch (Exception ex) { return Response.ok().header("Exception", ex.getMessage()).build(); } return Response.ok().entity(build == null ? "No data found" : build).build(); }
@GET @Path("find") @Produces(MediaType.APPLICATION_JSON) public Response find() { JsonArray build = null; try { build = countryService.get().stream().map(h -> Json.createObjectBuilder() .add("id", h.getCountryId()) .add("name", h.getCountryName()) .build()) .collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add) .build(); } catch (Exception ex) { return Response.ok().header("Exception", ex.getMessage()).build(); } return Response.ok().entity(build == null ? "No data found" : build).build(); }
@GET @Path("{planId}") @Produces({ MediaType.TEXT_HTML }) public Response getPlanAsHtml( @PathParam("serviceProviderId") final String serviceProviderId, @PathParam("planId") final String planId ) throws ServletException, IOException, URISyntaxException { // Start of user code getPlanAsHtml_init // End of user code final Plan aPlan = PlannerReasonerManager.getPlan(httpServletRequest, serviceProviderId, planId); if (aPlan != null) { httpServletRequest.setAttribute("aPlan", aPlan); // Start of user code getPlanAsHtml_setAttributes // End of user code RequestDispatcher rd = httpServletRequest.getRequestDispatcher("/se/ericsson/cf/scott/sandbox/plan.jsp"); rd.forward(httpServletRequest,httpServletResponse); } throw new WebApplicationException(Status.NOT_FOUND); }
@GET @Path("/verifyExpiration") @Produces(MediaType.APPLICATION_JSON) public JsonObject verifyExpiration(@QueryParam("exp") Long exp) { boolean pass = false; String msg; // exp Long expValue = rawTokenJson.getExpirationTime(); if (expValue == null || expValue.intValue() == 0) { msg = Claims.exp.name() + "value is null or empty, FAIL"; } else if (expValue.equals(exp)) { msg = Claims.exp.name() + " PASS"; pass = true; } else { msg = String.format("%s: %s != %s", Claims.exp.name(), expValue, exp); } JsonObject result = Json.createObjectBuilder() .add("pass", pass) .add("msg", msg) .build(); return result; }
@GET @Produces({"application/xml", "application/json"}) @Path("/recent/region/producttype/{regionName}/{productTypeId}/{orderLineId}") public List<LiveSalesList> findRecentRegionProductTypeFrom(@PathParam("regionName") String regionName, @PathParam("productTypeId") Integer productTypeId, @PathParam("orderLineId") Integer orderLineId) { CriteriaBuilder cb = getEntityManager().getCriteriaBuilder(); javax.persistence.criteria.CriteriaQuery cq = cb.createQuery(); Root<LiveSalesList> liveSalesList = cq.from(LiveSalesList.class); cq.select(liveSalesList); cq.where(cb.and( cb.equal(liveSalesList.get(LiveSalesList_.productTypeId), productTypeId), cb.equal(liveSalesList.get(LiveSalesList_.region), regionName), cb.gt(liveSalesList.get(LiveSalesList_.orderLineId), orderLineId) )); Query q = getEntityManager().createQuery(cq); q.setMaxResults(500); return q.getResultList(); }
@GET @Path("/apps/{appid}") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public AppInfo getApp(@Context HttpServletRequest hsr, @PathParam("appid") String appId) { init(); if (appId == null || appId.isEmpty()) { throw new NotFoundException("appId, " + appId + ", is empty or null"); } ApplicationId id; id = ConverterUtils.toApplicationId(recordFactory, appId); if (id == null) { throw new NotFoundException("appId is null"); } RMApp app = rm.getRMContext().getRMApps().get(id); if (app == null) { throw new NotFoundException("app with id: " + appId + " not found"); } return new AppInfo(rm, app, hasAccess(app, hsr), hsr.getScheme() + "://"); }
@GET @Path(KMSRESTConstants.KEYS_METADATA_RESOURCE) @Produces(MediaType.APPLICATION_JSON) public Response getKeysMetadata(@QueryParam(KMSRESTConstants.KEY) List<String> keyNamesList) throws Exception { KMSWebApp.getAdminCallsMeter().mark(); UserGroupInformation user = HttpUserGroupInformation.get(); final String[] keyNames = keyNamesList.toArray( new String[keyNamesList.size()]); assertAccess(KMSACLs.Type.GET_METADATA, user, KMSOp.GET_KEYS_METADATA); KeyProvider.Metadata[] keysMeta = user.doAs( new PrivilegedExceptionAction<KeyProvider.Metadata[]>() { @Override public KeyProvider.Metadata[] run() throws Exception { return provider.getKeysMetadata(keyNames); } } ); Object json = KMSServerJSONUtils.toJSON(keyNames, keysMeta); kmsAudit.ok(user, KMSOp.GET_KEYS_METADATA, ""); return Response.ok().type(MediaType.APPLICATION_JSON).entity(json).build(); }
@GET @Traced(operationName = "find_tweets") //Tracing instrumentation @Timed //Metrics instrumentation public Response findTweets() { try { final List<TweetRepresentation> tweetRepresentations = tweetsService.findTweets(new TweetsQuery()) .stream() .map(Tweet::printRepresentation) .collect(toList()); final TweetsRepresentation tweetsRepresentation = new TweetsRepresentation(); tweetsRepresentation.setTweets(tweetRepresentations); return Response.ok(tweetsRepresentation).build(); } catch (Exception e) { e.printStackTrace(); return Response.serverError().entity(e.getMessage()).build(); } }
@GET @Path("find") @Produces(MediaType.APPLICATION_JSON) public Response find() { JsonArray build = null; try { build = cityService.get().stream().map(h -> Json.createObjectBuilder() .add("id", h.getCityId()) .add("name", h.getCityName()) .build()) .collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add) .build(); } catch (Exception ex) { return Response.ok().header("Exception", ex.getMessage()).build(); } return Response.ok().entity(build == null ? "No data found" : build).build(); }
@Path("/{inspectionHookId}") @GET public InspectionHookEntity getInspectionHook(@PathParam("controllerId") String controllerId, @PathParam("inspectionHookId") String inspectionHookId) throws Exception { LOG.info("Getting the inspection hook element for id {} ", inspectionHookId); SampleSdnRedirectionApi sdnApi = ((SampleSdnRedirectionApi) this.api .createRedirectionApi(new VirtualizationConnectorElementImpl("Sample", controllerId), "TEST")); InspectionHookEntity inspectionHook = (InspectionHookEntity) sdnApi.getInspectionHook(inspectionHookId); inspectionHook.setInspectedPort(null); inspectionHook.setInspectionPort(null); return inspectionHook; }
@GET @Path("/containers") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public ContainersInfo getNodeContainers() { init(); ContainersInfo allContainers = new ContainersInfo(); for (Entry<ContainerId, Container> entry : this.nmContext.getContainers() .entrySet()) { if (entry.getValue() == null) { // just skip it continue; } ContainerInfo info = new ContainerInfo(this.nmContext, entry.getValue(), uriInfo.getBaseUri().toString(), webapp.name()); allContainers.add(info); } return allContainers; }
@ApiOperation(value = "Retrieves the Distributed Appliance Instance", notes = "Retrieves a Distributed Appliance Instance specified by the Id", response = DistributedApplianceDto.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{distributedApplianceInstanceId}") @GET public DistributedApplianceInstanceDto getDistributedApplianceInstance(@Context HttpHeaders headers, @ApiParam(value = "The Id of the Distributed Appliance Instance", required = true) @PathParam("distributedApplianceInstanceId") Long distributedApplianceInstanceId) { logger.info("Getting Distributed Appliance Instance " + distributedApplianceInstanceId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest(); getDtoRequest.setEntityId(distributedApplianceInstanceId); getDtoRequest.setEntityName("DistributedApplianceInstance"); GetDtoFromEntityServiceApi<DistributedApplianceInstanceDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(DistributedApplianceInstanceDto.class); return this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto(); }
@GET @Path("usuarios") public List<UsuarioDetailDTO> getUsuariosGuias(@QueryParam("guias")int g ){ List<UsuarioDetailDTO> lista = new ArrayList<UsuarioDetailDTO>(); List<UsuarioDetailDTO> lista1 = listEntity2DTO(usuarioLogic.getUsuarios()); for (UsuarioDetailDTO usuario : lista1 ) { if (usuario.getGuia()!=null) { if (usuario.getGuia().booleanValue()) { lista.add(usuario); } } } if (g == 1 ) { return lista; } else { return lista1; } }
@ApiOperation(value = "Retrieves the Deployment Specification", notes = "Retrieves a Deployment Specification specified by its owning Virtual System and Deployment Spec Id", response = ApplianceManagerConnectorDto.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{vsId}/deploymentSpecs/{dsId}") @GET public DeploymentSpecDto getDeploymentSpec(@Context HttpHeaders headers, @ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId, @ApiParam(value = "The Deployment Specification Id") @PathParam("dsId") Long dsId) { logger.info("getting Deployment Spec " + dsId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest(); getDtoRequest.setEntityId(dsId); getDtoRequest.setEntityName("DeploymentSpec"); GetDtoFromEntityServiceApi<DeploymentSpecDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(DeploymentSpecDto.class); DeploymentSpecDto dto = this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto(); this.apiUtil.validateParentIdMatches(dto, vsId, "SecurityGroup"); return dto; }
@GET @Produces(MediaType.APPLICATION_JSON) public ResourceIndex index(@Context Application application, @Context HttpServletRequest request) throws Exception { // String basePath = request.getRequestURL().toString(); return new ResourceIndex(IndexResource.getResourceIndexNode(JournalResource.class, request)); // basePath)); }
@GET @Path("/{id}") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response getOfficeSite(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id);
@GET @Secured @Path("/GetPersonaPresenceByName") @Produces(MediaType.APPLICATION_XML) public String getPersonaPresenceByName(@QueryParam("displayName") String displayName) { PersonaPresence personaPresenceByName = bo.getPersonaPresenceByName(displayName); if (personaPresenceByName.getPersonaId() == 0) { return ""; } return MarshalXML.marshal(personaPresenceByName); }
/** * Return a specific configuration. System properties overrides the value from the database. Configuration values * are * always encrypted. * * @param name * The requested parameter name. * @return a specific configuration. May be <code>null</code>. */ @GET @CacheResult(cacheName = "configuration") public String get(@CacheKey final String name) { String value = System.getProperty(name); if (value == null) { value = Optional.ofNullable(repository.findByName(name)).map(SystemConfiguration::getValue).orElse(null); } return Optional.ofNullable(value).map(cryptoHelper::decryptAsNeeded).orElse(null); }
@GET @Path("/aggregations/terms/{queryString}") public Response getAggregationsUrl(@PathParam("queryString") @NotNull String query) { EsAggregation aggregation = new EsAggregation(); aggregation.setQuery(query); return getAggregations(aggregation); }
@GET @Produces({ MediaType.APPLICATION_JSON }) @Path("{id}/files") public Page<FileOutVO> getFiles(@PathParam("id") Long id, @Context UriInfo uriInfo) throws AuthenticationException, AuthorisationException, ServiceException { PSFUriPart psf; return new Page<FileOutVO>(WebUtil.getServiceLocator().getFileService().getFiles(auth, fileModule, id, null, null, psf = new PSFUriPart(uriInfo)), psf); }
@GET @Path("subscribe") @Produces(MediaType.SERVER_SENT_EVENTS) public void subscribe(@Context SseEventSink eventSink, @Context Sse sse){ eventSink.send(sse.newEvent("Welcome to the List!")); eventSink.send(sse.newEvent("Message One!")); eventSink.send(sse.newEvent("SERVER-NOTIFICATION", "Message Two!")); eventSink.send(sse.newEventBuilder() .comment("Nice Test") .name("SERVER-TEST") .data("Some data...could be an object") .build()); eventSink.close(); }
@GET @Path("/{group}") @PermitAll @Timed(name = "getFeatures") public Response getFeatures( @Auth AuthPrincipal principal, @PathParam("group") String group ) throws AuthenticationException { final long start = System.currentTimeMillis(); grantedGuard(principal, group); return this.headers.enrich(Response.ok(featureService.loadFeatures(group)), start).build(); }
/** * Returns all in votes of a given contentId Element * @param contentId to get the in votes of * @param con Connection to use - is injected automatically * @return a list of Users that voted in for the given contentid */ @GET @Path("/ins") public Response getInsOfContentId(@PathParam("contentId") final long contentId, @Context final Connection con){ final ContentVoteDao dao = new ContentVoteDao(con); final List<User> insOfUsers= dao.getUsersThatVotedInOfContentId(contentId); return ok(UserUtil.toModels(insOfUsers, true)); }
@GET @Path("/cluster/{id}") @Produces(MediaType.APPLICATION_JSON) public ClusterResponse getClusterInfo(@PathParam("id") final String id) throws Exception { ClusterEnriched cluster = service.getClusterInfo(new ClusterId(id)); return toClusterResponse(cluster); }
@Override @GET @Path("/count/consensus") @Produces(MediaType.APPLICATION_JSON) public RpcResult getConsensusCount() { return RpcResult.getSuccess(); }
@GET @Path("/runtime") @Produces("application/json") public ArrayList<ServiceData> getRuntimeInfo() { try { logger.fine("Getting Runtime info"); ArrayList<ServiceData> list = new ArrayList<ServiceData>(); ServiceData data = new ServiceData(); data.name = "Runtime"; data.description = "Java"; list.add(data); data = new ServiceData(); data.name = "Version"; data.description = System.getProperty("java.version"); list.add(data); data = new ServiceData(); data.name = "Vendor"; data.description = System.getProperty("java.vendor"); list.add(data); return list; } catch (Exception e) { e.printStackTrace(); return null; } }
@GET @Consumes("text/plain") @Produces("text/plain") @Path("diameter_application_id_whitelist_remove") public String diameter_application_id_whitelist_remove(@MatrixParam("ai") int ai) { DiameterFirewallConfig.diameter_application_id_whitelist.remove((new Integer(ai)).toString()); return "Successful"; }
/** * Only return the public keys. * * @return public key set. */ @ApiOperation(value = "Get public keys", response = Response.class, notes = "Provides the JWKS of public keys used for JWS and JWE for clients.") @GET @Produces(MediaType.APPLICATION_JSON) public String getPublicKeySet() { return cachedDataProvider.getKeySet().toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY); }
@GET @Path("/apps/{appid}/appattempts/{appattemptid}/containers/{containerid}") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Override public ContainerInfo getContainer(@Context HttpServletRequest req, @Context HttpServletResponse res, @PathParam("appid") String appId, @PathParam("appattemptid") String appAttemptId, @PathParam("containerid") String containerId) { init(res); return super.getContainer(req, res, appId, appAttemptId, containerId); }
@GET @Path("/{connector}/config") public Map<String, String> getConnectorConfig(final @PathParam("connector") String connector, final @QueryParam("forward") Boolean forward) throws Throwable { FutureCallback<Map<String, String>> cb = new FutureCallback<>(); herder.connectorConfig(connector, cb); return completeOrForwardRequest(cb, "/connectors/" + connector + "/config", "GET", null, forward); }
/** * process OPTIONS Method. * @return JAX-RS response object */ @OPTIONS public Response options() { // Check exist checkFileExists(); // Access Control davRsCmp.getParent().checkAccessContext(davRsCmp.getAccessContext(), CellPrivilege.ROOT); return PersoniumCoreUtils.responseBuilderForOptions( HttpMethod.GET, HttpMethod.PUT, HttpMethod.DELETE, io.personium.common.utils.PersoniumCoreUtils.HttpMethod.PROPFIND ).build(); }
@GET @Path(Urls.ConfigUrls.IDP_CONFIG_DATA) @Timed public IdpConfigDto getIdpConfig(@PathParam(Urls.SharedUrls.ENTITY_ID_PARAM) String entityId) { IdentityProviderConfigEntityData idpData = getIdentityProviderConfigData(entityId); return new IdpConfigDto( idpData.getSimpleId(), idpData.isEnabled(), idpData.getSupportedLevelsOfAssurance(), idpData.getUseExactComparisonType() ); }
@GET @Path("/{id}") public Response getUser(@PathParam("id") long id) { User user = users.findUser(id); if (user != null) { return Response.status(Response.Status.ACCEPTED).entity(user).build(); } return Response.status(Response.Status.NOT_FOUND).build(); }
/** * Returns all meters of all devices. * * @return 200 OK with array of all the meters in the system * @onos.rsModel Meters */ @GET @Produces(MediaType.APPLICATION_JSON) public Response getMeters() { final Iterable<Meter> meters = meterService.getAllMeters(); if (meters != null) { meters.forEach(meter -> metersNode.add(codec(Meter.class).encode(meter, this))); } return ok(root).build(); }
@GET @Path("/{uuid}/{version}") @ApiOperation(value = "Get information about an item", response = ItemBean.class) public ItemBean getItem( // @formatter:off @Context UriInfo uriInfo, @ApiParam(APIDOC_ITEMUUID) @PathParam("uuid") String uuid, @ApiParam(APIDOC_ITEMVERSION) @PathParam("version") int version, @ApiParam(value = "How much information to return for the item", required = false, allowableValues = ALL_ALLOWABLE_INFOS, allowMultiple = true) @QueryParam("info") CsvList info);
@GET @Path("/{n}") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response read(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @DefaultValue("0") @PathParam("n") int n);
/** * Returns control message metrics of a given device. * * @param deviceId device identification * @return control message metrics of a given device * @onos.rsModel ControlMessageMetric */ @GET @Produces(MediaType.APPLICATION_JSON) @Path("messages/{deviceId}") public Response controlMessageMetrics(@PathParam("deviceId") String deviceId) { metricsStats(monitorService, localNodeId, CONTROL_MESSAGE_METRICS, DeviceId.deviceId(deviceId), root); return ok(root).build(); }
@GET public List<String> getPortIds(@PathParam("controllerId") String controllerId) throws Exception { LOG.info("Listing port elements ids'"); SampleSdnRedirectionApi sdnApi = ((SampleSdnRedirectionApi) this.api .createRedirectionApi(new VirtualizationConnectorElementImpl("Sample", controllerId), "TEST")); return sdnApi.getPortIds(); }
@GET @Path("/{nickname}/details-qr") @Produces("image/png") public Response deviceDetailsLinkQrCode( @PathParam("nickname") final String nickname, @QueryParam("baseUrl") @DefaultValue(DEFAULT_BASE_URL) final String baseUrl ) throws IOException { final byte[] detailsQr = qrCodeAsPng(baseUrl, nickname, ""); return Response.ok(new ByteArrayInputStream(detailsQr)).build(); }
@PermitAll @GET @Path("/anyrole") @Produces(MediaType.TEXT_PLAIN) public String getAnyRole() { return "anyrole"; }