本文整理了Java中net.nemerosa.ontrack.model.structure.Branch.getName()
方法的一些代码示例,展示了Branch.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch.getName()
方法的具体详情如下:
包路径:net.nemerosa.ontrack.model.structure.Branch
类名称:Branch
方法名:getName
暂无
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@NotNull
@Override
@JsonIgnore
public Map<String, String> getRunMetricTags() {
return ImmutableMap.of(
"project", branch.getProject().getName(),
"branch", branch.getName()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn
@Override
public String getDescription() {
return String.format(
"Synchronisation of builds with SVN for branch %s/%s",
branch.getProject().getName(),
branch.getName()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@Override
public String getEntityDisplayName() {
return String.format("Build %s/%s/%s", branch.getProject().getName(), branch.getName(), name);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-service
@Override
public String getDescription() {
return format(
"Template sync. from %s/%s",
branch.getProject().getName(),
branch.getName()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@Override
public String getEntityDisplayName() {
return String.format("Promotion level %s/%s/%s", branch.getProject().getName(), branch.getName(), name);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@Override
public String getEntityDisplayName() {
return String.format("Validation stamp %s/%s/%s", branch.getProject().getName(), branch.getName(), name);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@Override
public boolean isValid() {
return structureService.findBranchByName(branch.getProject().getName(), branch.getName()).isPresent();
}
代码示例来源: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-model
@NotNull
@Override
@JsonIgnore
public Map<String, String> getRunMetricTags() {
return ImmutableMap.of(
"project", validationStamp.getBranch().getProject().getName(),
"branch", validationStamp.getBranch().getName(),
"validationStamp", validationStamp.getName(),
"status", getLastStatusId()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-ui-graphql
private DataFetcher branchValidationStampsFetcher() {
return environment -> {
Object source = environment.getSource();
Optional<String> name = GraphqlUtils.getStringArgument(environment, "name");
if (source instanceof Branch) {
Branch branch = (Branch) source;
if (name.isPresent()) {
return structureService.findValidationStampByName(
branch.getProject().getName(), branch.getName(), name.get()
)
.map(Collections::singletonList)
.orElse(Collections.emptyList());
} else {
return structureService.getValidationStampListForBranch(branch.getId());
}
} else {
return Collections.emptyList();
}
};
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn
protected Optional<Build> getEarliestBuild(T data, Branch branch, SVNLocation location, SVNBranchConfigurationProperty branchConfigurationProperty) {
return extractBuildName(data, location.getPath(), branch, branchConfigurationProperty)
.flatMap(buildName ->
structureService.findBuildByName(
branch.getProject().getName(),
branch.getName(),
buildName
)
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-general
@Override
public AutoPromotionProperty copy(ProjectEntity sourceEntity, AutoPromotionProperty value, ProjectEntity targetEntity, Function<String, String> replacementFn) {
PromotionLevel targetPromotionLevel = (PromotionLevel) targetEntity;
return new AutoPromotionProperty(
value.getValidationStamps().stream()
.map(vs -> structureService.findValidationStampByName(
targetPromotionLevel.getBranch().getProject().getName(),
targetPromotionLevel.getBranch().getName(),
vs.getName()
))
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList()),
value.getInclude(),
value.getExclude()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn
private Optional<Build> createBuild(String tagsPath, SVNSyncProperty syncProperty, Branch branch, TCopyEvent copy, ConfiguredBuildSvnRevisionLink<?> revisionLink, SVNRepository repository) {
// Extracts the build name from the copyTo path
return getBuildNameFromPath(tagsPath, revisionLink, copy.copyToLocation())
.flatMap(buildName -> {
// Gets an existing build if any
Optional<Build> build = structureService.findBuildByName(branch.getProject().getName(), branch.getName(), buildName);
// If none exists, just creates it
if (!build.isPresent()) {
logger.debug("[svn-sync] Build {} does not exist - creating.", buildName);
return Optional.of(doCreateBuild(branch, copy, buildName, repository));
}
// If Ok to override, deletes it and creates it
else if (syncProperty.isOverride()) {
logger.debug("[svn-sync] Build {} already exists - overriding.", buildName);
// Deletes the build
structureService.deleteBuild(build.get().getId());
// Creates the build
return Optional.of(doCreateBuild(branch, copy, buildName, repository));
}
// Else, just puts some log entry
else {
logger.debug("[svn-sync] Build {} already exists - not overriding.", buildName);
return Optional.empty();
}
});
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@Override
public String getEntityDisplayName() {
return String.format("Promotion run %s/%s/%s/%s",
build.getBranch().getProject().getName(),
build.getBranch().getName(),
build.getName(),
promotionLevel.getName()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-model
@Override
public String getEntityDisplayName() {
return String.format("Validation run %s#%d for %s/%s/%s",
validationStamp.getName(),
runOrder,
build.getBranch().getProject().getName(),
build.getBranch().getName(),
build.getName()
);
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-repository-impl
@Override
public void saveBranch(Branch branch) {
// Update
try {
getNamedParameterJdbcTemplate().update(
"UPDATE BRANCHES SET NAME = :name, DESCRIPTION = :description, DISABLED = :disabled WHERE ID = :id",
params("name", branch.getName())
.addValue("description", branch.getDescription())
.addValue("disabled", branch.isDisabled())
.addValue("id", branch.id())
);
} catch (DuplicateKeyException ex) {
throw new BranchNameAlreadyDefinedException(branch.getName());
}
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-service
@Override
public Branch connectTemplateInstance(ID branchId, BranchTemplateInstanceConnectRequest request) {
// Gets the branch
Branch branch = structureService.getBranch(branchId);
// Checks it is not connected yet
if (branch.getType() != BranchType.CLASSIC) {
throw new BranchCannotConnectToTemplateException(branch.getName());
}
// Checks the rights
securityService.checkProjectFunction(branch, BranchTemplateMgt.class);
// Gets the template definition
ID templateId = ID.of(request.getTemplateId());
TemplateDefinition templateDefinition = getTemplateDefinition(templateId)
.orElseThrow(() -> new BranchNotTemplateDefinitionException(templateId));
// Loads the branch template
Branch template = structureService.getBranch(templateId);
// Update request
BranchTemplateInstanceSingleRequest instanceSingleRequest = new BranchTemplateInstanceSingleRequest(
branch.getName(),
request.isManual(),
request.getParameters()
);
// Updates the instance
updateTemplateInstance(branch.getName(), branch, template, instanceSingleRequest, templateDefinition);
// OK
return structureService.getBranch(branchId);
}
代码示例来源: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-extension-svn
protected String getSVNBuildPath(Build build) {
// Gets the build path property value
Property<SVNBranchConfigurationProperty> branchConfiguration = propertyService.getProperty(
build.getBranch(),
SVNBranchConfigurationPropertyType.class
);
if (branchConfiguration.isEmpty()) {
throw new MissingSVNBranchConfigurationException(build.getBranch().getName());
} else {
// Gets the build revision link
ConfiguredBuildSvnRevisionLink<Object> revisionLink = buildSvnRevisionLinkService.getConfiguredBuildSvnRevisionLink(
branchConfiguration.getValue().getBuildRevisionLink()
);
// Gets the path to the build
return revisionLink.getBuildPath(build, branchConfiguration.getValue());
}
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-repository-impl
@Override
public Branch newBranch(Branch branch) {
// Creation
try {
int id = dbCreate(
"INSERT INTO BRANCHES(PROJECTID, NAME, DESCRIPTION, DISABLED, CREATION, CREATOR) VALUES (:projectId, :name, :description, :disabled, :creation, :creator)",
params("name", branch.getName())
.addValue("description", branch.getDescription())
.addValue("disabled", branch.isDisabled())
.addValue("projectId", branch.getProject().id())
.addValue("creation", dateTimeForDB(branch.getSignature().getTime()))
.addValue("creator", branch.getSignature().getUser().getName())
);
// Returns with ID
return branch.withId(id(id));
} catch (DuplicateKeyException ex) {
throw new BranchNameAlreadyDefinedException(branch.getName());
}
}
内容来源于网络,如有侵权,请联系作者删除!