Skip to content

Commit

Permalink
NO AUTO Deprecate apoc.create.uuid and apoc.create.uuids (#3078)
Browse files Browse the repository at this point in the history
  • Loading branch information
gem-neo4j authored Aug 9, 2022
1 parent f636d74 commit 9032fb6
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 33 deletions.
14 changes: 8 additions & 6 deletions core/src/main/java/apoc/create/Create.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,27 @@ private <T extends Entity> void setProperty(T pc, String key, Object value) {
else pc.setProperty(key, toPropertyValue(value));
}

@UserFunction
@Description("apoc.create.uuid() - creates an UUID")
@UserFunction(deprecatedBy = "Neo4j randomUUID() function")
@Deprecated
@Description("apoc.create.uuid() - creates a UUID")
public String uuid() {
return UUID.randomUUID().toString();
}

@UserFunction
@Description("apoc.create.uuidBase64() - create an UUID encoded with Base64")
@Description("apoc.create.uuidBase64() - create a UUID encoded with Base64")
public String uuidBase64() {
return UuidUtil.generateBase64Uuid(UUID.randomUUID());
}

@UserFunction
@Description("apoc.create.uuidBase64ToHex() - convert between an UUID encoded with Base64 to HEX format")
@Description("apoc.create.uuidBase64ToHex() - convert between a UUID encoded with Base64 to HEX format")
public String uuidBase64ToHex(@Name("base64Uuid") String base64Uuid) {
return UuidUtil.fromBase64ToHex(base64Uuid);
}

@UserFunction
@Description("apoc.create.uuidHexToBase64() - convert an UUID in HEX format to encoded with Base64")
@Description("apoc.create.uuidHexToBase64() - convert a UUID in HEX format to encoded with Base64")
public String uuidHexToBase64(@Name("uuidHex") String uuidHex) {
return UuidUtil.fromHexToBase64(uuidHex);
}
Expand All @@ -264,7 +265,8 @@ private Object toPropertyValue(Object value) {
return value;
}

@Procedure
@Procedure(deprecatedBy = "Neo4j's randomUUID() function can be used as a replacement, for example: `UNWIND range(0,$count) AS row RETURN row, randomUUID() AS uuid`")
@Deprecated
@Description("apoc.create.uuids(count) yield uuid - creates 'count' UUIDs ")
public Stream<UUIDResult> uuids(@Name("count") long count) {
return LongStream.range(0, count).mapToObj(UUIDResult::new);
Expand Down
10 changes: 5 additions & 5 deletions docs/asciidoc/antora.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: apoc
version: 4.2
version: 5.0
title: APOC Documentation
nav:
- modules/ROOT/nav.adoc
asciidoc:
attributes:
docs-version: "4.3"
branch: "4.3"
apoc-release-absolute: "4.3"
apoc-release: "5.0.0.0-rc01"
docs-version: "5.0"
branch: "5.0"
apoc-release-absolute: "5.0"
apoc-release: "5.0.0-rc01"
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ apoc.create.virtualPath(['LabelA'],{key:value},'KNOWS',{key:value,...},['LabelB'
|label:apoc-core[]
|xref::overview/apoc.create/apoc.create.adoc[apoc.create.uuid icon:book[]]

apoc.create.uuid() - creates an UUID
apoc.create.uuid() - creates a UUID
|label:function[]
|label:apoc-core[]
|xref::overview/apoc.create/apoc.create.adoc[apoc.create.vNode icon:book[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.create/apoc.create.uuid.adoc[apoc.create.uuid icon:book[]] +

`apoc.create.uuid()` - creates an UUID
`apoc.create.uuid()` - creates a UUID
¦label:function[]
¦label:apoc-core[]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
¦type¦qualified name¦signature¦description
¦function¦apoc.create.uuid¦apoc.create.uuid() :: (STRING?)¦apoc.create.uuid() - creates an UUID
¦function¦apoc.create.uuid¦apoc.create.uuid() :: (STRING?)¦apoc.create.uuid() - creates a UUID
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.create/apoc.create.uuidBase64.adoc[apoc.create.uuidBase64 icon:book[]] +

- create an UUID encoded with Base64
`apoc.create.uuidBase64()` - create a UUID encoded with Base64
¦label:function[]
¦label:apoc-core[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.create/apoc.create.uuidBase64ToHex.adoc[apoc.create.uuidBase64ToHex icon:book[]] +

- convert between an UUID encoded with Base64 to HEX format
`apoc.create.uuidBase64ToHex()` - convert between a UUID encoded with Base64 to HEX format
¦label:function[]
¦label:apoc-core[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.create/apoc.create.uuidHexToBase64.adoc[apoc.create.uuidHexToBase64 icon:book[]] +

- convert an UUID in HEX format to encoded with Base64
`apoc.create.uuidHexToBase64()` - convert a UUID in HEX format to encoded with Base64
¦label:function[]
¦label:apoc-core[]
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ for the provided `label` and `uuidProperty`, in case the UUID handler is already
¦function¦apoc.convert.toSortedJsonMap¦apoc.convert.toSortedJsonMap(value :: ANY?, ignoreCase = true :: BOOLEAN?) :: (STRING?)¦apoc.convert.toSortedJsonMap(node|map, ignoreCase:true) - returns a JSON map with keys sorted alphabetically, with optional case sensitivity¦true¦
¦function¦apoc.convert.toString¦apoc.convert.toString(string :: ANY?) :: (STRING?)¦apoc.convert.toString(value) | tries it's best to convert the value to a string¦true¦
¦function¦apoc.convert.toStringList¦apoc.convert.toStringList(list :: ANY?) :: (LIST? OF ANY?)¦apoc.convert.toStringList(value) | tries it's best to convert the value to a list of strings¦true¦
¦function¦apoc.create.uuid¦apoc.create.uuid() :: (STRING?)¦apoc.create.uuid() - creates an UUID¦true¦xref::graph-updates/uuid.adoc
¦function¦apoc.create.uuid¦apoc.create.uuid() :: (STRING?)¦apoc.create.uuid() - creates a UUID¦true¦xref::graph-updates/uuid.adoc
¦function¦apoc.create.vNode¦apoc.create.vNode(label :: LIST? OF STRING?, props = {} :: MAP?) :: (NODE?)¦apoc.create.vNode(['Label'], {key:value,...}) returns a virtual node¦true¦xref::virtual/virtual-nodes-rels.adoc
¦function¦apoc.create.vRelationship¦apoc.create.vRelationship(from :: NODE?, relType :: STRING?, props :: MAP?, to :: NODE?) :: (RELATIONSHIP?)¦apoc.create.vRelationship(nodeFrom,'KNOWS',{key:value,...}, nodeTo) returns a virtual relationship¦true¦xref::virtual/virtual-nodes-rels.adoc
¦function¦apoc.create.virtual.fromNode¦apoc.create.virtual.fromNode(node :: NODE?, propertyNames :: LIST? OF STRING?) :: (NODE?)¦apoc.create.virtual.fromNode(node, [propertyNames]) returns a virtual node built from an existing node with only the requested properties¦true¦xref::virtual/virtual-nodes-rels.adoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,43 @@ This chapter lists all the features that have been removed, deprecated, added or
[[apoc-deprecations-additions-removals-5.0]]
== Version 5.0

=== Removed procedures
=== Deprecated procedures and functions

[cols="2", options="header"]
|===
| Feature
| Details
a|
label:function[]
label:deprecated[]
[source, cypher, role="noheader"]
----
RETURN apoc.create.uuid()
----
a|
Replaced by Neo4j Function randomUUID():
[source, cypher, role="noheader"]
----
RETURN randomUUID()
----

a|
label:procedure[]
label:deprecated[]
[source, cypher, role="noheader"]
----
CALL apoc.create.uuids($count)
----
a|
Replaced by Neo4j Function randomUUID():
[source, cypher, role="noheader"]
----
UNWIND range(0,$count) AS row RETURN row, randomUUID() AS uuid
----

|===

=== Removed procedures and functions

[cols="2", options="header"]
|===
Expand Down
5 changes: 5 additions & 0 deletions docs/asciidoc/modules/ROOT/pages/graph-updates/uuid.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ RETURN apoc.create.uuid() AS uuid;
| "1051af4f-b81d-4a76-8605-ecfb8ef703d5"
|===

[NOTE]
====
This function has been deprecated and will be removed in upcoming versions of APOC. Use Neo4j's `randomUUID()` function instead.
====

The following creates a `Person` node, using a UUID as the merging key:

[source, cypher]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ This file is generated by DocsTest, so don't change it!
= apoc.create.uuid
:description: This section contains reference documentation for the apoc.create.uuid function.

label:function[] label:apoc-core[]
label:function[] label:apoc-core[] label:deprecated[]

[.emphasis]
apoc.create.uuid() - creates an UUID
apoc.create.uuid() - creates a UUID

== Signature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file is generated by DocsTest, so don't change it!
label:function[] label:apoc-core[]

[.emphasis]
apoc.create.uuidBase64() - create an UUID encoded with Base64
apoc.create.uuidBase64() - create a UUID encoded with Base64

== Signature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file is generated by DocsTest, so don't change it!
label:function[] label:apoc-core[]

[.emphasis]
apoc.create.uuidBase64ToHex() - convert between an UUID encoded with Base64 to HEX format
apoc.create.uuidBase64ToHex() - convert between a UUID encoded with Base64 to HEX format

== Signature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file is generated by DocsTest, so don't change it!
label:function[] label:apoc-core[]

[.emphasis]
apoc.create.uuidHexToBase64() - convert an UUID in HEX format to encoded with Base64
apoc.create.uuidHexToBase64() - convert a UUID in HEX format to encoded with Base64

== Signature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This file is generated by DocsTest, so don't change it!
= apoc.create.uuids
:description: This section contains reference documentation for the apoc.create.uuids procedure.

label:procedure[] label:apoc-core[]
label:procedure[] label:apoc-core[] label:deprecated[]

[.emphasis]
apoc.create.uuids(count) yield uuid - creates 'count' UUIDs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ apoc.create.virtualPath(['LabelA'],{key:value},'KNOWS',{key:value,...},['LabelB'
|label:apoc-core[]
|xref::overview/apoc.create/apoc.create.uuid.adoc[apoc.create.uuid icon:book[]]

apoc.create.uuid() - creates an UUID
apoc.create.uuid() - creates a UUID
|label:function[]
|label:apoc-core[]
|xref::overview/apoc.create/apoc.create.vNode.adoc[apoc.create.vNode icon:book[]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The config is composed by the following parameters:
* *write*, _type boolean_: persist the graph otherwise return a Virtual Graph, default *false*
* *labelField*, _type String_: the field name that became the label of the node, default *type*
* *idField*, _type String_: the document field name that will become the id field of the created nodes (used for node resolution when you create relationships between nodes), default *id*
* *generateId*, _type boolean_: in case of missing id-field value it generates an UUID for it, default *true*
* *generateId*, _type boolean_: in case of missing id-field value it generates a UUID for it, default *true*
* *defaultLabel*, _type String_: in case of missing label-field value is uses the provided default label, default is empty
* *skipValidation*, _type boolean_: in case you want skip the validation process into the `apoc.graph.fromDocument` procedure *false*
* *mappings*, _type Map<String, String>_: you can use a JSON path like syntax for:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ apoc.create.virtualPath(['LabelA'],{key:value},'KNOWS',{key:value,...},['LabelB'
|label:apoc-core[]
|xref::overview/apoc.create/apoc.create.uuid.adoc[apoc.create.uuid icon:book[]]

apoc.create.uuid() - creates an UUID
apoc.create.uuid() - creates a UUID
|label:function[]
|label:apoc-core[]
|xref::overview/apoc.create/apoc.create.vNode.adoc[apoc.create.vNode icon:book[]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The following converts an UUID encoded with Base64 to HEX representation:
The following converts a UUID encoded with Base64 to HEX representation:

[source,cypher]
----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The following converts an UUID encoded with Base64 to HEX representation:
The following converts a UUID encoded with Base64 to HEX representation:

[source,cypher]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The procedure support the following config parameters:
| write | boolean | false | persist the graph otherwise return a Virtual Graph
| labelField | String | type | the field name that became the label of the node
| idField | String | id | the document field name that will become the id field of the created nodes (used for node resolution when you create relationships between nodes)
| generateId | boolean | true | in case of missing id-field value it generates an UUID for it
| generateId | boolean | true | in case of missing id-field value it generates a UUID for it
| defaultLabel | String | "" | in case of missing label-field value is uses the provided default label
| skipValidation | boolean | false | in case you want skip the validation process into the `apoc.graph.fromDocument`
| mappings | Map<String, String> | {} | click on link below for more detail
Expand Down
2 changes: 1 addition & 1 deletion docs/guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ <h3>Creating Data</h3>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CALL apoc.create.uuid YIELD uuid</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">creates an UUID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">creates a UUID</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CALL apoc.create.uuids(count) YIELD uuid</code></p></td>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ <h3 id="_creating_data"><a class="link" href="#_creating_data">Creating Data</a>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>apoc.create.uuid()</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">returns an UUID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">returns a UUID</p></td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit 9032fb6

Please sign in to comment.