-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContentApi.java
More file actions
76 lines (63 loc) · 2.76 KB
/
ContentApi.java
File metadata and controls
76 lines (63 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.contentgrid.appserver.domain;
import com.contentgrid.appserver.application.model.Application;
import com.contentgrid.appserver.application.model.values.AttributeName;
import com.contentgrid.appserver.application.model.values.EntityName;
import com.contentgrid.appserver.domain.authorization.AuthorizationContext;
import com.contentgrid.appserver.application.model.values.DataEntry.FileDataEntry;
import com.contentgrid.appserver.domain.data.InvalidPropertyDataException;
import com.contentgrid.appserver.application.model.values.EntityId;
import com.contentgrid.appserver.domain.values.version.Version;
import com.contentgrid.appserver.domain.values.version.VersionConstraint;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
import lombok.NonNull;
public interface ContentApi {
Optional<Content> find(
@NonNull Application application,
@NonNull EntityName entityName,
@NonNull EntityId id,
@NonNull AttributeName attributeName,
@NonNull AuthorizationContext authorizationContext
);
Content update(
@NonNull Application application,
@NonNull EntityName entityName,
@NonNull EntityId id,
@NonNull AttributeName attributeName,
@NonNull VersionConstraint versionConstraint,
@NonNull FileDataEntry file,
@NonNull AuthorizationContext authorizationContext
) throws InvalidPropertyDataException;
void delete(
@NonNull Application application,
@NonNull EntityName entityName,
@NonNull EntityId id,
@NonNull AttributeName attributeName,
@NonNull VersionConstraint versionConstraint,
@NonNull AuthorizationContext authorizationContext
) throws InvalidPropertyDataException;
/**
* Representation of a content object.
* <p>
* The stored content is not retrieved until {@link #getInputStream()} is called; all other information is retrieved from metadata
*/
interface Content {
/**
* Create a new content object that only covers the byte-range between {@code start} and {@code endInclusive}
* @param start The position of the first byte of the range
* @param endInclusive The position of the last byte of the range (inclusive)
* @return A new content object whose {@link #getInputStream()} is limited to the given range
*/
Content withByteRange(long start, long endInclusive);
/**
* @return Description
*/
String getDescription();
String getFilename();
long getLength();
String getMimeType();
InputStream getInputStream() throws IOException;
Version getVersion();
}
}