public NameDescription asNameDescription() { return NameDescription.nd(name, description); } }
public List<NameDescription> getDetailList() { return details.entrySet().stream() .map(entry -> NameDescription.nd(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); }
public ValidationRun doValidateBuild(Build build, String vsName, ValidationRunStatusID statusId) throws Exception { ValidationStamp vs = doCreateValidationStamp(build.getBranch(), NameDescription.nd(vsName, "")); return doValidateBuild(build, vs, statusId); }
@Override public <T extends ProjectEntity> List<LinkDefinition<T>> getLinkDefinitions(ProjectEntityType projectEntityType) { List<LinkDefinition<T>> definitions = new ArrayList<>(); contributors.forEach(contributor -> { if (contributor.applyTo(projectEntityType)) { try { @SuppressWarnings("unchecked") ResourceDecorationContributor<T> tResourceDecorationContributor = (ResourceDecorationContributor<T>) contributor; definitions.addAll(tResourceDecorationContributor.getLinkDefinitions()); } catch (Exception ex) { // Logging logService.log( ApplicationLogEntry.fatal( ex, NameDescription.nd( "ui-resource-decoration", "Issue when collecting UI resource decoration" ), contributor.getClass().getName() ) .withDetail("ui-resource-type", projectEntityType.name()) .withDetail("ui-resource-decorator", contributor.getClass().getName()) ); } } }); return definitions; } }
protected Branch createBranchForTemplateInstance(Branch templateBranch, String branchName) { return structureService.newBranch( Branch.of( templateBranch.getProject(), NameDescription.nd( NameDescription.escapeName(branchName), "" ) ) ); }
@Override public void createTargetItem(PromotionLevel sourcePromotionLevel) { PromotionLevel targetPromotionLevel = structureService.newPromotionLevel( PromotionLevel.of( targetBranch, NameDescription.nd( sourcePromotionLevel.getName(), replacementFn.apply(sourcePromotionLevel.getDescription()) ) ) ); copyPromotionLevelContent(sourcePromotionLevel, targetPromotionLevel); }
@Override public void createTargetItem(ValidationStamp sourceValidationStamp) { ValidationStamp targetValidationStamp = structureService.newValidationStamp( ValidationStamp.of( targetBranch, NameDescription.nd( sourceValidationStamp.getName(), replacementFn.apply(sourceValidationStamp.getDescription()) ) ) ); copyValidationStampContent(sourceValidationStamp, targetValidationStamp); }
@Override public Optional<ValidationStamp> getOrCreateValidationStamp(AutoValidationStampProperty value, Branch branch, String validationStampName) { if (value.isAutoCreate()) { Optional<PredefinedValidationStamp> oPredefinedValidationStamp = predefinedValidationStampService.findPredefinedValidationStampByName(validationStampName); if (oPredefinedValidationStamp.isPresent()) { // Creates the validation stamp return Optional.of( securityService.asAdmin(() -> structureService.newValidationStampFromPredefined( branch, oPredefinedValidationStamp.get() ) ) ); } else if (value.isAutoCreateIfNotPredefined()) { // Creates a validation stamp even without a predefined one return Optional.of( securityService.asAdmin(() -> structureService.newValidationStamp( ValidationStamp.of( branch, NameDescription.nd(validationStampName, "Validation automatically created on demand.") ) ) ) ); } } return Optional.empty(); }
protected AccountGroup doCreateAccountGroup() throws Exception { return asUser().with(AccountGroupManagement.class).call(() -> { String name = uid("G"); return accountService.createGroup( NameDescription.nd(name, "") ); }); }
@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; }
@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; }
dateTimeFromDB(rs.getString("TIMESTAMP")), rs.getString("AUTHENTICATION"), NameDescription.nd( rs.getString("NAME"), rs.getString("DESCRIPTION")
ApplicationLogEntry.error( ex, NameDescription.nd( "ldap-authentication", "LDAP Authentication problem"
@Override protected ConnectionResult validate(GitHubEngineConfiguration configuration) { try { // Gets the client OntrackGitHubClient client = gitHubClientFactory.create(configuration); // Gets the list of repositories client.getRepositories(); // OK return ConnectionResult.ok(); } catch (Exception ex) { applicationLogService.log( ApplicationLogEntry.error( ex, NameDescription.nd("github", "GitHub connection issue"), configuration.getUrl() ) .withDetail("github-config-name", configuration.getName()) .withDetail("github-config-url", configuration.getUrl()) ); return ConnectionResult.error(ex.getMessage()); } } }
@Override protected ConnectionResult validate(GitLabConfiguration configuration) { try { // Gets the client OntrackGitLabClient client = gitLabClientFactory.create(configuration); // Gets the list of repositories client.getRepositories(); // OK return ConnectionResult.ok(); } catch (Exception ex) { applicationLogService.log( ApplicationLogEntry.error( ex, NameDescription.nd("gitlab", "GitLab connection issue"), configuration.getUrl() ) .withDetail("gitlab-config-name", configuration.getName()) .withDetail("gitlab-config-url", configuration.getUrl()) ); return ConnectionResult.error(ex.getMessage()); } } }