Skip to content

Commit 69c55fd

Browse files
committed
wip
1 parent c96da8d commit 69c55fd

File tree

167 files changed

+2586
-2763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+2586
-2763
lines changed

modules/core/core-api/src/main/java/com/enonic/xp/audit/LogAuditLogParams.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
import java.time.Instant;
44
import java.util.Objects;
55

6-
import com.enonic.xp.context.Context;
7-
import com.enonic.xp.context.ContextAccessor;
86
import com.enonic.xp.data.PropertyTree;
97
import com.enonic.xp.security.PrincipalKey;
10-
import com.enonic.xp.security.User;
118

129
public final class LogAuditLogParams
1310
{
@@ -25,21 +22,14 @@ public final class LogAuditLogParams
2522

2623
private LogAuditLogParams( final Builder builder )
2724
{
28-
type = Objects.requireNonNull( builder.type, "AuditLogParams type cannot be null" );
25+
type = Objects.requireNonNull( builder.type, "LogAuditLogParams type cannot be null" );
2926
time = Objects.requireNonNullElseGet( builder.time, Instant::now );
3027
source = Objects.requireNonNullElse( builder.source, "" );
31-
user = Objects.requireNonNullElseGet( builder.user, this::getUserKey );
28+
user = builder.user;
3229
objectUris = Objects.requireNonNullElse( builder.objectUris, AuditLogUris.empty() );
3330
data = Objects.requireNonNullElse( builder.data, new PropertyTree() );
3431
}
3532

36-
private PrincipalKey getUserKey()
37-
{
38-
final Context context = ContextAccessor.current();
39-
final User user = context.getAuthInfo().getUser() != null ? context.getAuthInfo().getUser() : User.ANONYMOUS;
40-
return user.getKey();
41-
}
42-
4333
public String getType()
4434
{
4535
return type;

modules/core/core-api/src/main/java/com/enonic/xp/content/ActiveContentVersionEntry.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

modules/core/core-api/src/main/java/com/enonic/xp/content/ApplyContentPermissionsParams.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.google.common.base.Preconditions;
44

55
import com.enonic.xp.annotation.PublicApi;
6-
import com.enonic.xp.node.ApplyPermissionsScope;
76
import com.enonic.xp.security.acl.AccessControlList;
87

98
import static java.util.Objects.requireNonNull;
@@ -20,14 +19,14 @@ public final class ApplyContentPermissionsParams
2019

2120
private final AccessControlList removePermissions;
2221

23-
private final ApplyPermissionsScope applyPermissionsScope;
22+
private final ApplyContentPermissionsScope applyPermissionsScope;
2423

2524
private final ApplyPermissionsListener listener;
2625

2726
private ApplyContentPermissionsParams( Builder builder )
2827
{
2928
contentId = requireNonNull( builder.contentId );
30-
applyPermissionsScope = requireNonNullElse( builder.applyPermissionsScope, ApplyPermissionsScope.SINGLE );
29+
applyPermissionsScope = requireNonNullElse( builder.applyPermissionsScope, ApplyContentPermissionsScope.SINGLE );
3130
permissions = builder.permissions.build();
3231
addPermissions = builder.addPermissions.build();
3332
removePermissions = builder.removePermissions.build();
@@ -47,7 +46,7 @@ public ContentId getContentId()
4746
return contentId;
4847
}
4948

50-
public ApplyPermissionsScope getScope()
49+
public ApplyContentPermissionsScope getScope()
5150
{
5251
return applyPermissionsScope;
5352
}
@@ -82,7 +81,7 @@ public static final class Builder
8281

8382
private final AccessControlList.Builder removePermissions = AccessControlList.create();
8483

85-
private ApplyPermissionsScope applyPermissionsScope;
84+
private ApplyContentPermissionsScope applyPermissionsScope;
8685

8786
private ApplyPermissionsListener listener;
8887

@@ -96,7 +95,7 @@ public Builder contentId( final ContentId contentId )
9695
return this;
9796
}
9897

99-
public Builder applyPermissionsScope( final ApplyPermissionsScope applyPermissionsScope )
98+
public Builder applyPermissionsScope( final ApplyContentPermissionsScope applyPermissionsScope )
10099
{
101100
this.applyPermissionsScope = applyPermissionsScope;
102101
return this;
@@ -140,5 +139,4 @@ public ApplyContentPermissionsParams build()
140139
return new ApplyContentPermissionsParams( this );
141140
}
142141
}
143-
144142
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.enonic.xp.content;
2+
3+
public enum ApplyContentPermissionsScope
4+
{
5+
SINGLE, TREE, SUBTREE
6+
}

modules/core/core-api/src/main/java/com/enonic/xp/content/CompareStatus.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,5 @@
55
@PublicApi
66
public enum CompareStatus
77
{
8-
NEW( false, "Offline" ), NEW_TARGET( false, "New in prod" ), NEWER( false, "Modified" ), OLDER( false, "Out-of-date" ), EQUAL( false,
9-
"Online" ), MOVED(
10-
false, "Moved" ), CONFLICT_PATH_EXISTS( true, "Conflict" ), CONFLICT_VERSION_BRANCH_DIVERGS( true, "Conflict version" );
11-
12-
private final boolean conflict;
13-
14-
private final String status;
15-
16-
CompareStatus( final boolean conflict, final String formattedStatus )
17-
{
18-
this.conflict = conflict;
19-
this.status = formattedStatus;
20-
}
21-
22-
public boolean isConflict()
23-
{
24-
return this.conflict;
25-
}
26-
27-
public String getFormattedStatus()
28-
{
29-
return this.status;
30-
}
8+
NEW, NEW_TARGET, NEWER, OLDER, EQUAL, MOVED
319
}

modules/core/core-api/src/main/java/com/enonic/xp/content/ContentAccessException.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import com.enonic.xp.annotation.PublicApi;
66
import com.enonic.xp.exception.BaseException;
7-
import com.enonic.xp.node.NodeAccessException;
8-
import com.enonic.xp.node.NodePath;
97
import com.enonic.xp.security.User;
108
import com.enonic.xp.security.acl.Permission;
119

@@ -19,18 +17,7 @@ public final class ContentAccessException
1917

2018
private final Permission permission;
2119

22-
public ContentAccessException( final NodeAccessException nodeAccessException )
23-
{
24-
this( nodeAccessException, nodeAccessException.getUser(), translateNodePathToContentPath( nodeAccessException.getNodePath() ),
25-
nodeAccessException.getPermission() );
26-
}
27-
28-
public ContentAccessException( final User user, final ContentPath contentPath, final Permission permission )
29-
{
30-
this( null, user, contentPath, permission );
31-
}
32-
33-
private ContentAccessException( final Throwable cause, final User user, final ContentPath contentPath, final Permission permission )
20+
public ContentAccessException( final Throwable cause, final User user, final ContentPath contentPath, final Permission permission )
3421
{
3522
super( cause, MessageFormat.format( "Access denied to [{0}] for [{1}] by user [{2}] {3}", contentPath, permission,
3623
user == null ? "unknown" : user.getKey(),
@@ -54,17 +41,4 @@ public Permission getPermission()
5441
{
5542
return permission;
5643
}
57-
58-
private static ContentPath translateNodePathToContentPath( final NodePath nodePath )
59-
{
60-
final int beginIndex = nodePath.toString().indexOf( '/', 1 );
61-
if ( beginIndex == -1 )
62-
{
63-
return ContentPath.ROOT;
64-
}
65-
else
66-
{
67-
return ContentPath.from( nodePath.toString().substring( beginIndex ) );
68-
}
69-
}
7044
}

modules/core/core-api/src/main/java/com/enonic/xp/content/ContentConstants.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ public final class ContentConstants
3636

3737
public static final String CONTENT_ROOT_NAME = "content";
3838

39-
public static final NodePath CONTENT_ROOT_PARENT = NodePath.ROOT;
40-
41-
public static final NodePath CONTENT_ROOT_PATH = new NodePath( CONTENT_ROOT_PARENT, NodeName.from( CONTENT_ROOT_NAME ) );
39+
public static final NodePath CONTENT_ROOT_PATH = new NodePath( NodePath.ROOT, NodeName.from( CONTENT_ROOT_NAME ) );
4240

4341
public static final NodeType CONTENT_NODE_COLLECTION = NodeType.from( "content" );
4442

modules/core/core-api/src/main/java/com/enonic/xp/content/ContentService.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ public interface ContentService
8080

8181
FindContentVersionsResult getVersions( FindContentVersionsParams params );
8282

83-
GetActiveContentVersionsResult getActiveVersions( GetActiveContentVersionsParams params );
84-
8583
ByteSource getBinary( ContentId contentId, BinaryReference binaryReference );
8684

8785
ByteSource getBinary( ContentId contentId, ContentVersionId contentVersionId, BinaryReference binaryReference );

0 commit comments

Comments
 (0)