Only construct ChangeResources via ChangesCollection.parse
In a notedb world we would like to slurp all information about a change from the git-based storage as soon as a ChangeResource is constructed, which will involve extra work in this parse, analogous to how parse currently validates the change permissions. Preserve the ability to pass in a particular ChangeControl object, since various callers have specific requirements like reusing the control elsewhere, or using a control for a different user. Change-Id: Ia7c9761ef92bb8f05ae3323210babaa02b0dbe6f
This commit is contained in:
		@@ -83,6 +83,16 @@ public class ChangesCollection implements
 | 
			
		||||
    return new ChangeResource(control);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public ChangeResource parse(Change.Id id)
 | 
			
		||||
      throws ResourceNotFoundException, OrmException {
 | 
			
		||||
    return parse(TopLevelResource.INSTANCE,
 | 
			
		||||
        IdString.fromUrl(Integer.toString(id.get())));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public ChangeResource parse(ChangeControl control) throws OrmException {
 | 
			
		||||
    return new ChangeResource(control);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private List<Change> findChanges(String id)
 | 
			
		||||
      throws OrmException, ResourceNotFoundException {
 | 
			
		||||
    // Try legacy id
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user