Search in sources :

Example 26 with SearchResult

use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.

the class WebContentTypeRemoved method searchFile.

@Override
protected List<SearchResult> searchFile(File file, JavaFile javaFileChecker) {
    List<SearchResult> searchResults = new ArrayList<>();
    // check JournalArticle.getType() and JournalFeed.getType()
    List<SearchResult> getTypes = javaFileChecker.findMethodInvocations("JournalArticle", null, "getType", null);
    searchResults.addAll(getTypes);
    getTypes = javaFileChecker.findMethodInvocations("JournalFeed", null, "getType", null);
    searchResults.addAll(getTypes);
    // callers of ArticleTypeException's methods
    SearchResult exceptionImports = javaFileChecker.findImport("com.liferay.portlet.journal.ArticleTypeException");
    if (exceptionImports != null) {
        searchResults.add(exceptionImports);
    }
    List<SearchResult> catchExceptions = javaFileChecker.findCatchExceptions(new String[] { "ArticleTypeException" });
    searchResults.addAll(catchExceptions);
    // JournalArticleLocalServiceUtil
    List<SearchResult> journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "addArticle", new String[] { "long", "long", "long", "long", "long", "String", "boolean", "double", "java.util.Map<java.util.Locale,java.lang.String>", "java.util.Map<java.util.Locale,java.lang.String>", "String", "String", "String", "String", "String", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "boolean", "int", "int", "int", "int", "int", "boolean", "boolean", "boolean", "String", "File", "java.util.Map<java.lang.String,byte[]>", "String", "ServiceContext" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "search", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "Date", "Date", "int", "Date", "int", "int", "OrderByComparator" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "search", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "String", "String", "String", "Date", "Date", "int", "Date", "boolean", "int", "int", "OrderByComparator" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "search", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "String", "String[]", "String[]", "Date", "Date", "int", "Date", "boolean", "int", "int", "OrderByComparator" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "search", new String[] { "long", "long", "java.util.List<Long>", "long", "String", "String", "String", "String", "String", "String", "String", "String", "LinkedHashMap<String,Object>", "boolean", "int", "int", "Sort" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "searchCount", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "Date", "Date", "int", "Date" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "searchCount", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "String", "String", "String", "Date", "Date", "int", "Date", "boolean" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "searchCount", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "String", "String[]", "String[]", "Date", "Date", "int", "Date", "boolean" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    journalArticleLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleLocalServiceUtil", "updateArticle", new String[] { "long", "long", "long", "String", "double", "java.util.Map<java.util.Locale,java.lang.String>", "java.util.Map<java.util.Locale,java.lang.String>", "String", "String", "String", "String", "String", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "boolean", "int", "int", "int", "int", "int", "boolean", "boolean", "boolean", "String", "File", "java.util.Map<java.lang.String,byte[]>", "String", "ServiceContext" });
    searchResults.addAll(journalArticleLocalServiceUtil);
    // JournalArticleServiceUtil
    List<SearchResult> journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "addArticle", new String[] { "long", "long", "long", "long", "String", "boolean", "java.util.Map<java.util.Locale,java.lang.String>", "java.util.Map<java.util.Locale,java.lang.String>", "String", "String", "String", "String", "String", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "boolean", "int", "int", "int", "int", "int", "boolean", "boolean", "boolean", "String", "File", "java.util.Map<java.lang.String,byte[]>", "String", "ServiceContext" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "addArticle", new String[] { "long", "long", "long", "long", "String", "boolean", "java.util.Map<java.util.Locale,java.lang.String>", "java.util.Map<java.util.Locale,java.lang.String>", "String", "String", "String", "String", "String", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "boolean", "int", "int", "int", "int", "int", "boolean", "boolean", "String", "ServiceContext" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "search", new String[] { "long", "long", "java.util.List<Long>", "long", "String", "Double", "String", "String", "String", "Date", "Date", "int", "Date", "int", "int", "OrderByComparator" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "search", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "String", "String", "String", "Date", "Date", "int", "Date", "boolean", "int", "int", "OrderByComparator" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "search", new String[] { "long", "long", "java.util.List<java.lang.Long>", "long", "String", "Double", "String", "String", "String", "String", "String[]", "String[]", "Date", "Date", "int", "Date", "boolean", "int", "int", "OrderByComparator" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "searchCount", new String[] { "long", "long", "java.util.List<Long>", "long", "String", "Double", "String", "String", "String", "Date", "Date", "int", "Date" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "searchCount", new String[] { "long", "long", "java.util.List<Long>", "long", "String", "Double", "String", "String", "String", "String", "String", "String", "Date", "Date", "int", "Date", "boolean" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "searchCount", new String[] { "long", "long", "java.util.List<Long>", "long", "String", "Double", "String", "String", "String", "String", "String[]", "String[]", "Date", "Date", "int", "Date", "boolean" });
    searchResults.addAll(journalArticleServiceUtil);
    journalArticleServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalArticleServiceUtil", "updateArticle", new String[] { "long", "long", "String", "double", "java.util.Map<java.util.Locale,java.lang.String>", "java.util.Map<java.util.Locale,java.lang.String>", "String", "String", "String", "String", "String", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "boolean", "int", "int", "int", "int", "int", "boolean", "boolean", "boolean", "String", "File", "java.util.Map<java.lang.String,byte[]>", "String", "ServiceContext" });
    searchResults.addAll(journalArticleServiceUtil);
    // JournalFeedLocalServiceUtil
    List<SearchResult> journalFeedLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalFeedLocalServiceUtil", "addFeed", new String[] { "long", "long", "String", "boolean", "String", "String", "String", "String", "String", "String", "int", "String", "String", "String", "String", "String", "String", "double", "ServiceContext" });
    searchResults.addAll(journalFeedLocalServiceUtil);
    journalFeedLocalServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalFeedLocalServiceUtil", "updateFeed", new String[] { "long", "String", "String", "String", "String", "String", "String", "String", "int", "String", "String", "String", "String", "String", "String", "double", "ServiceContext" });
    searchResults.addAll(journalFeedLocalServiceUtil);
    // JournalFeedServiceUtil
    List<SearchResult> journalFeedServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalFeedServiceUtil", "addFeed", new String[] { "long", "String", "boolean", "String", "String", "String", "String", "String", "String", "int", "String", "String", "String", "String", "String", "String", "double", "ServiceContext" });
    searchResults.addAll(journalFeedServiceUtil);
    journalFeedServiceUtil = javaFileChecker.findMethodInvocations(null, "JournalFeedServiceUtil", "updateFeed", new String[] { "long", "String", "String", "String", "String", "String", "String", "String", "int", "String", "String", "String", "String", "String", "String", "double", "ServiceContext" });
    searchResults.addAll(journalFeedServiceUtil);
    return searchResults;
}
Also used : ArrayList(java.util.ArrayList) SearchResult(com.liferay.blade.api.SearchResult)

Example 27 with SearchResult

use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.

the class MVCPortletClassInPortletXML method searchFile.

@Override
protected List<SearchResult> searchFile(File file, XMLFile xmlFileChecker) {
    if (!"portlet.xml".equals(file.getName())) {
        return Collections.emptyList();
    }
    List<SearchResult> results = new ArrayList<>();
    Collection<SearchResult> tags = xmlFileChecker.findElement("portlet-class", "com.liferay.util.bridges.mvc.MVCPortlet");
    for (SearchResult tagResult : tags) {
        tagResult.autoCorrectContext = _KEY;
    }
    results.addAll(tags);
    return results;
}
Also used : ArrayList(java.util.ArrayList) SearchResult(com.liferay.blade.api.SearchResult)

Example 28 with SearchResult

use of com.liferay.blade.api.SearchResult 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)

Example 29 with SearchResult

use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.

the class RenamePortalKernelImports method searchFile.

@Override
public List<SearchResult> searchFile(File file, JavaFile javaFile) {
    List<SearchResult> searchResults = new ArrayList<>();
    List<SearchResult> importResult = javaFile.findImports(_imports.keySet().toArray(new String[0]));
    if (ListUtil.isNotEmpty(importResult)) {
        for (SearchResult result : importResult) {
            // make sure that our import is not in list of fixed imports
            boolean skip = false;
            if (result.searchContext != null) {
                for (String fixed : _imports.values().toArray(new String[0])) {
                    if (result.searchContext.contains(fixed)) {
                        skip = true;
                        break;
                    }
                }
            }
            if (!skip) {
                result.autoCorrectContext = getPrefix() + _getImportNameFromResult(result);
                searchResults.add(result);
            }
        }
    }
    return _removeDuplicate(searchResults);
}
Also used : ArrayList(java.util.ArrayList) SearchResult(com.liferay.blade.api.SearchResult)

Aggregations

SearchResult (com.liferay.blade.api.SearchResult)29 ArrayList (java.util.ArrayList)25 ASTVisitor (org.eclipse.jdt.core.dom.ASTVisitor)8 JavaFile (com.liferay.blade.api.JavaFile)4 Problem (com.liferay.blade.api.Problem)4 File (java.io.File)4 Test (org.junit.Test)4 BundleContext (org.osgi.framework.BundleContext)4 ServiceReference (org.osgi.framework.ServiceReference)4 NodeList (org.w3c.dom.NodeList)3 PropertiesFileChecker (com.liferay.blade.upgrade.liferay70.PropertiesFileChecker)2 List (java.util.List)2 Path (org.eclipse.core.runtime.Path)2 ITypeBinding (org.eclipse.jdt.core.dom.ITypeBinding)2 ImportDeclaration (org.eclipse.jdt.core.dom.ImportDeclaration)2 TypeDeclaration (org.eclipse.jdt.core.dom.TypeDeclaration)2 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)2 JSONArray (org.json.JSONArray)2 KeyInfo (com.liferay.blade.upgrade.liferay70.PropertiesFileChecker.KeyInfo)1 ExecutionException (java.util.concurrent.ExecutionException)1