@Test @TestTarget(ServerVersion.ALM11) public void testGetDefectLink_Maya() { handler.addRequest(false, "GET", "/qcbin/rest/domains/domain/projects/project/defects/86/defect-links/2763", 200) .content("entityServiceTest_defectLink.xml"); Entity link = entityService.getDefectLink(86, 2763); Assert.assertEquals(2763, link.getId()); }
public Entity getDefectLink(int defectId, int linkId) { if(!restService.getServerStrategy().hasSecondLevelDefectLink()) { EntityQuery linkQuery = new EntityQuery("defect-link"); linkQuery.setValue("id", String.valueOf(linkId)); linkQuery.setPropertyResolved("id", true); return doQuery(linkQuery, true).get(0); } else { return DefectLinkList.create(restService.getForStream("defects/{0}/defect-links/{1}", defectId, linkId), true).get(0); } }
EntityService { public Entity getDefectLink(int defectId, int linkId) { if(!restService.getServerStrategy().hasSecondLevelDefectLink()) { EntityQuery linkQuery = new EntityQuery("defect-link"); linkQuery.setValue("id", String.valueOf(linkId)); linkQuery.setPropertyResolved("id", true); return doQuery(linkQuery, true).get(0); } else { return DefectLinkList.create(restService.getForStream("defects/{0}/defect-links/{1}", defectId, linkId), true).get(0); } } }
EntityService { public Entity getDefectLink(int defectId, int linkId) { if(!restService.getServerStrategy().hasSecondLevelDefectLink()) { EntityQuery linkQuery = new EntityQuery("defect-link"); linkQuery.setValue("id", String.valueOf(linkId)); linkQuery.setPropertyResolved("id", true); return doQuery(linkQuery, true).get(0); } else { return DefectLinkList.create(restService.getForStream("defects/{0}/defect-links/{1}", defectId, linkId), true).get(0); } } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); }
EntityService { public Entity getDefectLink(int defectId, int linkId) { if(!restService.getServerStrategy().hasSecondLevelDefectLink()) { EntityQuery linkQuery = new EntityQuery("defect-link"); linkQuery.setValue("id", String.valueOf(linkId)); linkQuery.setPropertyResolved("id", true); return doQuery(linkQuery, true).get(0); } else { return DefectLinkList.create(restService.getForStream("defects/{0}/defect-links/{1}", defectId, linkId), true).get(0); } } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); void addEntityListener(EntityListener listener); void removeEntityListener(EntityListener listener); void refreshEntity(EntityRef ref); void getEntityAsync(EntityRef ref, EntityListener callback); Entity getEntity(EntityRef ref); EntityList query(EntityQuery query); InputStream queryForStream(EntityQuery query); Entity getDefectLink(int defectId, int linkId); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure, boolean fireUpdate); Entity createEntity(Entity entity, boolean silent); Entity lockEntity(Entity entity, boolean silent); boolean deleteEntity(Entity entity); void unlockEntity(Entity entity); void fireEntityLoaded(final Entity entity, final EntityListener.Event event); void fireEntityNotFound(final EntityRef ref, final boolean removed); void requestCachedEntity(final EntityRef ref, final List<String> properties, final EntityListener callback); }
EntityService { public Entity getDefectLink(int defectId, int linkId) { if(!restService.getServerStrategy().hasSecondLevelDefectLink()) { EntityQuery linkQuery = new EntityQuery("defect-link"); linkQuery.setValue("id", String.valueOf(linkId)); linkQuery.setPropertyResolved("id", true); return doQuery(linkQuery, true).get(0); } else { return DefectLinkList.create(restService.getForStream("defects/{0}/defect-links/{1}", defectId, linkId), true).get(0); } } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); void addEntityListener(EntityListener listener); void removeEntityListener(EntityListener listener); void refreshEntity(EntityRef ref); void getEntityAsync(EntityRef ref, EntityListener callback); Entity getEntity(EntityRef ref); EntityList query(EntityQuery query); InputStream queryForStream(EntityQuery query); Entity getDefectLink(int defectId, int linkId); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure, boolean fireUpdate); Entity createEntity(Entity entity, boolean silent); Entity lockEntity(Entity entity, boolean silent); boolean deleteEntity(Entity entity); void unlockEntity(Entity entity); void fireEntityLoaded(final Entity entity, final EntityListener.Event event); void fireEntityNotFound(final EntityRef ref, final boolean removed); void requestCachedEntity(final EntityRef ref, final List<String> properties, final EntityListener callback);  }