@Test @TestTarget(ServerVersion.ALM11) public void testLockEntity_failure() { handler.addRequest(false, "POST", "/qcbin/rest/domains/domain/projects/project/defects/86/lock", 500) .responseBody("Failed"); Entity defect = new Entity("defect", 86); Entity entity = entityService.lockEntity(defect, false); Assert.assertNull(entity); checkError("Failed"); }
public Entity lockEntity(Entity entity, boolean silent) { Entity locked = doLock(new EntityRef(entity), silent); if(locked != null) { if(!locked.matches(entity)) { if(!silent) { Messages.showDialog("Item has been recently modified on the server. Local values have been updated to match the up-to-date revision.", "Entity Update", new String[]{"Continue"}, 0, Messages.getInformationIcon()); } fireEntityLoaded(locked, EntityListener.Event.GET); } } return locked; }
EntityService { public Entity lockEntity(Entity entity, boolean silent) { Entity locked = doLock(new EntityRef(entity), silent); if(locked != null) { if(!locked.matches(entity)) { if(!silent) { Messages.showDialog("Item has been recently modified on the server. Local values have been updated to match the up-to-date revision.", "Entity Update", new String[]{"Continue"}, 0, Messages.getInformationIcon()); } fireEntityLoaded(locked, EntityListener.Event.GET); } } return locked; } }
EntityService { public Entity lockEntity(Entity entity, boolean silent) { Entity locked = doLock(new EntityRef(entity), silent); if(locked != null) { if(!locked.matches(entity)) { if(!silent) { Messages.showDialog("Item has been recently modified on the server. Local values have been updated to match the up-to-date revision.", "Entity Update", new String[]{"Continue"}, 0, Messages.getInformationIcon()); } fireEntityLoaded(locked, EntityListener.Event.GET); } } return locked; } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); }
EntityService { public Entity lockEntity(Entity entity, boolean silent) { Entity locked = doLock(new EntityRef(entity), silent); if(locked != null) { if(!locked.matches(entity)) { if(!silent) { Messages.showDialog("Item has been recently modified on the server. Local values have been updated to match the up-to-date revision.", "Entity Update", new String[]{"Continue"}, 0, Messages.getInformationIcon()); } fireEntityLoaded(locked, EntityListener.Event.GET); } } return locked; } 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 lockEntity(Entity entity, boolean silent) { Entity locked = doLock(new EntityRef(entity), silent); if(locked != null) { if(!locked.matches(entity)) { if(!silent) { Messages.showDialog("Item has been recently modified on the server. Local values have been updated to match the up-to-date revision.", "Entity Update", new String[]{"Continue"}, 0, Messages.getInformationIcon()); } fireEntityLoaded(locked, EntityListener.Event.GET); } } return locked; } 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);  }