Search in sources :

Example 1 with KeyInfo

use of com.liferay.blade.upgrade.liferay70.PropertiesFileChecker.KeyInfo 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)

Aggregations

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