本文整理汇总了Java中javax.ws.rs.core.GenericEntity类的典型用法代码示例。如果您正苦于以下问题:Java GenericEntity类的具体用法?Java GenericEntity怎么用?Java GenericEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GenericEntity类属于javax.ws.rs.core包,在下文中一共展示了GenericEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: status
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
/**
Returns the status of each health check.
@return 200
*/
@GET
@Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8")
@Path("status")
public Response status()
{
List<String> messages = new ArrayList<String>();
for (HealthStatus healthCheck : m_healthCheckService.getChecks())
{
HealthCheck.Result result = healthCheck.execute();
if (result.isHealthy())
{
messages.add(healthCheck.getName() + ": OK");
}
else
{
messages.add(healthCheck.getName() + ": FAIL");
}
}
GenericEntity<List<String>> entity = new GenericEntity<List<String>>(messages)
{
};
return setHeaders(Response.ok(entity)).build();
}
示例2: getConversations
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@Path("conversations")
@Secure
public Response getConversations() {
List<Conversation> conversations = new ArrayList<>();
Cursor cur = deskDroidService.getApplication().getContentResolver()
.query(Telephony.Sms.Conversations.CONTENT_URI, null, null, null, null);
while (cur.moveToNext()) {
conversations.add(buildConversation(cur));
}
cur.close();
Collections.sort(conversations, new ConversationComparator());
return Response.ok(new GenericEntity<List<Conversation>>(conversations) {
}).build();
}
示例3: toResponse
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@Override
public Response toResponse(JaxbException exception) {
int errorCode = 1;
String errorMsg = "JAXB convert/validate error, please check your input data";
if (config != null) {
Object propErrorCode = config.getProperty(PROP_JAXB_DEFAULT_ERROR_CODE);
Object propErrorMsg = config.getProperty(PROP_JAXB_DEFAULT_ERROR_MSG);
if (propErrorCode != null) {
errorCode = Integer.valueOf(propErrorCode.toString());
}
if (propErrorMsg != null) {
errorMsg = propErrorMsg.toString();
}
}
List<JaxbError> errors = new ArrayList<>();
errors.add(new JaxbError(exception.getMessage()));
ParsecErrorResponse<JaxbError> errorResponse = ValidateUtil.buildErrorResponse(errors, errorCode, errorMsg);
return Response.status(Response.Status.BAD_REQUEST)
.entity(new GenericEntity<ParsecErrorResponse<JaxbError>>(errorResponse) { }).build();
}
示例4: getProviders
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@Path("/providers")
@ApiOperation(value = "Get supported providers",
response = OAuthProviderPublicDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of providers. It can be an empty list."),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getProviders() {
List<OAuthProvider> providers = oAuthManager.getProviders();
List<OAuthProviderPublicDTO> dtos = new ArrayList<>();
for (OAuthProvider provider : providers) {
OAuthProviderPublicDTO oAuthProviderPublicDTO = mapper.map(provider, OAuthProviderPublicDTO.class);
oAuthProviderPublicDTO.setSigningKeys(getSigningKeys(provider.getJwkSetURL()));
dtos.add(oAuthProviderPublicDTO);
}
// need to get jwks signing keys (they can be changed)
return Response.ok(new GenericEntity<List<OAuthProviderPublicDTO>>(dtos) {
}).build();
}
示例5: getDetailedProviders
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@Path("providers")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of auth providers"),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@ApiOperation(value = "Get detailed providers",
response = OAuthProviderDTO.class,
responseContainer = "List")
@Produces(MediaType.APPLICATION_JSON)
public Response getDetailedProviders() {
List<OAuthProvider> providers = oAuthManager.getProviders();
List<OAuthProviderDTO> dtos = new ArrayList<>();
for (OAuthProvider provider : providers) {
dtos.add(mapper.map(provider, OAuthProviderDTO.class));
}
return Response.ok(new GenericEntity<List<OAuthProviderDTO>>(dtos) {
}).build();
}
示例6: getProductInstanceIterations
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get product-instance's iterations",
response = ProductInstanceIterationDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of ProductInstanceMasterDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Path("{ciId}/instances/{serialNumber}/iterations")
@Produces(MediaType.APPLICATION_JSON)
public Response getProductInstanceIterations(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
@ApiParam(required = true, value = "Configuration item id") @PathParam("ciId") String configurationItemId,
@ApiParam(required = true, value = "Serial number") @PathParam("serialNumber") String serialNumber)
throws EntityNotFoundException, UserNotActiveException {
List<ProductInstanceIteration> productInstanceIterationList = productInstanceService.getProductInstanceIterations(new ProductInstanceMasterKey(serialNumber, workspaceId, configurationItemId));
List<ProductInstanceIterationDTO> productInstanceIterationDTOs = new ArrayList<>();
for (ProductInstanceIteration productInstanceIteration : productInstanceIterationList) {
ProductInstanceIterationDTO productInstanceIterationDTO = mapper.map(productInstanceIteration, ProductInstanceIterationDTO.class);
productInstanceIterationDTOs.add(productInstanceIterationDTO);
}
return Response.ok(new GenericEntity<List<ProductInstanceIterationDTO>>((List<ProductInstanceIterationDTO>) productInstanceIterationDTOs) {
}).build();
}
示例7: getMembers
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@Path("members")
@ApiOperation(value = "Get members of the authenticated user's organization",
response = AccountDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of AccountDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getMembers()
throws AccountNotFoundException, OrganizationNotFoundException, AccessRightException {
Organization organization = organizationManager.getMyOrganization();
List<Account> accounts = organization.getMembers();
List<AccountDTO> accountsDTOs = new ArrayList<>();
for (Account account : accounts) {
accountsDTOs.add(mapper.map(account, AccountDTO.class));
}
return Response.ok(new GenericEntity<List<AccountDTO>>((List<AccountDTO>) accountsDTOs) {
}).build();
}
示例8: getOrders
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get orders for given parameters",
response = ChangeOrderDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of ChangeOrderDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getOrders(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId)
throws EntityNotFoundException, UserNotActiveException {
List<ChangeOrder> changeOrders = changeManager.getChangeOrders(workspaceId);
List<ChangeOrderDTO> changeOrderDTOs = new ArrayList<>();
for (ChangeOrder order : changeOrders) {
ChangeOrderDTO changeOrderDTO = mapper.map(order, ChangeOrderDTO.class);
changeOrderDTO.setWritable(changeManager.isChangeItemWritable(order));
changeOrderDTOs.add(changeOrderDTO);
}
return Response.ok(new GenericEntity<List<ChangeOrderDTO>>((List<ChangeOrderDTO>) changeOrderDTOs) {
}).build();
}
示例9: getTagsInWorkspace
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get tags in workspace",
response = TagDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of TagDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getTagsInWorkspace(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId)
throws EntityNotFoundException, UserNotActiveException {
String[] tagsName = documentService.getTags(workspaceId);
List<TagDTO> tagsDTO = new ArrayList<>();
for (String tagName : tagsName) {
tagsDTO.add(new TagDTO(tagName, workspaceId));
}
return Response.ok(new GenericEntity<List<TagDTO>>((List<TagDTO>) tagsDTO) {
}).build();
}
示例10: getMilestones
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get milestones for given parameters",
response = MilestoneDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of MilestoneDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getMilestones(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId)
throws EntityNotFoundException, UserNotActiveException {
List<Milestone> milestones = changeManager.getMilestones(workspaceId);
List<MilestoneDTO> milestoneDTOs = new ArrayList<>();
for (Milestone milestone : milestones) {
MilestoneDTO milestoneDTO = mapper.map(milestone, MilestoneDTO.class);
milestoneDTO.setWritable(changeManager.isMilestoneWritable(milestone));
milestoneDTO.setNumberOfRequests(changeManager.getNumberOfRequestByMilestone(milestone.getWorkspaceId(), milestone.getId()));
milestoneDTO.setNumberOfOrders(changeManager.getNumberOfOrderByMilestone(milestone.getWorkspaceId(), milestone.getId()));
milestoneDTOs.add(milestoneDTO);
}
return Response.ok(new GenericEntity<List<MilestoneDTO>>((List<MilestoneDTO>) milestoneDTOs) {
}).build();
}
示例11: getRequestsByMilestone
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get requests for the given milestone",
response = ChangeRequestDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of created ChangeRequestDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
@Path("{milestoneId}/requests")
public Response getRequestsByMilestone(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
@ApiParam(required = true, value = "Milestone id") @PathParam("milestoneId") int milestoneId)
throws EntityNotFoundException, UserNotActiveException, AccessRightException {
List<ChangeRequest> changeRequests = changeManager.getChangeRequestsByMilestone(workspaceId, milestoneId);
List<ChangeRequestDTO> changeRequestDTOs = new ArrayList<>();
for (ChangeRequest changeRequest : changeRequests) {
changeRequestDTOs.add(mapper.map(changeRequest, ChangeRequestDTO.class));
}
return Response.ok(new GenericEntity<List<ChangeRequestDTO>>((List<ChangeRequestDTO>) changeRequestDTOs) {
}).build();
}
示例12: getOrdersByMilestone
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get orders for the given milestone",
response = ChangeOrderDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of created ChangeOrderDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
@Path("{milestoneId}/orders")
public Response getOrdersByMilestone(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId,
@ApiParam(required = true, value = "Milestone id") @PathParam("milestoneId") int milestoneId)
throws EntityNotFoundException, UserNotActiveException, AccessRightException {
List<ChangeOrder> changeOrders = changeManager.getChangeOrdersByMilestone(workspaceId, milestoneId);
List<ChangeOrderDTO> changeOrderDTOs = new ArrayList<>();
for (ChangeOrder changeOrder : changeOrders) {
changeOrderDTOs.add(mapper.map(changeOrder, ChangeOrderDTO.class));
}
return Response.ok(new GenericEntity<List<ChangeOrderDTO>>((List<ChangeOrderDTO>) changeOrderDTOs) {
}).build();
}
示例13: getRequests
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get requests for given parameters",
response = ChangeRequestDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of ChangeRequestDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getRequests(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId)
throws EntityNotFoundException, UserNotActiveException {
List<ChangeRequest> changeRequests = changeManager.getChangeRequests(workspaceId);
List<ChangeRequestDTO> changeRequestDTOs = new ArrayList<>();
for (ChangeRequest request : changeRequests) {
ChangeRequestDTO changeRequestDTO = mapper.map(request, ChangeRequestDTO.class);
changeRequestDTO.setWritable(changeManager.isChangeItemWritable(request));
changeRequestDTOs.add(changeRequestDTO);
}
return Response.ok(new GenericEntity<List<ChangeRequestDTO>>((List<ChangeRequestDTO>) changeRequestDTOs) {
}).build();
}
示例14: getDocumentBaselines
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
/**
* Get all document baselines of a specific workspace
*
* @param workspaceId The id of the specific workspace
* @return The list of baselines
*/
@GET
@ApiOperation(value = "Get baselines",
response = DocumentBaselineDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of checked out DocumentBaselineDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Produces(MediaType.APPLICATION_JSON)
public Response getDocumentBaselines(
@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId)
throws EntityNotFoundException, UserNotActiveException {
List<DocumentBaseline> documentBaselines = documentBaselineService.getBaselines(workspaceId);
List<DocumentBaselineDTO> baselinesDTO = new ArrayList<>();
for (DocumentBaseline documentBaseline : documentBaselines) {
DocumentBaselineDTO documentBaselineDTO = mapper.map(documentBaseline, DocumentBaselineDTO.class);
baselinesDTO.add(documentBaselineDTO);
}
return Response.ok(new GenericEntity<List<DocumentBaselineDTO>>((List<DocumentBaselineDTO>) baselinesDTO) {
}).build();
}
示例15: getDetailedWorkspacesForConnectedUser
import javax.ws.rs.core.GenericEntity; //导入依赖的package包/类
@GET
@ApiOperation(value = "Get detailed workspace list for authenticated user",
response = WorkspaceDetailsDTO.class,
responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of WorkspaceDetailsDTOs. It can be an empty list."),
@ApiResponse(code = 401, message = "Unauthorized"),
@ApiResponse(code = 500, message = "Internal server error")
})
@Path("/more")
@Produces(MediaType.APPLICATION_JSON)
public Response getDetailedWorkspacesForConnectedUser()
throws EntityNotFoundException {
List<WorkspaceDetailsDTO> workspaceListDTO = new ArrayList<>();
for (Workspace workspace : userManager.getWorkspacesWhereCallerIsActive()) {
workspaceListDTO.add(mapper.map(workspace, WorkspaceDetailsDTO.class));
}
return Response.ok(new GenericEntity<List<WorkspaceDetailsDTO>>((List<WorkspaceDetailsDTO>) workspaceListDTO) {
}).build();
}