Example usage for org.apache.commons.lang StringUtils abbreviate

List of usage examples for org.apache.commons.lang StringUtils abbreviate

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils abbreviate.

Prototype

public static String abbreviate(String str, int maxWidth) 

Source Link

Document

Abbreviates a String using ellipses.

Usage

From source file:org.sonar.api.batch.sensor.issue.internal.DefaultIssueLocation.java

@Override
public DefaultIssueLocation message(String message) {
    requireNonNull(message, "Message can't be null");
    this.message = StringUtils.abbreviate(StringUtils.trim(message), MESSAGE_MAX_SIZE);
    return this;
}

From source file:org.sonar.api.database.model.ResourceModel.java

/**
 * Sets the resource description, truncated to DESCRIPTION_COLUMN_SIZE
 *//*from   w ww.j  a va  2s .com*/
public void setDescription(String description) {
    this.description = StringUtils.abbreviate(description, DESCRIPTION_COLUMN_SIZE);
}

From source file:org.sonar.api.database.model.ResourceModel.java

/**
 * Sets the resource name, truncated to NAME_COLUMN_SIZE
 *//*w w  w . j a v a  2s.  c om*/
public void setName(String name) {
    this.name = StringUtils.abbreviate(name, NAME_COLUMN_SIZE);
    if (this.longName == null) {
        this.longName = this.name;
    }
}

From source file:org.sonar.api.database.model.ResourceModel.java

/**
 * Sets the long name of the resource, truncated to NAME_COLUMN_SIZE
 *//*from w w w.  ja va  2  s  .  c om*/
public void setLongName(String s) {
    if (StringUtils.isBlank(s)) {
        this.longName = name;
    } else {
        this.longName = StringUtils.abbreviate(s, NAME_COLUMN_SIZE);
    }
}

From source file:org.sonar.api.database.model.RuleFailureModel.java

public static String abbreviateMessage(String message) {
    return StringUtils.abbreviate(StringUtils.trim(message), MESSAGE_COLUMN_SIZE);
}

From source file:org.sonar.api.database.model.SnapshotSource.java

@Override
public String toString() {
    return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("snapshot_id", snapshotId)
            .append("data", StringUtils.abbreviate(data, 1000)).toString();
}

From source file:org.sonar.api.issue.internal.DefaultIssue.java

public DefaultIssue setMessage(@Nullable String s) {
    this.message = StringUtils.abbreviate(StringUtils.trim(s), MESSAGE_MAX_SIZE);
    return this;
}

From source file:org.sonar.api.resources.ProjectLink.java

public final void setName(String name) {
    this.name = StringUtils.abbreviate(name, NAME_COLUMN_SIZE);
}

From source file:org.sonar.api.resources.ProjectLink.java

public final void setHref(String href) {
    if (href == null) {
        throw new IllegalArgumentException("ProjectLink.href can not be null");
    }//  ww w.  j  a v  a2 s . com
    this.href = StringUtils.abbreviate(href, HREF_COLUMN_SIZE);
}

From source file:org.sonar.plugins.github.PullRequestIssuePostJob.java

@Override
public void execute(PostJobContext context) {
    GlobalReport report = new GlobalReport(gitHubPluginConfiguration.module(), markDownUtils,
            gitHubPluginConfiguration.tryReportIssuesInline());
    try {//from  www.  j a va 2  s.c  o  m
        Map<InputFile, Map<Integer, StringBuilder>> commentsToBeAddedByLine = processIssues(report,
                context.issues());

        updateReviewComments(commentsToBeAddedByLine);

        pullRequestFacade.deleteOutdatedComments();

        List<Integer> issuesCriticalAndBlockers = pullRequestFacade.getRelevantOldIssues();

        pullRequestFacade
                .createOrUpdateGlobalComments(report.hasNewIssue() ? report.formatForMarkdown() : null);

        pullRequestFacade.createOrUpdateSonarQubeStatus(report.getStatus(issuesCriticalAndBlockers),
                report.getStatusDescription(issuesCriticalAndBlockers));
    } catch (Exception e) {
        LOG.error("SonarQube analysis failed to complete the review of this pull request", e);
        pullRequestFacade.createOrUpdateSonarQubeStatus(GHCommitState.ERROR,
                StringUtils.abbreviate("SonarQube analysis failed: " + e.getMessage(), 140));
    }
}