
org.apache.maven.plugins.changes.model.AbstractAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maven-changes-plugin Show documentation
Show all versions of maven-changes-plugin Show documentation
Creates a release history for inclusion into the site and assists in generating an announcement mail.
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugins.changes.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* Abstract class with helper methods for {@link Action}.
*/
public abstract class AbstractAction {
private List dueTosList;
private List fixedIssueList;
public abstract String getDueTo();
public abstract String getDueToEmail();
public abstract String getFixedIssuesString();
/**
* Parse due-to and due-to-email attributes.
*
* @return a List of due-to person
*/
public List getDueTos() {
if (dueTosList != null) {
return dueTosList;
}
List result = new ArrayList<>();
List dueTos = new ArrayList<>();
List dueToEmails = new ArrayList<>();
if (getDueTo() != null) {
Arrays.stream(getDueTo().split(","))
.map(String::trim)
.filter(s -> !s.isEmpty())
.forEach(dueTos::add);
}
if (getDueToEmail() != null) {
Arrays.stream(getDueToEmail().split(",")).map(String::trim).forEach(dueToEmails::add);
}
while (dueToEmails.size() < dueTos.size()) {
dueToEmails.add("");
}
for (int i = 0; i < dueTos.size(); i++) {
DueTo dueTo = new DueTo();
dueTo.setName(dueTos.get(i));
dueTo.setEmail(dueToEmails.get(i));
result.add(dueTo);
}
dueTosList = Collections.unmodifiableList(result);
return dueTosList;
}
/**
* Parse getFixedIssues attribute.
*
* @return a list of fixed issues
*/
public List getFixedIssues() {
if (fixedIssueList != null) {
return fixedIssueList;
}
List result;
if (getFixedIssuesString() != null) {
result = Arrays.stream(getFixedIssuesString().split(","))
.map(String::trim)
.filter(s -> !s.isEmpty())
.collect(Collectors.toList());
} else {
result = Collections.emptyList();
}
fixedIssueList = Collections.unmodifiableList(result);
return fixedIssueList;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy