@Override public int hashCode() { return Objects.hash(this.location,resource()); }
static Repository newInstance(final URI location, final URI resource) { return new Repository(location,resource); }
public Branch createBranch(final String branchName, final URI resource) { checkNotNull(branchName,"Branch name cannot be null"); checkNotNull(resource,"Branch resource cannot be null"); checkState(branches().add(branchName),"A branch named '%s' does already exist",branchName); return Branch.newInstance(this,branchName,resource); }
static Branch newInstance(final Repository repository, final String branchName, final URI resource) { return new Branch(BranchId.create(repository.location(),branchName),resource); }
public void createRepository(final CreateRepositoryCommand aCommand) { checkNotNull(aCommand,COMMAND_CANNOT_BE_NULL); final URI location=aCommand.repositoryLocation(); Repository repository = repositoryRepository().repositoryOfLocation(location); checkState(repository==null,"A repository located at '%s' does already exist",location); final URI resource=aCommand.repositoryResource(); repository = Repository.newInstance(location, resource); repositoryRepository().add(repository); }
public void createBranch(final CreateBranchCommand aCommand) { checkNotNull(aCommand,COMMAND_CANNOT_BE_NULL); final Repository repository=findRepository(aCommand); final Branch branch = repository.createBranch(aCommand.branchName(), aCommand.branchResource()); branchRepository().add(branch); }
@Override public String toString() { return MoreObjects. toStringHelper(getClass()). add("location",this.location). add("resource",resource()). add("branches",this.branches). toString(); }
private EnrichmentContext createContext(final Execution execution) { final Codebase codebase=checkNotNull(execution.codebase(),"Codebase cannot be null"); final EnrichmentContext context=new EnrichmentContext(execution); if(context.requiresCommit()) { final Commit commit = this.scmService.findCommit(codebase.location(),codebase.branchName(), execution.commitId()); if(commit!=null) { context.setCommitResource(commit.resource()); } } if(context.requiresBranch()) { final Branch branch = this.scmService.findBranch(codebase.location(),codebase.branchName()); if(branch!=null) { context.setBranchResource(branch.resource()); } } if(context.requiresRepository()) { final Repository repository = this.scmService.findRepository(codebase.location()); if(repository!=null) { context.setRepositoryResource(repository.resource()); } } return context; }