Search in sources :

Example 1 with PropertiesFileChecker

use of com.liferay.blade.upgrade.liferay70.PropertiesFileChecker in project liferay-ide by liferay.

the class LiferayVersionsProperties method analyze.

@Override
public List<Problem> analyze(File file) {
    List<Problem> problems = new ArrayList<>();
    if (file.getName().equals("liferay-plugin-package.properties")) {
        PropertiesFileChecker propertiesFileChecker = new PropertiesFileChecker(file);
        List<KeyInfo> keys = propertiesFileChecker.getInfos("liferay-versions");
        if (ListUtil.isNotEmpty(keys)) {
            String versions = keys.get(0).value;
            if (!versions.matches(".*7\\.[0-9]\\.[0-9].*")) {
                List<SearchResult> results = propertiesFileChecker.findProperties("liferay-versions");
                if (results != null) {
                    String sectionHtml = problemSummary;
                    for (SearchResult searchResult : results) {
                        searchResult.autoCorrectContext = _PREFIX + "liferay-versions";
                        problems.add(new Problem(problemTitle, problemSummary, problemType, problemTickets, file, searchResult.startLine, searchResult.startOffset, searchResult.endOffset, sectionHtml, searchResult.autoCorrectContext, Problem.STATUS_NOT_RESOLVED, Problem.DEFAULT_MARKER_ID, Problem.MARKER_ERROR));
                    }
                }
            }
        }
    }
    return problems;
}
Also used : PropertiesFileChecker(com.liferay.blade.upgrade.liferay70.PropertiesFileChecker) KeyInfo(com.liferay.blade.upgrade.liferay70.PropertiesFileChecker.KeyInfo) ArrayList(java.util.ArrayList) Problem(com.liferay.blade.api.Problem) SearchResult(com.liferay.blade.api.SearchResult)

Example 2 with PropertiesFileChecker

use of com.liferay.blade.upgrade.liferay70.PropertiesFileChecker in project liferay-ide by liferay.

the class PropertiesFileMigrator method analyze.

@Override
public List<Problem> analyze(File file) {
    List<Problem> problems = new ArrayList<>();
    PropertiesFileChecker propertiesFileChecker = new PropertiesFileChecker(file);
    for (String key : properties) {
        List<SearchResult> results = propertiesFileChecker.findProperties(key);
        if (results != null) {
            String sectionHtml = MarkdownParser.getSection("BREAKING_CHANGES.markdown", sectionKey);
            for (SearchResult searchResult : results) {
                problems.add(new Problem(problemTitle, problemSummary, problemType, problemTickets, file, searchResult.startLine, searchResult.startOffset, searchResult.endOffset, sectionHtml, searchResult.autoCorrectContext, Problem.STATUS_NOT_RESOLVED, Problem.DEFAULT_MARKER_ID, Problem.MARKER_ERROR));
            }
        }
    }
    return problems;
}
Also used : PropertiesFileChecker(com.liferay.blade.upgrade.liferay70.PropertiesFileChecker) ArrayList(java.util.ArrayList) Problem(com.liferay.blade.api.Problem) SearchResult(com.liferay.blade.api.SearchResult)

Aggregations

Problem (com.liferay.blade.api.Problem)2 SearchResult (com.liferay.blade.api.SearchResult)2 PropertiesFileChecker (com.liferay.blade.upgrade.liferay70.PropertiesFileChecker)2 ArrayList (java.util.ArrayList)2 KeyInfo (com.liferay.blade.upgrade.liferay70.PropertiesFileChecker.KeyInfo)1