Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update moved procedures to have new class names #4257

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package apoc.export.arrow;

import apoc.Extended;
import apoc.Pools;
import apoc.export.util.NodesAndRelsSubGraph;
import apoc.result.ByteArrayResult;
Expand Down Expand Up @@ -45,7 +46,8 @@
import java.util.Map;
import java.util.stream.Stream;

public class ExportArrow {
@Extended
public class ExportArrowExtended {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Extended annotation


@Context
public Transaction tx;
Expand All @@ -63,8 +65,7 @@ public class ExportArrow {
public TerminationGuard terminationGuard;

@NotThreadSafe
@Procedure(name = "apoc.export.arrow.stream.all", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.export.arrow.stream.all")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Exports the full database as an arrow byte array.")
public Stream<ByteArrayResult> all(
Expand All @@ -75,10 +76,7 @@ public Stream<ByteArrayResult> all(
}

@NotThreadSafe
@Procedure(
name = "apoc.export.arrow.stream.graph",
deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.export.arrow.stream.graph")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Exports the given graph as an arrow byte array.")
public Stream<ByteArrayResult> graph(
Expand All @@ -104,10 +102,7 @@ public Stream<ByteArrayResult> graph(
}

@NotThreadSafe
@Procedure(
name = "apoc.export.arrow.stream.query",
deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.export.arrow.stream.query")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Exports the given Cypher query as an arrow byte array.")
public Stream<ByteArrayResult> query(
Expand All @@ -122,8 +117,7 @@ public Stream<ByteArrayResult> query(
}

@NotThreadSafe
@Procedure(name = "apoc.export.arrow.all", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.export.arrow.all")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Exports the full database as an arrow file.")
public Stream<ExportProgressInfo> all(
Expand All @@ -135,8 +129,7 @@ public Stream<ExportProgressInfo> all(
}

@NotThreadSafe
@Procedure(name = "apoc.export.arrow.graph", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.export.arrow.graph")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Exports the given graph as an arrow file.")
public Stream<ExportProgressInfo> graph(
Expand Down Expand Up @@ -164,8 +157,7 @@ public Stream<ExportProgressInfo> graph(
}

@NotThreadSafe
@Procedure(name = "apoc.export.arrow.query", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.export.arrow.query")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Exports the results from the given Cypher query as an arrow file.")
public Stream<ExportProgressInfo> query(
Expand Down
5 changes: 3 additions & 2 deletions extended/src/main/java/apoc/load/LoadJsonExtended.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package apoc.load;

import apoc.Extended;
import apoc.result.LoadDataMapResult;
import apoc.util.CompressionAlgo;
import org.neo4j.graphdb.security.URLAccessChecker;
Expand All @@ -37,6 +38,7 @@
import static apoc.load.LoadJsonUtils.loadJsonStream;
import static apoc.util.CompressionConfig.COMPRESSION;

@Extended
public class LoadJsonExtended {

@Context
Expand All @@ -46,8 +48,7 @@ public class LoadJsonExtended {
public URLAccessChecker urlAccessChecker;

@SuppressWarnings("unchecked")
@Procedure(name = "apoc.load.jsonParams", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.load.jsonParams")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoadJsonExtended with @Extended as well

@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description(
"Loads parameters from a JSON URL (e.g. web-API) as a stream of values if the given JSON file is a `LIST<ANY>`.\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package apoc.load;
package apoc.load.arrow;

import apoc.Extended;
import apoc.result.LoadDataMapResult;
import apoc.util.FileUtils;
import apoc.util.JsonUtil;
Expand Down Expand Up @@ -58,7 +59,8 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class LoadArrow {
@Extended
public class LoadArrowExtended {

@Context
public URLAccessChecker urlAccessChecker;
Expand Down Expand Up @@ -101,8 +103,7 @@ public synchronized boolean tryAdvance(Consumer<? super LoadDataMapResult> actio
}
}

@Procedure(name = "apoc.load.arrow.stream", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.load.arrow.stream")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Imports `NODE` and `RELATIONSHIP` values from the provided arrow byte array.")
public Stream<LoadDataMapResult> stream(
Expand All @@ -123,8 +124,7 @@ public Stream<LoadDataMapResult> stream(
});
}

@Procedure(name = "apoc.load.arrow", deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
@Procedure(name = "apoc.load.arrow")
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Imports `NODE` and `RELATIONSHIP` values from the provided arrow file.")
public Stream<LoadDataMapResult> file(
Expand Down Expand Up @@ -163,7 +163,7 @@ private static Object read(FieldVector fieldVector, int index) {

private static Object getObject(Object object) {
if (object instanceof Collection) {
return ((Collection<?>) object).stream().map(LoadArrow::getObject).collect(Collectors.toList());
return ((Collection<?>) object).stream().map(LoadArrowExtended::getObject).collect(Collectors.toList());
}
if (object instanceof Map) {
return ((Map<String, Object>) object)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package apoc.log;

import apoc.Extended;
import apoc.util.FileUtils;
import org.neo4j.kernel.api.QueryLanguage;
import org.neo4j.kernel.api.procedure.QueryLanguageScope;
Expand All @@ -41,7 +42,8 @@
* @author moxious
* @since 27.02.19
*/
public class Neo4jLogStream {
@Extended
public class Neo4jLogStreamExtended {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Extended annotation


public static class FileEntry implements Comparable<FileEntry> {
@Description("The line number.")
Expand All @@ -67,9 +69,7 @@ public int compareTo(FileEntry o) {
@Admin
@Procedure(
name = "apoc.log.stream",
mode = Mode.DBMS,
deprecatedBy = "This procedure is being moved to APOC Extended.")
@Deprecated
mode = Mode.DBMS)
@QueryLanguageScope(scope = {QueryLanguage.CYPHER_25})
@Description("Returns the file contents from the given log, optionally returning only the last n lines.\n"
+ "This procedure requires users to have an admin role.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package apoc.export.arrow;

import apoc.graph.Graphs;
import apoc.load.LoadArrow;
import apoc.load.arrow.*;
import apoc.meta.Meta;
import apoc.util.JsonUtil;
import apoc.util.TestUtil;
Expand Down Expand Up @@ -50,7 +50,7 @@
import static apoc.ApocConfig.apocConfig;
import static org.junit.Assert.assertEquals;

public class ArrowTest {
public class ArrowExtendedTest {

private static File directory = new File("target/arrow import");

Expand Down Expand Up @@ -128,7 +128,7 @@ public class ArrowTest {
public static void beforeClass() {
db.executeTransactionally(
"CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015-05-18T19:32:24.000'), place:point({latitude: 13.1, longitude: 33.46789, height: 100.0})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42})");
TestUtil.registerProcedure(db, ExportArrow.class, LoadArrow.class, Graphs.class, Meta.class);
TestUtil.registerProcedure(db, ExportArrowExtended.class, LoadArrowExtended.class, Graphs.class, Meta.class);
}

@AfterClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class ImportArrowTest {
public class ImportArrowExtendedTest {
private static File directory = new File("target/arrowImport");
static { //noinspection ResultOfMethodCallIgnored
directory.mkdirs();
Expand All @@ -53,7 +53,7 @@ public class ImportArrowTest {

@BeforeClass
public static void beforeClass() {
TestUtil.registerProcedure(db, ExportArrow.class, ImportArrow.class, Meta.class);
TestUtil.registerProcedure(db, ExportArrowExtended.class, ImportArrow.class, Meta.class);
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import static apoc.util.TestUtil.testResult;
import static org.junit.Assert.assertTrue;

public class Neo4jLogStreamTest {
public class Neo4jLogStreamExtendedTest {

private GraphDatabaseService db;
private DatabaseManagementService dbManagementService;
Expand All @@ -50,7 +50,7 @@ public void setUp() {
.build();
apocConfig().setProperty("server.directories.logs", "");
db = dbManagementService.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
TestUtil.registerProcedure(db, Neo4jLogStream.class);
TestUtil.registerProcedure(db, Neo4jLogStreamExtended.class);
}

@After
Expand Down
Loading