Skip to content

Commit 6d28f58

Browse files
author
Jeff Bornemann
committed
JCRNodeDecorator class name matches file name
1 parent 943fe81 commit 6d28f58

10 files changed

Lines changed: 47 additions & 47 deletions

File tree

src/main/groovy/com/twcable/grabbit/client/batch/steps/jcrnodes/JcrNodesWriter.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.twcable.grabbit.client.batch.steps.jcrnodes
1818

1919
import com.twcable.grabbit.client.batch.ClientBatchJobContext
20-
import com.twcable.grabbit.jcr.JcrNodeDecorator
20+
import com.twcable.grabbit.jcr.JCRNodeDecorator
2121
import com.twcable.grabbit.jcr.ProtoNodeDecorator
2222
import com.twcable.grabbit.proto.NodeProtos.Node as ProtoNode
2323
import groovy.transform.CompileStatic
@@ -88,7 +88,7 @@ class JcrNodesWriter implements ItemWriter<ProtoNode>, ItemWriteListener {
8888
}
8989

9090
private static void writeToJcr(ProtoNode nodeProto, Session session) {
91-
JcrNodeDecorator jcrNode = ProtoNodeDecorator.createFrom(nodeProto).writeToJcr(session)
91+
JCRNodeDecorator jcrNode = ProtoNodeDecorator.createFrom(nodeProto).writeToJcr(session)
9292
jcrNode.setLastModified()
9393
}
9494

src/main/groovy/com/twcable/grabbit/jcr/AuthorizableProtoNodeDecorator.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AuthorizableProtoNodeDecorator extends ProtoNodeDecorator {
5151

5252

5353
@Override
54-
JcrNodeDecorator writeToJcr(@Nonnull Session session) {
54+
JCRNodeDecorator writeToJcr(@Nonnull Session session) {
5555
if(!checkSecurityPermissions()) {
5656
throw new InsufficientGrabbitPrivilegeException("JVM Permissions needed by Grabbit to sync Users/Groups were not found. See log for specific permissions needed, and add these to your security manager; or do not sync users and groups." +
5757
"Unfortunately, the way Jackrabbit goes about certain things requires us to do a bit of hacking in order to sync Authorizables securely, and efficiently.")
@@ -60,7 +60,7 @@ class AuthorizableProtoNodeDecorator extends ProtoNodeDecorator {
6060
Authorizable newAuthorizable = existingAuthorizable ? updateAuthorizable(existingAuthorizable, session) : createNewAuthorizable(session)
6161
updateProfile(newAuthorizable, session)
6262
updatePreferences(newAuthorizable, session)
63-
return new JcrNodeDecorator(session.getNode(newAuthorizable.getPath()))
63+
return new JCRNodeDecorator(session.getNode(newAuthorizable.getPath()))
6464
}
6565

6666

src/main/groovy/com/twcable/grabbit/jcr/DefaultProtoNodeDecorator.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DefaultProtoNodeDecorator extends ProtoNodeDecorator {
4242

4343

4444
@Override
45-
JcrNodeDecorator writeToJcr(@Nonnull Session session) {
45+
JCRNodeDecorator writeToJcr(@Nonnull Session session) {
4646
final jcrNode = getOrCreateNode(session)
4747
//Write mixin types first to avoid InvalidConstraintExceptions
4848
final mixinProperty = getMixinProperty()
@@ -57,7 +57,7 @@ class DefaultProtoNodeDecorator extends ProtoNodeDecorator {
5757
createFrom(childNode).writeToJcr(session)
5858
}
5959
}
60-
return new JcrNodeDecorator(jcrNode)
60+
return new JCRNodeDecorator(jcrNode)
6161
}
6262

6363

src/main/groovy/com/twcable/grabbit/jcr/JCRNodeDecorator.groovy

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE
3636

3737
@CompileStatic
3838
@Slf4j
39-
class JcrNodeDecorator {
39+
class JCRNodeDecorator {
4040

4141
@Delegate
4242
JCRNode innerNode
4343

4444
private final Collection<JcrPropertyDecorator> properties
4545

4646
//Evaluated in a lazy fashion
47-
private Collection<JcrNodeDecorator> immediateChildNodes
47+
private Collection<JCRNodeDecorator> immediateChildNodes
4848

4949

50-
JcrNodeDecorator(@Nonnull JCRNode node) {
50+
JCRNodeDecorator(@Nonnull JCRNode node) {
5151
if(!node) throw new IllegalArgumentException("node must not be null!")
5252
this.innerNode = node
5353
Collection<JcrProperty> innerProperties = node.properties.toList()
@@ -60,9 +60,9 @@ class JcrNodeDecorator {
6060
/**
6161
* @return this node's immediate children, empty if none
6262
*/
63-
Collection<JcrNodeDecorator> getImmediateChildNodes() {
63+
Collection<JCRNodeDecorator> getImmediateChildNodes() {
6464
if(!immediateChildNodes) {
65-
immediateChildNodes = (getNodes().collect { JCRNode node -> new JcrNodeDecorator(node) } ?: []) as Collection<JcrNodeDecorator>
65+
immediateChildNodes = (getNodes().collect { JCRNode node -> new JCRNodeDecorator(node) } ?: []) as Collection<JCRNodeDecorator>
6666
}
6767
return immediateChildNodes
6868
}
@@ -88,7 +88,7 @@ class JcrNodeDecorator {
8888
* @return list of immediate required child nodes that must be transported with this node, or an empty collection if no required nodes
8989
*/
9090
@Nullable
91-
Collection<JcrNodeDecorator> getRequiredChildNodes() {
91+
Collection<JCRNodeDecorator> getRequiredChildNodes() {
9292
return isAuthorizableType() ? getAuthorizablePieceChildren() : getMandatoryChildren()
9393
}
9494

@@ -97,18 +97,18 @@ class JcrNodeDecorator {
9797
* Some child nodes must be transported with authorizables. This is because authorizable nodes have different UUID names from server to server
9898
*/
9999
@Nonnull
100-
private Collection<JcrNodeDecorator> getAuthorizablePieceChildren() {
101-
final Collection<JcrNodeDecorator> authorizableParts = getImmediateChildNodes().findAll { JcrNodeDecorator childJcrNode -> childJcrNode.isAuthorizablePart()}
100+
private Collection<JCRNodeDecorator> getAuthorizablePieceChildren() {
101+
final Collection<JCRNodeDecorator> authorizableParts = getImmediateChildNodes().findAll { JCRNodeDecorator childJcrNode -> childJcrNode.isAuthorizablePart()}
102102
//We don't send login tokens, because it's not a great idea from a security perspective; and we have no great way of writing them anyway
103-
return authorizableParts.findAll { JcrNodeDecorator childJcrNode -> !childJcrNode.isLoginToken() }
103+
return authorizableParts.findAll { JCRNodeDecorator childJcrNode -> !childJcrNode.isLoginToken() }
104104
}
105105

106106
/**
107107
* Some nodes must be saved together, per node definition
108108
*/
109109
@Nonnull
110-
private Collection<JcrNodeDecorator> getMandatoryChildren() {
111-
return hasMandatoryChildNodes() ? getImmediateChildNodes().findAll{ JcrNodeDecorator childJcrNode -> childJcrNode.isMandatoryNode() } : []
110+
private Collection<JCRNodeDecorator> getMandatoryChildren() {
111+
return hasMandatoryChildNodes() ? getImmediateChildNodes().findAll{ JCRNodeDecorator childJcrNode -> childJcrNode.isMandatoryNode() } : []
112112
}
113113

114114

src/main/groovy/com/twcable/grabbit/jcr/JcrPropertyDecorator.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class JcrPropertyDecorator {
3737
@Delegate
3838
JCRProperty innerProperty
3939

40-
private final JcrNodeDecorator nodeOwner
40+
private final JCRNodeDecorator nodeOwner
4141

42-
JcrPropertyDecorator(JCRProperty property, JcrNodeDecorator nodeOwner) {
42+
JcrPropertyDecorator(JCRProperty property, JCRNodeDecorator nodeOwner) {
4343
this.innerProperty = property
4444
this.nodeOwner = nodeOwner
4545
}

src/main/groovy/com/twcable/grabbit/jcr/ProtoNodeDecorator.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class ProtoNodeDecorator {
3030

3131
protected Collection<ProtoPropertyDecorator> protoProperties
3232

33-
abstract JcrNodeDecorator writeToJcr(@Nonnull Session session)
33+
abstract JCRNodeDecorator writeToJcr(@Nonnull Session session)
3434

3535
static ProtoNodeDecorator createFrom(@Nonnull ProtoNode node, String nameOverride = null) {
3636
if(!node) throw new IllegalArgumentException("node must not be null!")

src/main/groovy/com/twcable/grabbit/server/batch/steps/jcrnodes/JcrNodesProcessor.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.twcable.grabbit.server.batch.steps.jcrnodes
1818

1919
import com.twcable.grabbit.DateUtil
20-
import com.twcable.grabbit.jcr.JcrNodeDecorator
20+
import com.twcable.grabbit.jcr.JCRNodeDecorator
2121
import com.twcable.grabbit.proto.NodeProtos.Node as ProtoNode
2222
import groovy.transform.CompileStatic
2323
import groovy.util.logging.Slf4j
@@ -47,7 +47,7 @@ class JcrNodesProcessor implements ItemProcessor<JcrNode, ProtoNode> {
4747
@Nullable
4848
ProtoNode process(JcrNode jcrNode) throws Exception {
4949

50-
JcrNodeDecorator decoratedNode = new JcrNodeDecorator(jcrNode)
50+
JCRNodeDecorator decoratedNode = new JCRNodeDecorator(jcrNode)
5151

5252
//TODO: Access Control Lists nodes are not supported right now.
5353
if (decoratedNode.path.contains("rep:policy")) {

src/main/groovy/com/twcable/grabbit/server/services/RootNodeWithMandatoryIterator.groovy

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.twcable.grabbit.server.services
1818

19-
import com.twcable.grabbit.jcr.JcrNodeDecorator
19+
import com.twcable.grabbit.jcr.JCRNodeDecorator
2020
import groovy.transform.CompileStatic
2121
import groovy.transform.TailRecursive
2222

@@ -31,13 +31,13 @@ import javax.jcr.Node as JcrNode
3131
final class RootNodeWithMandatoryIterator implements Iterator<JcrNode> {
3232

3333
private boolean doneRoot
34-
private JcrNodeDecorator rootNode
35-
private Iterator<JcrNodeDecorator> immediateChildren
36-
private Iterator<JcrNodeDecorator> mandatoryWriteNodes
34+
private JCRNodeDecorator rootNode
35+
private Iterator<JCRNodeDecorator> immediateChildren
36+
private Iterator<JCRNodeDecorator> mandatoryWriteNodes
3737

3838

3939
public RootNodeWithMandatoryIterator(JcrNode root) {
40-
this.rootNode = new JcrNodeDecorator(root)
40+
this.rootNode = new JCRNodeDecorator(root)
4141
this.doneRoot = false
4242
//Get all immediate children that are not mandatory write nodes. We will handle those by iterating over mandatoryWriteNodes
4343
immediateChildren = getNonMandatoryChildren(this.rootNode).iterator()
@@ -76,20 +76,20 @@ final class RootNodeWithMandatoryIterator implements Iterator<JcrNode> {
7676
}
7777

7878

79-
private static Collection<JcrNodeDecorator> getNonMandatoryChildren(final JcrNodeDecorator node) {
79+
private static Collection<JCRNodeDecorator> getNonMandatoryChildren(final JCRNodeDecorator node) {
8080
node.getImmediateChildNodes().findAll { !it.isMandatoryNode() }
8181
}
8282

8383

8484
@TailRecursive
85-
private static Collection<JcrNodeDecorator> getMandatoryChildren(final JcrNodeDecorator currentNode, final Collection<JcrNodeDecorator> nodesToAdd) {
85+
private static Collection<JCRNodeDecorator> getMandatoryChildren(final JCRNodeDecorator currentNode, final Collection<JCRNodeDecorator> nodesToAdd) {
8686
if(!currentNode.hasMandatoryChildNodes()) {
8787
return nodesToAdd
8888
}
8989

9090
final mandatoryNodes = currentNode.getRequiredChildNodes()
9191

92-
return mandatoryNodes.collectMany { JcrNodeDecorator mandatoryNode ->
92+
return mandatoryNodes.collectMany { JCRNodeDecorator mandatoryNode ->
9393
return getMandatoryChildren(mandatoryNode, (nodesToAdd << mandatoryNode))
9494
}
9595
}

src/test/groovy/com/twcable/grabbit/jcr/JCRNodeDecoratorSpec.groovy

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class JCRNodeDecoratorSpec extends Specification {
5555

5656
def "null nodes are not allowed for JCRNodeDecorator construction"() {
5757
when:
58-
new JcrNodeDecorator(null)
58+
new JCRNodeDecorator(null)
5959

6060
then:
6161
thrown(IllegalArgumentException)
@@ -118,7 +118,7 @@ class JCRNodeDecoratorSpec extends Specification {
118118
}
119119

120120
when:
121-
final ProtoNode protoNode = new JcrNodeDecorator(node).toProtoNode()
121+
final ProtoNode protoNode = new JCRNodeDecorator(node).toProtoNode()
122122

123123
then:
124124
protoNode.getName() == '/some/path'
@@ -141,7 +141,7 @@ class JCRNodeDecoratorSpec extends Specification {
141141
}
142142

143143
when:
144-
final nodeDecorator = new JcrNodeDecorator(node)
144+
final nodeDecorator = new JCRNodeDecorator(node)
145145
nodeDecorator.setLastModified()
146146

147147
then:
@@ -165,7 +165,7 @@ class JCRNodeDecoratorSpec extends Specification {
165165
}
166166

167167
when:
168-
final nodeDecorator = new JcrNodeDecorator(node)
168+
final nodeDecorator = new JCRNodeDecorator(node)
169169
nodeDecorator.setLastModified()
170170

171171
then:
@@ -187,7 +187,7 @@ class JCRNodeDecoratorSpec extends Specification {
187187
}
188188
189189
when:
190-
final nodeDecorator = new JcrNodeDecorator(node)
190+
final nodeDecorator = new JCRNodeDecorator(node)
191191
nodeDecorator.setLastModified()
192192
193193
then:
@@ -210,7 +210,7 @@ class JCRNodeDecoratorSpec extends Specification {
210210
}
211211
212212
when:
213-
final nodeDecorator = new JcrNodeDecorator(node)
213+
final nodeDecorator = new JCRNodeDecorator(node)
214214
215215
then:
216216
nodeDecorator.isMandatoryNode() == isMandatory
@@ -238,7 +238,7 @@ class JCRNodeDecoratorSpec extends Specification {
238238
}
239239
240240
when:
241-
final nodeDecorator = new JcrNodeDecorator(node)
241+
final nodeDecorator = new JCRNodeDecorator(node)
242242
243243
then:
244244
nodeDecorator.hasMandatoryChildNodes() == hasMandatoryChildNodes
@@ -322,7 +322,7 @@ class JCRNodeDecoratorSpec extends Specification {
322322
}
323323
324324
when: "The node has mandatory children"
325-
final nodeDecorator = Spy(JcrNodeDecorator, constructorArgs: [nodeWithMandatoryChildren]) {
325+
final nodeDecorator = Spy(JCRNodeDecorator, constructorArgs: [nodeWithMandatoryChildren]) {
326326
hasMandatoryChildNodes() >> true
327327
isAuthorizableType() >> false
328328
}
@@ -333,7 +333,7 @@ class JCRNodeDecoratorSpec extends Specification {
333333
and: "The node has authorizable pieces"
334334
335335
when:
336-
final otherNodeDecorator = Spy(JcrNodeDecorator, constructorArgs: [authorizableNode]) {
336+
final otherNodeDecorator = Spy(JCRNodeDecorator, constructorArgs: [authorizableNode]) {
337337
hasMandatoryChildNodes() >> false
338338
isAuthorizableType() >> true
339339
}
@@ -344,7 +344,7 @@ class JCRNodeDecoratorSpec extends Specification {
344344
and: "If no child nodes, getRequiredChildNodes() returns an empty collection"
345345
346346
when:
347-
final yetAnotherNodeDecorator = Spy(JcrNodeDecorator, constructorArgs: [nodeWithMandatoryChildren]) {
347+
final yetAnotherNodeDecorator = Spy(JCRNodeDecorator, constructorArgs: [nodeWithMandatoryChildren]) {
348348
hasMandatoryChildNodes() >> false
349349
isAuthorizableType() >> false
350350
}
@@ -364,7 +364,7 @@ class JCRNodeDecoratorSpec extends Specification {
364364
toList() >> []
365365
}
366366
}
367-
final nodeDecorator = new JcrNodeDecorator(node)
367+
final nodeDecorator = new JCRNodeDecorator(node)
368368
369369
expect:
370370
(nodeDecorator as Node) == node
@@ -392,7 +392,7 @@ class JCRNodeDecoratorSpec extends Specification {
392392
toList() >> []
393393
}
394394
}
395-
final nodeDecorator = new JcrNodeDecorator(node)
395+
final nodeDecorator = new JCRNodeDecorator(node)
396396
397397
expect:
398398
nodeDecorator.getModifiedOrCreatedDate() == modifiedDate
@@ -422,7 +422,7 @@ class JCRNodeDecoratorSpec extends Specification {
422422
}
423423
424424
when:
425-
final JcrNodeDecorator jcrNodeDecorator = new JcrNodeDecorator(node)
425+
final JCRNodeDecorator jcrNodeDecorator = new JCRNodeDecorator(node)
426426
427427
then:
428428
jcrNodeDecorator.isAuthorizablePart() == expected
@@ -453,7 +453,7 @@ class JCRNodeDecoratorSpec extends Specification {
453453
}
454454
455455
expect:
456-
!new JcrNodeDecorator(node).isAuthorizablePart()
456+
!new JCRNodeDecorator(node).isAuthorizablePart()
457457
}
458458
459459
@Unroll
@@ -469,7 +469,7 @@ class JCRNodeDecoratorSpec extends Specification {
469469
}
470470
471471
when:
472-
final JcrNodeDecorator jcrNodeDecorator = new JcrNodeDecorator(node)
472+
final JCRNodeDecorator jcrNodeDecorator = new JCRNodeDecorator(node)
473473
474474
then:
475475
jcrNodeDecorator.isAuthorizableType() == expected
@@ -496,7 +496,7 @@ class JCRNodeDecoratorSpec extends Specification {
496496
}
497497
498498
when:
499-
final JcrNodeDecorator jcrNodeDecorator = new JcrNodeDecorator(node)
499+
final JCRNodeDecorator jcrNodeDecorator = new JCRNodeDecorator(node)
500500
501501
then:
502502
jcrNodeDecorator.isLoginToken() == expected

src/test/groovy/com/twcable/grabbit/jcr/JcrPropertyDecoratorSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class JcrPropertyDecoratorSpec extends Specification {
3838
isProtected() >> protectedFlag
3939
}
4040
}
41-
final nodeOwner = Mock(JcrNodeDecorator) {
41+
final nodeOwner = Mock(JCRNodeDecorator) {
4242
isAuthorizableType() >> authorizableType
4343
}
4444

0 commit comments

Comments
 (0)