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

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

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

Branch.of介绍

暂无

代码示例

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

public static Branch of(Project project, NameDescription nameDescription) {
  return of(project, nameDescription.asState());
}

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

public Branch update(NameDescriptionState form) {
    return of(project, form).withId(id).withDisabled(form.isDisabled());
  }
}

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

protected Branch createBranchForTemplateInstance(Branch templateBranch, String branchName) {
  return structureService.newBranch(
      Branch.of(
          templateBranch.getProject(),
          NameDescription.nd(
              NameDescription.escapeName(branchName),
              ""
          )
      )
  );
}

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

protected Branch toBranch(ResultSet rs, Function<ID, Project> projectSupplier) throws SQLException {
  ID projectId = id(rs, "projectId");
  ID branchId = id(rs);
  return Branch.of(
      projectSupplier.apply(projectId),
      new NameDescription(
          rs.getString("name"),
          rs.getString("description")
      )
  )
      .withId(branchId)
      .withSignature(readSignature(rs))
      .withType(getBranchType(branchId))
      .withDisabled(rs.getBoolean("disabled"));
}

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

protected Branch doCreateBranch(Project project, NameDescription nameDescription) throws Exception {
  return asUser().with(project.id(), BranchCreate.class).call(() -> structureService.newBranch(
      Branch.of(project, nameDescription)
  ));
}

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

@Override
public Branch cloneBranch(Branch sourceBranch, BranchCloneRequest request) {
  // Replacement function
  Function<String, String> replacementFn = replacementFn(request.getReplacements());
  // Description of the target branch
  String targetDescription = replacementFn.apply(sourceBranch.getDescription());
  // Creates the branch
  Branch targetBranch = structureService.newBranch(
      Branch.of(
          sourceBranch.getProject(),
          NameDescription.nd(request.getName(), targetDescription)
      )
  );
  // Copies the configuration
  doCopy(sourceBranch, targetBranch, replacementFn, SyncPolicy.COPY);
  // OK
  return targetBranch;
}

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

@Override
public Project cloneProject(Project sourceProject, ProjectCloneRequest request) {
  // Replacement function
  Function<String, String> replacementFn = replacementFn(request.getReplacements());
  // Description of the target project
  String targetProjectDescription = replacementFn.apply(sourceProject.getDescription());
  // Creates the project
  Project targetProject = structureService.newProject(
      Project.of(
          NameDescription.nd(request.getName(), targetProjectDescription)
      )
  );
  // Copies the properties for the project
  doCopyProperties(sourceProject, targetProject, replacementFn, SyncPolicy.COPY);
  // Creates a copy of the branch
  Branch sourceBranch = structureService.getBranch(request.getSourceBranchId());
  String targetBranchName = replacementFn.apply(sourceBranch.getName());
  String targetBranchDescription = replacementFn.apply(sourceBranch.getDescription());
  Branch targetBranch = structureService.newBranch(
      Branch.of(
          targetProject,
          NameDescription.nd(targetBranchName, targetBranchDescription)
      )
  );
  // Configuration of the new branch
  doCopy(sourceBranch, targetBranch, replacementFn, SyncPolicy.COPY);
  // OK
  return targetProject;
}

相关文章