本文整理了Java中net.nemerosa.ontrack.model.structure.Branch.getType()
方法的一些代码示例,展示了Branch.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Branch.getType()
方法的具体详情如下:
包路径:net.nemerosa.ontrack.model.structure.Branch
类名称:Branch
方法名:getType
暂无
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-general
@Override
public List<Decoration<BranchType>> getDecorations(ProjectEntity entity) {
if (entity instanceof Branch) {
Branch branch = (Branch) entity;
switch (branch.getType()) {
case TEMPLATE_DEFINITION:
case TEMPLATE_INSTANCE:
return Collections.singletonList(
Decoration.of(
this,
branch.getType()
)
);
default:
// No decoration by default
return Collections.emptyList();
}
} else {
return Collections.emptyList();
}
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-artifactory
@Override
public Stream<JobRegistration> collectJobRegistrations() {
if (artifactoryConfProperties.isBuildSyncDisabled()) {
return Stream.empty();
} else {
return securityService.asAdmin(() ->
// For all projects...
structureService.getProjectList().stream()
// ... and their branches
.flatMap(project -> structureService.getBranchesForProject(project.getId()).stream())
// ... only if not a template
.filter(branch -> branch.getType() != BranchType.TEMPLATE_DEFINITION)
// ... gets those with the sync. property
.filter(branch -> propertyService.hasProperty(branch, ArtifactoryPromotionSyncPropertyType.class))
// ... creates the job
.map(this::scheduleArtifactoryBuildSync)
);
}
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-jenkins
@Override
public List<Decoration<JenkinsJob>> getDecorations(ProjectEntity entity) {
// Gets the Jenkins Job property for this entity, if any
Property<JenkinsJobProperty> property = propertyService.getProperty(entity, JenkinsJobPropertyType.class.getName());
if (property.isEmpty()) {
return Collections.emptyList();
} else {
// Template branch? Decoration cannot be computed
if (entity instanceof Branch && ((Branch) entity).getType() == BranchType.TEMPLATE_DEFINITION) {
return Collections.emptyList();
}
// Gets a client
// FIXME getJob does not need a full HTTP client
JenkinsClient jenkinsClient = jenkinsClientFactory.getClient(property.getValue().getConfiguration());
// Gets the Jenkins job
JenkinsJob job = jenkinsClient.getJob(property.getValue().getJob());
// Gets the decoration for the job
return Collections.singletonList(
getDecoration(job)
);
}
}
代码示例来源:origin: net.nemerosa.ontrack/ontrack-service
else if (existingBranch.get().getType() == BranchType.CLASSIC) {
throw new BranchClassicCannotBeTemplateInstanceException(branchName);
else if (existingBranch.get().getType() == BranchType.TEMPLATE_DEFINITION) {
throw new BranchTemplateDefinitionCannotBeTemplateInstanceException(branchName);
} else {
代码示例来源:origin: net.nemerosa.ontrack/ontrack-service
if (targetBranch.get().getType() == BranchType.CLASSIC) {
return BranchTemplateSyncResult.existingClassic(branchName, sourceName);
} else if (targetBranch.get().getType() == BranchType.TEMPLATE_DEFINITION) {
return BranchTemplateSyncResult.existingDefinition(branchName, sourceName);
} else {
代码示例来源:origin: net.nemerosa.ontrack/ontrack-extension-svn
if (branch.getType() != BranchType.TEMPLATE_DEFINITION &&
propertyService.hasProperty(branch, SVNBranchConfigurationPropertyType.class)) {
代码示例来源:origin: net.nemerosa.ontrack/ontrack-service
if (branch.getType() == BranchType.TEMPLATE_INSTANCE) {
throw new BranchTemplateInstanceException(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);
}
内容来源于网络,如有侵权,请联系作者删除!