javax.ws.rs.Path Java Examples

The following examples show how to use javax.ws.rs.Path. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CertificatePluginResource.java    From graviteeio-access-management with Apache License 2.0 6 votes vote down vote up
@GET
@Path("schema")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get an certificate's schema",
        notes = "There is no particular permission needed. User must be authenticated.")
public void getSchema(
        @PathParam("certificate") String certificateId,
        @Suspended final AsyncResponse response) {

    // Check that the certificate exists
    certificatePluginService.findById(certificateId)
            .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId)))
            .flatMap(irrelevant -> certificatePluginService.getSchema(certificateId))
            .switchIfEmpty(Maybe.error(new CertificatePluginSchemaNotFoundException(certificateId)))
            .map(certificatePluginSchema -> Response.ok(certificatePluginSchema).build())
            .subscribe(response::resume, response::resume);
}
 
Example #2
Source File: PersonAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "查询最近登录人员对象", action = ActionListLoginRecentObject.class)
@POST
@Path("list/login/recent/object")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listLoginRecentObject(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		JsonElement jsonElement) {
	ActionResult<List<ActionListLoginRecentObject.Wo>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionListLoginRecentObject().execute(effectivePerson, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #3
Source File: RegistAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "校验name是否已经存在", action = ActionCheckName.class)
@GET
@Path("check/name/{name}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void checkName(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("用户名") @PathParam("name") String name) {
	ActionResult<ActionCheckName.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionCheckName().execute(effectivePerson, name);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #4
Source File: I18nResource.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@DELETE
@Path("/deletedefault/{id}")
public Response deleteDefaultI18NMessage(@PathParam("id") Integer id) {
	I18NMessagesDAO I18NMessagesDAO = null;
	try {
		I18NMessagesDAO = DAOFactory.getI18NMessageDAO();
		SbiI18NMessages message = I18NMessagesDAO.getSbiI18NMessageById(id);
		I18NMessagesDAO.deleteNonDefaultI18NMessages(message);
		I18NMessagesDAO.deleteI18NMessage(id);
		String encodedI18NMessage = URLEncoder.encode("" + id, "UTF-8");
		return Response.ok().entity(encodedI18NMessage).build();
	} catch (Exception e) {
		logger.error("Error has occurred while deleting Default-Language I18NMessage", e);
		throw new SpagoBIRestServiceException("Error while deleting Default-Language I18NMessage", buildLocaleFromSession(), e);
	}
}
 
Example #5
Source File: DataAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "对指定的work添加局部data数据.", action = ActionCreateWithWorkPath0.class)
@POST
@Path("work/{id}/{path0}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void createWithWorkPath0(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0, JsonElement jsonElement) {
	ActionResult<ActionCreateWithWorkPath0.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionCreateWithWorkPath0().execute(effectivePerson, id, path0, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #6
Source File: OkrStatisticReportStatusAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "测试定时代理,对工作的汇报提交情况进行统计分析", action = ActionStReportStatusCaculateAll.class)
@GET
@Path("excute/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void excuteAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
	EffectivePerson effectivePerson = this.effectivePerson(request);
	ActionResult<WrapOutString> result = new ActionResult<>();
	try {
		result = new ActionStReportStatusCaculateAll().execute(request, effectivePerson);
	} catch (Exception e) {
		result = new ActionResult<>();
		result.error(e);
		logger.warn("system excute ExcuteStReportStatusCaculateAll got an exception. ");
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #7
Source File: GroupAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "查询群组的直接下级群组.", action = ActionListWithGroupSubDirect.class)
@POST
@Path("list/group/sub/direct")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithGroupSubDirect(@Suspended final AsyncResponse asyncResponse,
		@Context HttpServletRequest request, JsonElement jsonElement) {
	ActionResult<ActionListWithGroupSubDirect.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionListWithGroupSubDirect().execute(effectivePerson, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #8
Source File: ProcessAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "升级流程.", action = ActionUpgrade.class)
@POST
@Path("{id}/upgrade")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void upgrade(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
					@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
	ActionResult<ActionUpgrade.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionUpgrade().execute(effectivePerson, id, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #9
Source File: MemberResource.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@GET
@Path("/sort/disable")
public String sorten() {
	WhatIfEngineInstance ei = getWhatIfEngineInstance();
	SpagoBIPivotModel model = (SpagoBIPivotModel) ei.getPivotModel();
	ModelConfig modelConfig = getWhatIfEngineInstance().getModelConfig();

	model.removeSubset();

	getWhatIfEngineInstance().getModelConfig().setSortingEnabled(!modelConfig.getSortingEnabled());
	if (!modelConfig.getSortingEnabled()) {
		model.setSortCriteria(null);
		model.setSorting(false);
	}

	model.removeOrder(Axis.ROWS);
	model.removeOrder(Axis.COLUMNS);
	List<Member> a = model.getSortPosMembers1();
	a.clear();

	return renderModel(model);
}
 
Example #10
Source File: LineageREST.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
/**
 * Returns lineage info about entity.
 * @param guid - unique entity id
 * @param direction - input, output or both
 * @param depth - number of hops for lineage
 * @return AtlasLineageInfo
 * @throws AtlasBaseException
 * @HTTP 200 If Lineage exists for the given entity
 * @HTTP 400 Bad query parameters
 * @HTTP 404 If no lineage is found for the given entity
 */
@GET
@Path("/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasLineageInfo getLineageGraph(@PathParam("guid") String guid,
                                        @QueryParam("direction") @DefaultValue(DEFAULT_DIRECTION)  LineageDirection direction,
                                        @QueryParam("depth") @DefaultValue(DEFAULT_DEPTH) int depth) throws AtlasBaseException {
    AtlasPerfTracer perf = null;

    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "LineageREST.getLineageGraph(" + guid + "," + direction +
                                                           "," + depth + ")");
        }

        return atlasLineageService.getAtlasLineageInfo(guid, direction, depth);
    } finally {
        AtlasPerfTracer.log(perf);
    }
}
 
Example #11
Source File: WorkAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "流转一个流程实例,以非阻塞队列方式运行.", action = ActionProcessingNonblocking.class)
@PUT
@Path("{id}/processing/nonblocking")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void processingNonblocking(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("id") String id, JsonElement jsonElement) {
	ActionResult<ActionProcessingNonblocking.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionProcessingNonblocking().execute(effectivePerson, id, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #12
Source File: DataAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "对指定的work删除局部data数据.", action = ActionDeleteWithWorkPath3.class)
@DELETE
@Path("work/{id}/{path0}/{path1}/{path2}/{path3}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteWithWorkPath3(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("工作标识") @PathParam("id") String id,
		@JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0,
		@JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1,
		@JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2,
		@JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3) {
	ActionResult<ActionDeleteWithWorkPath3.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionDeleteWithWorkPath3().execute(effectivePerson, id, path0, path1, path2, path3);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #13
Source File: AttendanceWorkDayConfigAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "根据ID删除节假日配置信息", action = ActionDelete.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("节假日配置信息ID") @PathParam("id") String id) {
	ActionResult<ActionDelete.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	Boolean check = true;

	if (check) {
		try {
			result = new ActionDelete().execute(request, effectivePerson, id);
		} catch (Exception e) {
			result = new ActionResult<>();
			Exception exception = new ExceptionAttendanceProcess(e, "根据ID删除考勤统计需求信息时发生异常!");
			result.error(exception);
			logger.error(e, effectivePerson, request, null);
		}
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #14
Source File: TestAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "文字转换.", action = ActionExtract.class)
@POST
@Path("extract")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void extract(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@FormDataParam(FILE_FIELD) final byte[] bytes,
		@FormDataParam(FILE_FIELD) final FormDataContentDisposition disposition) {
	ActionResult<ActionExtract.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionExtract().execute(effectivePerson, bytes, disposition);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));

}
 
Example #15
Source File: OkrConfigWorkLevelAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "获取所有工作级别信息列表", action = ActionListAll.class)
@GET
@Path("all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void all(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
	EffectivePerson effectivePerson = this.effectivePerson(request);
	ActionResult<List<ActionListAll.Wo>> result = new ActionResult<>();
	try {
		result = new ActionListAll().execute(request, effectivePerson);
	} catch (Exception e) {
		result = new ActionResult<>();
		logger.warn("system excute ExcuteListAll got an exception.");
		logger.error(e, effectivePerson, request, null);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #16
Source File: RESTServiceChainObjectTest.java    From vxms with Apache License 2.0 6 votes vote down vote up
@Path("/basicTestAndThen")
@GET
public void basicTestAndThen(RestHandler reply) {
  System.out.println("basicTestAndThen: " + reply);
  reply
      .response()
      .<Integer>supply(
          (future) -> {
            future.complete(1);
          })
      .<String>andThen(
          (value, future) -> {
            future.complete(value + 1 + "");
          })
      .mapToObjectResponse(
          (val, future) -> {
            Payload<String> pp = new Payload<>(val + " final");
            future.complete(pp);
          },
          new ExampleByteEncoder())
      .execute();
}
 
Example #17
Source File: AdminResource.java    From digdag with Apache License 2.0 6 votes vote down vote up
@Deprecated
@GET
@Path("/api/admin/attempts/{id}/userinfo")
@ApiOperation("(deprecated)")
public Config getUserInfo(@PathParam("id") long id)
        throws ResourceNotFoundException
{
    return tm.begin(() -> {
        StoredSessionAttemptWithSession session = sm.getAttemptWithSessionById(id);

        if (!session.getWorkflowDefinitionId().isPresent()) {
            // TODO: is 404 appropriate in this situation?
            throw new NotFoundException();
        }

        StoredRevision revision = pm.getRevisionOfWorkflowDefinition(session.getWorkflowDefinitionId().get());

        return revision.getUserInfo();
    }, ResourceNotFoundException.class);
}
 
Example #18
Source File: PersonAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "判断个人是否拥有指定角色中的一个或者多个", action = ActionHasRole.class)
@POST
@Path("has/role")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void hasRole(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		JsonElement jsonElement) {
	ActionResult<ActionHasRole.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionHasRole().execute(effectivePerson, jsonElement);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, jsonElement);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #19
Source File: DataAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "对指定的document删除局部data数据.", action = ActionDeleteWithDocumentPath7.class)
@DELETE
@Path("document/{id}/{path0}/{path1}/{path2}/{path3}/{path4}/{path5}/{path6}/{path7}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteWithDocumentWithPath7(@Suspended final AsyncResponse asyncResponse,
		@Context HttpServletRequest request, @JaxrsParameterDescribe("文档ID") @PathParam("id") String id,
		@JaxrsParameterDescribe("0级路径") @PathParam("path0") String path0,
		@JaxrsParameterDescribe("1级路径") @PathParam("path1") String path1,
		@JaxrsParameterDescribe("2级路径") @PathParam("path2") String path2,
		@JaxrsParameterDescribe("3级路径") @PathParam("path3") String path3,
		@JaxrsParameterDescribe("4级路径") @PathParam("path4") String path4,
		@JaxrsParameterDescribe("5级路径") @PathParam("path5") String path5,
		@JaxrsParameterDescribe("6级路径") @PathParam("path6") String path6,
		@JaxrsParameterDescribe("7级路径") @PathParam("path7") String path7) {
	ActionResult<ActionDeleteWithDocumentPath7.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionDeleteWithDocumentPath7().execute(effectivePerson, id, path0, path1, path2, path3, path4,
				path5, path6, path7);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #20
Source File: TableAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "根据标识获取表.", action = ActionGet.class)
@GET
@Path("{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("标识") @PathParam("flag") String flag) {
	ActionResult<ActionGet.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionGet().execute(effectivePerson, flag);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #21
Source File: SQLResource.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/analyze/suggest")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public SuggestionResponse suggestSQL(AnalyzeRequest analyzeRequest) {
  final String sql = analyzeRequest.getSql();
  final List<String> context = analyzeRequest.getContext();
  final int cursorPosition = analyzeRequest.getCursorPosition();

  // Setup dependencies and execute suggestion acquisition
  SQLAnalyzer SQLAnalyzer =
    SQLAnalyzerFactory.createSQLAnalyzer(
      securityContext.getUserPrincipal().getName(), sabotContext, context, true, projectOptionManager);

  List<SqlMoniker> sqlEditorHints = SQLAnalyzer.suggest(sql, cursorPosition);

  // Build response object and return
  return buildSuggestionResponse(sqlEditorHints);
}
 
Example #22
Source File: UnitAttributeAction.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@JaxrsMethodDescribe(value = "获取组织属性对象.", action = ActionGet.class)
@GET
@Path("{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
		@JaxrsParameterDescribe("组织属性标识") @PathParam("flag") String id) {
	ActionResult<ActionGet.Wo> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	try {
		result = new ActionGet().execute(effectivePerson, id);
	} catch (Exception e) {
		logger.error(e, effectivePerson, request, null);
		result.error(e);
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #23
Source File: GolangGroupRepositoriesApiResource.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@ApiOperation("Update a Go group repository")
@ApiResponses(value = {
    @ApiResponse(code = 204, message = REPOSITORY_UPDATED),
    @ApiResponse(code = 401, message = AUTHENTICATION_REQUIRED),
    @ApiResponse(code = 403, message = INSUFFICIENT_PERMISSIONS),
    @ApiResponse(code = 404, message = REPOSITORY_NOT_FOUND)
})
@PUT
@Path("/{repositoryName}")
@RequiresAuthentication
@Validate
@Override
public Response updateRepository(
    final GolangGroupRepositoryApiRequest request,
    @ApiParam(value = "Name of the repository to update") @PathParam("repositoryName") final String repositoryName)
{
  return super.updateRepository(request, repositoryName);
}
 
Example #24
Source File: ConnectorEndpoint.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{connectorId}/actions/{actionId}")
public SyndesisMetadata actions(@PathParam("connectorId") final String connectorId, @PathParam("actionId") final String actionId,
                                final Map<String, Object> properties) {
    MetadataRetrieval adapter = findAdapter(connectorId);
    try {
        return adapter.fetch(camelContext, connectorId, actionId, properties);
    } catch (RuntimeException e) {
        LOGGER.error("Unable to fetch and process metadata for connector: {}, action: {}", connectorId, actionId);
        LOGGER.debug("Unable to fetch and process metadata for connector: {}, action: {}, properties: {}", connectorId, actionId,
            properties, e);
        throw adapter.handle(e);
    }
}
 
Example #25
Source File: ModeratorsController.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@POST
@Path(ToolboxModeratorManagementClient.ADD_ADMIN_PATH)
@RolesAllowed(UserRole.ADMIN)
public Response setAdmin(
    @Auth final AuthenticatedUser authenticatedUser, final String moderatorName) {
  moderatorsService.addAdmin(authenticatedUser.getUserIdOrThrow(), moderatorName);
  return Response.ok().build();
}
 
Example #26
Source File: PermissionsService.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@GET
@Path("/{domain}")
@Produces(APPLICATION_JSON)
@ApiOperation(
    value = "Get permissions of current user which are related to specified domain and instance",
    response = PermissionsDto.class)
@ApiResponses({
  @ApiResponse(code = 200, message = "The permissions successfully fetched"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(code = 404, message = "Specified domain is unsupported"),
  @ApiResponse(
      code = 404,
      message = "Permissions for current user with specified domain and instance was not found"),
  @ApiResponse(
      code = 409,
      message = "Given domain requires non nullable value for instance but it is null"),
  @ApiResponse(code = 500, message = "Internal server error occurred during permissions fetching")
})
public PermissionsDto getCurrentUsersPermissions(
    @ApiParam(value = "Domain id to retrieve user's permissions") @PathParam("domain")
        String domain,
    @ApiParam(value = "Instance id to retrieve user's permissions") @QueryParam("instance")
        String instance)
    throws BadRequestException, NotFoundException, ConflictException, ServerException {
  instanceValidator.validate(domain, instance);
  return toDto(
      permissionsManager.get(
          EnvironmentContext.getCurrent().getSubject().getUserId(), domain, instance));
}
 
Example #27
Source File: RMWebServices.java    From big-c with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/get-node-labels")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public NodeLabelsInfo getClusterNodeLabels(@Context HttpServletRequest hsr) 
  throws IOException {
  init();

  NodeLabelsInfo ret = 
    new NodeLabelsInfo(rm.getRMContext().getNodeLabelManager()
      .getClusterNodeLabels());

  return ret;
}
 
Example #28
Source File: UpdateAccountController.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path(UserAccountClient.FETCH_EMAIL_PATH)
@RolesAllowed(UserRole.PLAYER)
public FetchEmailResponse fetchEmail(@Auth final AuthenticatedUser authenticatedUser) {
  Preconditions.checkArgument(authenticatedUser.getUserIdOrThrow() > 0);

  return new FetchEmailResponse(
      userAccountService.fetchEmail(authenticatedUser.getUserIdOrThrow()));
}
 
Example #29
Source File: SubjectInfoAction.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
@JaxrsMethodDescribe(value = "列示根据过滤条件的精华主题列表.", action = ActionSubjectListCreamedForPages.class)
@PUT
@Path("creamed/list/page/{page}/count/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listCreamedSubjectForPage(@Suspended final AsyncResponse asyncResponse,
		@Context HttpServletRequest request, @JaxrsParameterDescribe("显示页码") @PathParam("page") Integer page,
		@JaxrsParameterDescribe("每页显示条目数量") @PathParam("count") Integer count, JsonElement jsonElement) {
	ActionResult<List<ActionSubjectListCreamedForPages.Wo>> result = new ActionResult<>();
	EffectivePerson effectivePerson = this.effectivePerson(request);
	Boolean check = true;
	if (check) {
		if (page == null) {
			page = 1;
		}
	}
	if (check) {
		if (count == null) {
			count = 20;
		}
	}
	if (check) {
		try {
			result = new ActionSubjectListCreamedForPages().execute(request, effectivePerson, page, count,
					jsonElement);
		} catch (Exception e) {
			result = new ActionResult<>();
			Exception exception = new ExceptionRoleInfoProcess(e, "列示根据过滤条件的精华主题列表时发生异常!");
			result.error(exception);
			logger.error(e, effectivePerson, request, null);
		}
	}
	asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
 
Example #30
Source File: RestDocumentService.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@POST
@Path("/reindex")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value="Re-indexes a document", notes = "re-indexes(or indexes from scratch) a document")
public void reindex(
		@FormParam("doc1") @ApiParam(value = "Document ID", required = true) long docId, 
		@FormParam("content") @ApiParam(value = "Document ID") String content) 
				throws Exception 
{
	String sid = validateSession();
	super.reindex(sid, docId, content);
}