Skip to content

Commit c5736e1

Browse files
committed
wip
1 parent c96da8d commit c5736e1

File tree

92 files changed

+1510
-1865
lines changed

Some content is hidden

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

92 files changed

+1510
-1865
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/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 );

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

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.enonic.xp.index.ChildOrder;
88
import com.enonic.xp.security.PrincipalKey;
99
import com.enonic.xp.security.acl.AccessControlList;
10+
import com.enonic.xp.util.Attributes;
1011

1112
@PublicApi
1213
public final class ContentVersion
@@ -27,12 +28,16 @@ public final class ContentVersion
2728

2829
private final String comment;
2930

30-
private final ContentVersionPublishInfo publishInfo;
31+
private final ContentVersionCommitInfo commitInfo;
32+
33+
private final ContentPublishInfo publishInfo;
3134

3235
private final WorkflowInfo workflowInfo;
3336

3437
private final AccessControlList permissions;
3538

39+
private final Attributes attributes;
40+
3641
private ContentVersion( Builder builder )
3742
{
3843
this.modifier = builder.modifier;
@@ -44,8 +49,10 @@ private ContentVersion( Builder builder )
4449
this.childOrder = builder.childOrder;
4550
this.id = builder.id;
4651
this.publishInfo = builder.publishInfo;
52+
this.commitInfo = builder.commitInfo;
4753
this.workflowInfo = builder.workflowInfo;
4854
this.permissions = builder.permissions;
55+
this.attributes = builder.attributes;
4956
}
5057

5158
public PrincipalKey getModifier()
@@ -83,11 +90,16 @@ public ContentVersionId getId()
8390
return id;
8491
}
8592

86-
public ContentVersionPublishInfo getPublishInfo()
93+
public ContentPublishInfo getPublishInfo()
8794
{
8895
return publishInfo;
8996
}
9097

98+
public ContentVersionCommitInfo getCommitInfo()
99+
{
100+
return commitInfo;
101+
}
102+
91103
public WorkflowInfo getWorkflowInfo()
92104
{
93105
return workflowInfo;
@@ -103,6 +115,11 @@ public AccessControlList getPermissions()
103115
return permissions;
104116
}
105117

118+
public Attributes getAttributes()
119+
{
120+
return attributes;
121+
}
122+
106123
public static Builder create()
107124
{
108125
return new Builder();
@@ -124,15 +141,16 @@ public boolean equals( final Object o )
124141
Objects.equals( displayName, that.displayName ) && Objects.equals( modified, that.modified ) &&
125142
Objects.equals( timestamp, that.timestamp ) && Objects.equals( childOrder, that.childOrder ) &&
126143
Objects.equals( comment, that.comment ) && Objects.equals( publishInfo, that.publishInfo ) &&
127-
Objects.equals( workflowInfo, that.workflowInfo ) && Objects.equals( permissions, that.permissions ) &&
128-
Objects.equals( path, that.path );
144+
Objects.equals( commitInfo, that.commitInfo ) && Objects.equals( workflowInfo, that.workflowInfo ) &&
145+
Objects.equals( permissions, that.permissions ) && Objects.equals( path, that.path ) &&
146+
Objects.equals( attributes, that.attributes );
129147
}
130148

131149
@Override
132150
public int hashCode()
133151
{
134-
return Objects.hash( id, modifier, displayName, modified, timestamp, childOrder, comment, publishInfo, workflowInfo, path,
135-
permissions );
152+
return Objects.hash( id, modifier, displayName, modified, timestamp, childOrder, comment, publishInfo, commitInfo, workflowInfo,
153+
path, permissions, attributes );
136154
}
137155

138156
public static final class Builder
@@ -153,12 +171,16 @@ public static final class Builder
153171

154172
private ContentVersionId id;
155173

156-
private ContentVersionPublishInfo publishInfo;
174+
private ContentPublishInfo publishInfo;
175+
176+
private ContentVersionCommitInfo commitInfo;
157177

158178
private WorkflowInfo workflowInfo;
159179

160180
private AccessControlList permissions;
161181

182+
private Attributes attributes;
183+
162184
private Builder()
163185
{
164186
}
@@ -169,61 +191,73 @@ public Builder id( final ContentVersionId id )
169191
return this;
170192
}
171193

172-
public Builder modifier( PrincipalKey modifier )
194+
public Builder modifier( final PrincipalKey modifier )
173195
{
174196
this.modifier = modifier;
175197
return this;
176198
}
177199

178-
public Builder displayName( String displayName )
200+
public Builder displayName( final String displayName )
179201
{
180202
this.displayName = displayName;
181203
return this;
182204
}
183205

184-
public Builder path( ContentPath path )
206+
public Builder path( final ContentPath path )
185207
{
186208
this.path = path;
187209
return this;
188210
}
189211

190-
public Builder modified( Instant modified )
212+
public Builder modified( final Instant modified )
191213
{
192214
this.modified = modified;
193215
return this;
194216
}
195217

196-
public Builder timestamp( Instant timestamp )
218+
public Builder timestamp( final Instant timestamp )
197219
{
198220
this.timestamp = timestamp;
199221
return this;
200222
}
201223

202-
public Builder childOrder( ChildOrder childOrder )
224+
public Builder childOrder( final ChildOrder childOrder )
203225
{
204226
this.childOrder = childOrder;
205227
return this;
206228
}
207229

208-
public Builder comment( String comment )
230+
public Builder comment( final String comment )
209231
{
210232
this.comment = comment;
211233
return this;
212234
}
213235

214-
public Builder publishInfo( ContentVersionPublishInfo publishInfo )
236+
public Builder publishInfo( final ContentPublishInfo publishInfo )
215237
{
216238
this.publishInfo = publishInfo;
217239
return this;
218240
}
219241

220-
public Builder workflowInfo( WorkflowInfo workflowInfo )
242+
public Builder commitInfo( final ContentVersionCommitInfo commitInfo )
243+
{
244+
this.commitInfo = commitInfo;
245+
return this;
246+
}
247+
248+
public Builder attributes( final Attributes attributes )
249+
{
250+
this.attributes = attributes;
251+
return this;
252+
}
253+
254+
public Builder workflowInfo( final WorkflowInfo workflowInfo )
221255
{
222256
this.workflowInfo = workflowInfo;
223257
return this;
224258
}
225259

226-
public Builder permissions( AccessControlList permissions )
260+
public Builder permissions( final AccessControlList permissions )
227261
{
228262
this.permissions = permissions;
229263
return this;
Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import com.enonic.xp.security.PrincipalKey;
77

8-
public final class ContentVersionPublishInfo
8+
public final class ContentVersionCommitInfo
99
{
1010
private final PrincipalKey publisher;
1111

@@ -15,14 +15,11 @@ public final class ContentVersionPublishInfo
1515

1616
private final CommitType type;
1717

18-
private final ContentPublishInfo contentPublishInfo;
19-
20-
private ContentVersionPublishInfo( Builder builder )
18+
private ContentVersionCommitInfo( Builder builder )
2119
{
2220
publisher = builder.publisher;
2321
timestamp = builder.timestamp;
2422
message = builder.message;
25-
contentPublishInfo = builder.contentPublishInfo;
2623
type = builder.type;
2724
}
2825

@@ -46,11 +43,6 @@ public String getMessage()
4643
return message;
4744
}
4845

49-
public ContentPublishInfo getContentPublishInfo()
50-
{
51-
return contentPublishInfo;
52-
}
53-
5446
public CommitType getType()
5547
{
5648
return type;
@@ -63,20 +55,20 @@ public boolean equals( final Object o )
6355
{
6456
return true;
6557
}
66-
if ( !( o instanceof ContentVersionPublishInfo ) )
58+
if ( !( o instanceof ContentVersionCommitInfo ) )
6759
{
6860
return false;
6961
}
70-
final ContentVersionPublishInfo that = (ContentVersionPublishInfo) o;
62+
final ContentVersionCommitInfo that = (ContentVersionCommitInfo) o;
7163
return Objects.equals( publisher, that.publisher ) && Objects.equals( timestamp, that.timestamp ) &&
72-
Objects.equals( message, that.message ) && Objects.equals( contentPublishInfo, that.contentPublishInfo ) &&
64+
Objects.equals( message, that.message ) &&
7365
Objects.equals( type, that.type );
7466
}
7567

7668
@Override
7769
public int hashCode()
7870
{
79-
return Objects.hash( publisher, timestamp, message, contentPublishInfo );
71+
return Objects.hash( publisher, timestamp, message );
8072
}
8173

8274
public enum CommitType
@@ -92,15 +84,13 @@ public static final class Builder
9284

9385
private String message;
9486

95-
private ContentPublishInfo contentPublishInfo;
96-
9787
private CommitType type;
9888

9989
private Builder()
10090
{
10191
}
10292

103-
public Builder publisher( final PrincipalKey publisher )
93+
public Builder commiter( final PrincipalKey publisher )
10494
{
10595
this.publisher = publisher;
10696
return this;
@@ -118,21 +108,15 @@ public Builder message( final String message )
118108
return this;
119109
}
120110

121-
public Builder contentPublishInfo( final ContentPublishInfo contentPublishInfo )
122-
{
123-
this.contentPublishInfo = contentPublishInfo;
124-
return this;
125-
}
126-
127111
public Builder type( final CommitType type )
128112
{
129113
this.type = type;
130114
return this;
131115
}
132116

133-
public ContentVersionPublishInfo build()
117+
public ContentVersionCommitInfo build()
134118
{
135-
return new ContentVersionPublishInfo( this );
119+
return new ContentVersionCommitInfo( this );
136120
}
137121
}
138122
}

0 commit comments

Comments
 (0)