-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARC-1700: Recordify models & Remove Compose
- Loading branch information
1 parent
c0ffee8
commit c0ffee3
Showing
17 changed files
with
463 additions
and
449 deletions.
There are no files selected for viewing
90 changes: 14 additions & 76 deletions
90
api/src/main/java/com/oviva/spicegen/api/CheckPermission.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,30 @@ | ||
package com.oviva.spicegen.api; | ||
|
||
import java.util.Objects; | ||
import com.oviva.spicegen.api.internal.CheckPermissionImpl; | ||
|
||
public final class CheckPermission { | ||
public interface CheckPermission { | ||
|
||
private final ObjectRef resource; | ||
private final String permission; | ||
private final SubjectRef subject; | ||
|
||
private final Consistency consistency; | ||
|
||
private CheckPermission(Builder builder) { | ||
resource = builder.resource; | ||
permission = builder.permission; | ||
subject = builder.subject; | ||
consistency = builder.consistency; | ||
} | ||
|
||
public static Builder newBuilder() { | ||
return new Builder(); | ||
} | ||
|
||
public ObjectRef resource() { | ||
return resource; | ||
} | ||
|
||
public String permission() { | ||
return permission; | ||
} | ||
|
||
public SubjectRef subject() { | ||
return subject; | ||
static Builder newBuilder() { | ||
return new CheckPermissionImpl.Builder(); | ||
} | ||
|
||
public Consistency consistency() { | ||
return consistency; | ||
} | ||
ObjectRef resource(); | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
var that = (CheckPermission) o; | ||
return Objects.equals(resource, that.resource) | ||
&& Objects.equals(permission, that.permission) | ||
&& Objects.equals(subject, that.subject) | ||
&& Objects.equals(consistency, that.consistency); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(resource, permission, subject, consistency); | ||
} | ||
String permission(); | ||
|
||
public static final class Builder { | ||
private ObjectRef resource; | ||
private String permission; | ||
private SubjectRef subject; | ||
private Consistency consistency = Consistency.fullyConsistent(); | ||
SubjectRef subject(); | ||
|
||
private Builder() {} | ||
Consistency consistency(); | ||
|
||
public Builder resource(ObjectRef resource) { | ||
this.resource = resource; | ||
return this; | ||
} | ||
interface Builder { | ||
Builder resource(ObjectRef resource); | ||
|
||
public Builder permission(String permission) { | ||
this.permission = permission; | ||
return this; | ||
} | ||
Builder permission(String permission); | ||
|
||
public Builder subject(SubjectRef subject) { | ||
this.subject = subject; | ||
return this; | ||
} | ||
Builder subject(SubjectRef subject); | ||
|
||
public Builder consistency(Consistency consistency) { | ||
this.consistency = consistency; | ||
return this; | ||
} | ||
Builder consistency(Consistency consistency); | ||
|
||
public CheckPermission build() { | ||
return new CheckPermission(this); | ||
} | ||
CheckPermission build(); | ||
} | ||
} |
52 changes: 10 additions & 42 deletions
52
api/src/main/java/com/oviva/spicegen/api/Consistency.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 16 additions & 43 deletions
59
api/src/main/java/com/oviva/spicegen/api/Precondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,36 @@ | ||
package com.oviva.spicegen.api; | ||
|
||
public final class Precondition { | ||
import com.oviva.spicegen.api.internal.PreconditionImpl; | ||
|
||
private final Condition condition; | ||
private final RelationshipFilter filter; | ||
public interface Precondition { | ||
|
||
private Precondition(Builder builder) { | ||
condition = builder.condition; | ||
filter = builder.filter; | ||
} | ||
Condition condition(); | ||
|
||
public static Precondition mustMatch(RelationshipFilter filter) { | ||
return new Precondition(Condition.MUST_MATCH, filter); | ||
} | ||
RelationshipFilter filter(); | ||
|
||
public static Precondition mustNotMatch(RelationshipFilter filter) { | ||
return new Precondition(Condition.MUST_NOT_MATCH, filter); | ||
static Precondition mustMatch(RelationshipFilter filter) { | ||
return new PreconditionImpl(Condition.MUST_MATCH, filter); | ||
} | ||
|
||
public static Builder newBuilder() { | ||
return new Builder(); | ||
static Precondition mustNotMatch(RelationshipFilter filter) { | ||
return new PreconditionImpl(Condition.MUST_NOT_MATCH, filter); | ||
} | ||
|
||
private Precondition(Condition condition, RelationshipFilter filter) { | ||
this.condition = condition; | ||
this.filter = filter; | ||
} | ||
|
||
public Condition condition() { | ||
return condition; | ||
} | ||
|
||
public RelationshipFilter filter() { | ||
return filter; | ||
} | ||
|
||
public enum Condition { | ||
enum Condition { | ||
MUST_MATCH, | ||
MUST_NOT_MATCH | ||
} | ||
|
||
public static final class Builder { | ||
private Condition condition; | ||
private RelationshipFilter filter; | ||
static Builder newBuilder() { | ||
return new PreconditionImpl.Builder(); | ||
} | ||
|
||
private Builder() {} | ||
interface Builder { | ||
|
||
public Builder condition(Condition val) { | ||
condition = val; | ||
return this; | ||
} | ||
Precondition.Builder condition(Condition condition); | ||
|
||
public Builder filter(RelationshipFilter val) { | ||
filter = val; | ||
return this; | ||
} | ||
Precondition.Builder filter(RelationshipFilter filter); | ||
|
||
public Precondition build() { | ||
return new Precondition(this); | ||
} | ||
Precondition build(); | ||
} | ||
} |
Oops, something went wrong.