當前位置: 首頁>>代碼示例>>Java>>正文


Java GenericEntity類代碼示例

本文整理匯總了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();
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:30,代碼來源:HealthCheckResource.java

示例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();
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:18,代碼來源:DeskDroidResource.java

示例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();
}
 
開發者ID:yahoo,項目名稱:parsec-libraries,代碼行數:23,代碼來源:JaxbExceptionMapper.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:26,代碼來源:AuthResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:23,代碼來源:AdminResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:27,代碼來源:ProductInstancesResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:26,代碼來源:OrganizationResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:24,代碼來源:ChangeOrdersResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:23,代碼來源:TagResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:27,代碼來源:MilestonesResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:25,代碼來源:MilestonesResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:25,代碼來源:MilestonesResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:24,代碼來源:ChangeRequestsResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:29,代碼來源:DocumentBaselinesResource.java

示例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();
}
 
開發者ID:polarsys,項目名稱:eplmp,代碼行數:22,代碼來源:WorkspaceResource.java


注:本文中的javax.ws.rs.core.GenericEntity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。