use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.
the class RemovedAbilitySpecifyClassLoaders method searchFile.
@Override
protected List<SearchResult> searchFile(File file, JavaFile javaFileChecker) {
List<SearchResult> result = new ArrayList<>();
List<SearchResult> findImplementsInterfaces = javaFileChecker.findImplementsInterface("ScriptingExecutor");
if (ListUtil.isNotEmpty(findImplementsInterfaces)) {
result.addAll(findImplementsInterfaces);
}
SearchResult findImportResult = javaFileChecker.findImport("com.liferay.portal.kernel.scripting.Scripting");
if (findImportResult != null) {
result.add(findImportResult);
}
return result;
}
use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.
the class UserImporterExporter method searchFile.
@Override
protected List<SearchResult> searchFile(File file, JavaFile javaFileChecker) {
List<SearchResult> searchResults = new ArrayList<>();
SearchResult searchResult = javaFileChecker.findImport("com.liferay.portal.kernel.security.exportimport.UserImporter");
if (searchResult != null) {
searchResults.add(searchResult);
}
searchResult = javaFileChecker.findImport("com.liferay.portal.kernel.security.exportimport.UserExporter");
if (searchResult != null) {
searchResults.add(searchResult);
}
searchResult = javaFileChecker.findImport("com.liferay.portal.kernel.security.exportimport.UserOperation");
if (searchResult != null) {
searchResults.add(searchResult);
}
searchResult = javaFileChecker.findImport("com.liferay.portal.kernel.security.exportimport.UserImporterUtil");
if (searchResult != null) {
searchResults.add(searchResult);
}
searchResult = javaFileChecker.findImport("com.liferay.portal.kernel.security.exportimport.UserExporterUtil");
if (searchResult != null) {
searchResults.add(searchResult);
}
return searchResults;
}
use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.
the class AssetTagProperties method searchFile.
@Override
protected List<SearchResult> searchFile(File file, JavaFile javaFileChecker) {
List<SearchResult> searchResults = new ArrayList<>();
// all imports from AssetTagPropertyLocalServiceUtil and
// AssetTagPropertyServiceUtil
SearchResult searchResult = javaFileChecker.findImport("com.liferay.portlet.asset.service.AssetTagPropertyLocalServiceUtil");
if (searchResult != null) {
searchResults.add(searchResult);
}
searchResult = javaFileChecker.findImport("com.liferay.portlet.asset.service.AssetTagPropertyServiceUtil");
if (searchResult != null) {
searchResults.add(searchResult);
}
// all calls on AssetTagPropertyLocalServiceUtil
List<SearchResult> localInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagPropertyLocalServiceUtil", "*", null);
searchResults.addAll(localInvocations);
// all calls on AssetTagPropertyServiceUtil
List<SearchResult> serviceInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagPropertyServiceUtil", "*", null);
searchResults.addAll(serviceInvocations);
// all calls on methods with String[] tagProperties parameter
// AssetTagLocalServiceUtil java.lang.String[] tagProperties
List<SearchResult> tagServiceLocalUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagLocalServiceUtil", "addTag", new String[] { "long", "String", "String[]", "ServiceContext" });
searchResults.addAll(tagServiceLocalUtilInvocations);
tagServiceLocalUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagLocalServiceUtil", "search", new String[] { "long", "String", "String[]", "int", "int" });
searchResults.addAll(tagServiceLocalUtilInvocations);
tagServiceLocalUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagLocalServiceUtil", "search", new String[] { "long[]", "String", "String[]", "int", "int" });
searchResults.addAll(tagServiceLocalUtilInvocations);
tagServiceLocalUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagLocalServiceUtil", "updateTag", new String[] { "long", "long", "String", "String[]", "ServiceContext" });
searchResults.addAll(tagServiceLocalUtilInvocations);
// AssetTagServiceUtil java.lang.String[] tagProperties
List<SearchResult> tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "addTag", new String[] { "String", "String[]", "ServiceContext" });
searchResults.addAll(tagServiceUtilInvocations);
tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "getTags", new String[] { "long", "String", "String[]", "int", "int" });
searchResults.addAll(tagServiceUtilInvocations);
tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "getTags", new String[] { "long[]", "String", "String[]", "int", "int" });
searchResults.addAll(tagServiceUtilInvocations);
tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "getTagsCount", new String[] { "long", "String", "String[]" });
searchResults.addAll(tagServiceUtilInvocations);
tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "search", new String[] { "long", "String", "String[]", "int", "int" });
searchResults.addAll(tagServiceUtilInvocations);
tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "search", new String[] { "long[]", "String", "String[]", "int", "int" });
searchResults.addAll(tagServiceUtilInvocations);
tagServiceUtilInvocations = javaFileChecker.findMethodInvocations(null, "AssetTagServiceUtil", "updateTag", new String[] { "long", "String", "String[]", "ServiceContext" });
searchResults.addAll(tagServiceUtilInvocations);
return searchResults;
}
use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.
the class JavaFileJDTTest method checkMethodInvocationTypeMatch.
@Test
public void checkMethodInvocationTypeMatch() throws Exception {
File file = new File("tests/files/JavaFileCheckerTypeMatch.java");
final BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
final Collection<ServiceReference<JavaFile>> sr = context.getServiceReferences(JavaFile.class, "(file.extension=java)");
JavaFile javaFileChecker = context.getService(sr.iterator().next());
javaFileChecker.setFile(file);
List<SearchResult> searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForString", new String[] { "String" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForString", new String[] { "java.lang.String" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForStringFull", new String[] { "String" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForStringFull", new String[] { "java.lang.String" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForStringArray", new String[] { "String[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForStringArray", new String[] { "java.lang.String[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForStringArrayFull", new String[] { "String[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForStringArrayFull", new String[] { "java.lang.String[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClass", new String[] { "AnyClass" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClass", new String[] { "blade.migrate.liferay70.AnyClass" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClass", new String[] { "anypackage.AnyClass" });
assertNotNull(searchResults);
assertEquals(0, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassArray", new String[] { "AnyClass[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassArray", new String[] { "blade.migrate.liferay70.AnyClass[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassArray", new String[] { "anypackage.AnyClass[]" });
assertNotNull(searchResults);
assertEquals(0, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassFull", new String[] { "AnyClass" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassFull", new String[] { "anypackage.AnyClass" });
assertNotNull(searchResults);
assertEquals(0, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassFull", new String[] { "blade.migrate.liferay70.AnyClass" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassArrayFull", new String[] { "AnyClass[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassArrayFull", new String[] { "blade.migrate.liferay70.AnyClass[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForClassArrayFull", new String[] { "anypackage.AnyClass[]" });
assertNotNull(searchResults);
assertEquals(0, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForObject", new String[] { "Object" });
assertNotNull(searchResults);
assertEquals(6, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForObject", new String[] { "java.lang.Object" });
assertNotNull(searchResults);
assertEquals(6, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForObjectFull", new String[] { "Object" });
assertNotNull(searchResults);
assertEquals(6, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForObjectFull", new String[] { "java.lang.Object" });
assertNotNull(searchResults);
assertEquals(6, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForLong", new String[] { "long" });
assertNotNull(searchResults);
assertEquals(12, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForLongClass", new String[] { "Long" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForLongClassFull", new String[] { "java.lang.Long" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForLongArray", new String[] { "long[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForLongArrayClass", new String[] { "Long[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForLongArrayClassFull", new String[] { "java.lang.Long[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForInt", new String[] { "int" });
assertNotNull(searchResults);
assertEquals(9, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForIntClass", new String[] { "Integer" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForIntClassFull", new String[] { "java.lang.Integer" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForIntArray", new String[] { "int[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForIntArrayClass", new String[] { "Integer[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForIntArrayClassFull", new String[] { "java.lang.Integer[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForShort", new String[] { "short" });
assertNotNull(searchResults);
assertEquals(6, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForShortClass", new String[] { "Short" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForShortClassFull", new String[] { "java.lang.Short" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForShortArray", new String[] { "short[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForShortArrayClass", new String[] { "Short[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForShortArrayClassFull", new String[] { "java.lang.Short[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForByte", new String[] { "byte" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForByteClass", new String[] { "Byte" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForByteClassFull", new String[] { "java.lang.Byte" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForByteArray", new String[] { "byte[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForByteArrayClass", new String[] { "Byte[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForByteArrayClassFull", new String[] { "java.lang.Byte[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForDouble", new String[] { "double" });
assertNotNull(searchResults);
assertEquals(6, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForDoubleClass", new String[] { "Double" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForDoubleClassFull", new String[] { "java.lang.Double" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForDoubleArray", new String[] { "double[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForDoubleArrayClass", new String[] { "Double[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForDoubleArrayClassFull", new String[] { "java.lang.Double[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForFloat", new String[] { "float" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForFloatClass", new String[] { "Float" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForFloatClassFull", new String[] { "java.lang.Float" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForFloatArray", new String[] { "float[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForFloatArrayClass", new String[] { "Float[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForFloatArrayClassFull", new String[] { "java.lang.Float[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForObjectArray", new String[] { "Object[]" });
assertNotNull(searchResults);
assertEquals(20, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForObjectArrayFull", new String[] { "java.lang.Object[]" });
assertNotNull(searchResults);
assertEquals(20, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForChar", new String[] { "char" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForCharClass", new String[] { "Character" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForCharClassFull", new String[] { "java.lang.Character" });
assertNotNull(searchResults);
assertEquals(3, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForCharArray", new String[] { "char[]" });
assertNotNull(searchResults);
assertEquals(1, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForCharArrayClass", new String[] { "Character[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
searchResults = javaFileChecker.findMethodInvocations("Foo", null, "barForCharArrayClassFull", new String[] { "java.lang.Character[]" });
assertNotNull(searchResults);
assertEquals(2, searchResults.size());
}
use of com.liferay.blade.api.SearchResult in project liferay-ide by liferay.
the class JavaFileJDTTest method checkGuessMethodInvocation.
@Test
public void checkGuessMethodInvocation() throws Exception {
File file = new File("tests/files/JavaFileChecker.java");
final BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
final Collection<ServiceReference<JavaFile>> sr = context.getServiceReferences(JavaFile.class, "(file.extension=java)");
JavaFile javaFileChecker = context.getService(sr.iterator().next());
javaFileChecker.setFile(file);
List<SearchResult> results = javaFileChecker.findMethodInvocations(null, "JavaFileChecker", "staticCall", new String[] { "String", "String", "String" });
assertNotNull(results);
assertEquals(4, results.size());
results = javaFileChecker.findMethodInvocations("JavaFileChecker", null, "call", new String[] { "String", "String", "String" });
assertNotNull(results);
assertEquals(4, results.size());
}
Aggregations