net.nemerosa.ontrack.model.structure.Branch.getId()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中net.nemerosa.ontrack.model.structure.Branch.getId()方法的一些代码示例,展示了Branch.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch.getId()方法的具体详情如下:
包路径:net.nemerosa.ontrack.model.structure.Branch
类名称:Branch
方法名:getId

Branch.getId介绍

暂无

代码示例

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

protected void doCopyUserBuildFilters(Branch sourceBranch, Branch targetBranch) {
  buildFilterService.copyToBranch(sourceBranch.getId(), targetBranch.getId());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public Collection<PromotionLevel> getSourceItems() {
  return structureService.getPromotionLevelListForBranch(sourceBranch.getId());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public Collection<ValidationStamp> getSourceItems() {
  return structureService.getValidationStampListForBranch(sourceBranch.getId());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public JobRun getTask() {
  return runListener -> syncTemplateDefinition(branch.getId(), runListener);
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public Collection<PromotionLevel> getTargetItems() {
  return structureService.getPromotionLevelListForBranch(targetBranch.getId());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public Collection<ValidationStamp> getTargetItems() {
  return structureService.getValidationStampListForBranch(targetBranch.getId());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn

protected JobKey getSvnBuildSyncJobKey(Branch branch) {
  return SVN_BUILD_SYNC_JOB.getKey(String.valueOf(branch.getId()));
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-repository-impl

@Override
public List<PromotionRun> getLastPromotionRunsForBuild(Build build) {
  // Branch
  Branch branch = build.getBranch();
  // Promotion levels for the branch
  List<PromotionLevel> promotionLevels = getPromotionLevelListForBranch(branch.getId());
  // Gets the last promotion run for each promotion level
  return promotionLevels.stream()
      .map(promotionLevel -> getLastPromotionRun(build, promotionLevel))
      .filter(Optional::isPresent)
      .map(Optional::get)
      .collect(Collectors.toList());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
  public boolean isValid() {
    return super.isValid() &&
        getTemplateDefinition(branch.getId()).isPresent();
  }
};

代码示例来源:origin: net.nemerosa.ontrack/ontrack-ui-graphql

private DataFetcher branchPromotionLevelsFetcher() {
  return environment -> {
    Object source = environment.getSource();
    if (source instanceof Branch) {
      Branch branch = (Branch) source;
      return structureService.getPromotionLevelListForBranch(branch.getId());
    } else {
      return Collections.emptyList();
    }
  };
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn

@Override
  public Optional<Build> getEarliestBuild(NoConfig data, Branch branch, SVNLocation location, SVNLocation firstCopy, SVNBranchConfigurationProperty branchConfigurationProperty) {
    // Checks the path
    if (StringUtils.equals(branchConfigurationProperty.getCuredBranchPath(), location.getPath())) {
      String buildName = String.valueOf(location.getRevision());
      return structureService.findBuildAfterUsingNumericForm(branch.getId(), buildName);
    } else {
      return Optional.empty();
    }
  }
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-artifactory

private JobKey getBranchSyncJobKey(Branch branch) {
  return ARTIFACTORY_BUILD_SYNC_JOB.getKey(branch.getId().toString());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-general

private void onDeleteValidationStamp(Event event) {
  // Gets the validation stamp ID
  int validationStampId = event.getIntValue("validation_stamp_id");
  // Branch
  Branch branch = event.getEntity(ProjectEntityType.BRANCH);
  // Gets all promotion levels for this branch
  List<PromotionLevel> promotionLevels = structureService.getPromotionLevelListForBranch(branch.getId());
  // Checks all promotion levels
  promotionLevels.forEach(promotionLevel -> cleanPromotionLevel(promotionLevel, validationStampId));
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn

@Override
public List<LinkDefinition<Branch>> getLinkDefinitions() {
  return Collections.singletonList(
      LinkDefinitions.link(
          "_download",
          branch -> MvcUriComponentsBuilder.on(SVNController.class).download(
              branch.getId(), ""
          ),
          (branch, rc) -> rc.isProjectFunctionGranted(branch, ProjectConfig.class) &&
              svnService.getSVNRepository(branch).isPresent()
      )
  );
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn

@Override
  public Optional<Build> getEarliestBuild(RevisionPattern data, Branch branch, SVNLocation location, SVNLocation firstCopy, SVNBranchConfigurationProperty branchConfigurationProperty) {
    // Checks the path
    if (StringUtils.equals(branchConfigurationProperty.getCuredBranchPath(), location.getPath())) {
      return structureService.findBuild(
          branch.getId(),
          build -> {
            OptionalLong oRevision = getRevision(data, build, branchConfigurationProperty);
            return oRevision.isPresent() && oRevision.getAsLong() >= location.getRevision();
          },
          BuildSortDirection.FROM_OLDEST
      );
    } else {
      return Optional.empty();
    }
  }
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-general

private void onNewValidationRun(Event event) {
  // Passed validation?
  ValidationRun validationRun = event.getEntity(ProjectEntityType.VALIDATION_RUN);
  if (Objects.equals(
      validationRun.getLastStatus().getStatusID(),
      ValidationRunStatusID.STATUS_PASSED)) {
    // Branch
    Branch branch = event.getEntity(ProjectEntityType.BRANCH);
    // Build
    Build build = event.getEntity(ProjectEntityType.BUILD);
    // Gets all promotion levels for this branch
    List<PromotionLevel> promotionLevels = structureService.getPromotionLevelListForBranch(branch.getId());
    // Gets all validation stamps for this branch
    List<ValidationStamp> validationStamps = structureService.getValidationStampListForBranch(branch.getId());
    // Gets the promotion levels which have an auto promotion property
    promotionLevels.forEach(promotionLevel -> checkPromotionLevel(build, promotionLevel, validationStamps));
  }
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public Branch update(Branch branch, BranchBulkUpdateRequest request) {
  // Replacement function
  Function<String, String> replacementFn = replacementFn(request.getReplacements());
  // Description update
  Branch updatedBranch = branch.withDescription(
      replacementFn.apply(branch.getDescription())
  );
  structureService.saveBranch(updatedBranch);
  // Updating
  doCopy(branch, updatedBranch, replacementFn, new SyncPolicy(
      SyncPolicy.TargetPresentPolicy.REPLACE,
      SyncPolicy.UnknownTargetPolicy.IGNORE
  ));
  // Reloads the branch
  return structureService.getBranch(branch.getId());
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

@Override
public Event deleteBranch(Branch branch) {
  return Event.of(DELETE_BRANCH)
      .withProject(branch.getProject())
      .with("branch", branch.getName())
      .with("branch_id", branch.getId().toString())
      .get();
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-service

protected BranchTemplateSyncResult applyMissingPolicy(Branch branch, TemplateSynchronisationAbsencePolicy absencePolicy) {
  if (branch.isDisabled()) {
    return BranchTemplateSyncResult.ignored(branch.getName());
  } else {
    switch (absencePolicy) {
      case DELETE:
        structureService.deleteBranch(branch.getId());
        return BranchTemplateSyncResult.deleted(branch.getName());
      case DISABLE:
      default:
        structureService.saveBranch(branch.withDisabled(true));
        return BranchTemplateSyncResult.disabled(branch.getName());
    }
  }
}

代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn

@Override
public List<Link> links(SVNChangeLog changeLog, ResourceContext resourceContext) {
  return resourceContext.links()
      .link("_revisions", on(SVNController.class).changeLogRevisions(changeLog.getUuid()))
      .link("_issues", on(SVNController.class).changeLogIssues(changeLog.getUuid()), changeLog.getRepository().getConfiguredIssueService() != null)
      .link("_files", on(SVNController.class).changeLogFiles(changeLog.getUuid()))
      .link("_changeLogFileFilters", on(SCMController.class).getChangeLogFileFilters(changeLog.getProject().getId()))
      .link("_diff", on(SVNController.class).diff(null))
      .link("_exportFormats", on(SVNController.class).changeLogExportFormats(changeLog.getBranch().getId()))
      .link("_exportIssues", on(SVNController.class).changeLog(new IssueChangeLogExportRequest()))
      .page(
          "_page",
          "extension/svn/changelog?from=%d&to=%d",
          changeLog.getFrom().getBuild().id(),
          changeLog.getTo().getBuild().id()
      )
      .build();
}

相关文章