File tree 4 files changed +67
-10
lines changed
main/java/ch/uzh/marugoto/core
test/java/ch/uzh/marugoto/core/test/service
shell/src/main/java/ch/uzh/marugoto/shell/deserializer
4 files changed +67
-10
lines changed Original file line number Diff line number Diff line change
1
+ package ch .uzh .marugoto .core .data .entity ;
2
+
3
+ import java .net .URL ;
4
+
5
+ public class LinkComponent extends Component {
6
+
7
+ private boolean forcedDownload ;
8
+ private boolean universityAccess ;
9
+ private URL url ;
10
+ private Resource resource ;
11
+
12
+ public boolean isForceDownload () {
13
+ return forcedDownload ;
14
+ }
15
+
16
+ public void setForceDownload (boolean forcedDownload ) {
17
+ this .forcedDownload = forcedDownload ;
18
+ }
19
+
20
+ public boolean isUniversityAccess () {
21
+ return universityAccess ;
22
+ }
23
+
24
+ public void setUniversityAccess (boolean universityAccess ) {
25
+ this .universityAccess = universityAccess ;
26
+ }
27
+
28
+ public URL getUrl () {
29
+ return url ;
30
+ }
31
+
32
+ public void setUrl (URL url ) {
33
+ this .url = url ;
34
+ }
35
+
36
+ public Resource getResource () {
37
+ return resource ;
38
+ }
39
+
40
+ public void setResource (Resource resource ) {
41
+ this .resource = resource ;
42
+ }
43
+
44
+ public LinkComponent (URL url , boolean forcedDownload , boolean universityAccess ) {
45
+ this .url = url ;
46
+ this .forcedDownload = forcedDownload ;
47
+ this .universityAccess = universityAccess ;
48
+ }
49
+
50
+ public LinkComponent (boolean forcedDownload , boolean universityAccess , Resource resource ) {
51
+ super ();
52
+ this .forcedDownload = forcedDownload ;
53
+ this .universityAccess = universityAccess ;
54
+ this .resource = resource ;
55
+ }
56
+
57
+ }
Original file line number Diff line number Diff line change 1
1
package ch .uzh .marugoto .core .exception ;
2
2
3
+ @ SuppressWarnings ("serial" )
3
4
public class ResourceNotFoundException extends Throwable {
4
- public ResourceNotFoundException (String resourceUrl ) {
5
+
6
+ public ResourceNotFoundException (String resourceUrl ) {
5
7
super (String .format ("Resource not exists: %s" , resourceUrl ));
6
8
}
7
9
}
Original file line number Diff line number Diff line change 1
1
package ch .uzh .marugoto .core .test .service ;
2
2
3
- import org .junit .Before ;
4
- import org .junit .Test ;
3
+ import static org .junit .Assert . assertEquals ;
4
+ import static org .junit .Assert . assertNotEquals ;
5
5
6
6
import java .io .File ;
7
7
import java .io .IOException ;
8
8
import java .net .URL ;
9
9
10
10
import javax .imageio .ImageIO ;
11
11
12
+ import org .junit .Test ;
13
+
12
14
import ch .uzh .marugoto .core .data .entity .ImageResource ;
13
15
import ch .uzh .marugoto .core .exception .ResourceNotFoundException ;
14
16
import ch .uzh .marugoto .core .service .FileService ;
15
17
import ch .uzh .marugoto .core .service .ImageService ;
16
18
import ch .uzh .marugoto .core .test .BaseCoreTest ;
17
19
18
- import static org .junit .Assert .assertEquals ;
19
- import static org .junit .Assert .assertNotEquals ;
20
-
21
20
public class ImageServiceTest extends BaseCoreTest {
22
21
23
22
private final int imageWidth = 600 ;
Original file line number Diff line number Diff line change 1
1
package ch .uzh .marugoto .shell .deserializer ;
2
2
3
+ import java .io .IOException ;
4
+
3
5
import com .fasterxml .jackson .core .JsonParser ;
4
6
import com .fasterxml .jackson .databind .DeserializationContext ;
5
7
import com .fasterxml .jackson .databind .JsonNode ;
6
8
import com .fasterxml .jackson .databind .deser .std .StdDeserializer ;
7
9
8
- import java .io .IOException ;
9
- import java .nio .file .Files ;
10
- import java .nio .file .Paths ;
11
-
12
10
import ch .uzh .marugoto .core .data .entity .ImageComponent ;
13
11
import ch .uzh .marugoto .core .data .entity .ImageResource ;
14
12
import ch .uzh .marugoto .core .data .repository .ComponentRepository ;
17
15
import ch .uzh .marugoto .core .service .ImageService ;
18
16
import ch .uzh .marugoto .shell .util .BeanUtil ;
19
17
18
+ @ SuppressWarnings ("serial" )
20
19
public class ImageComponentDeserializer extends StdDeserializer <ImageComponent > {
21
20
22
21
public ImageComponentDeserializer () {
You can’t perform that action at this time.
0 commit comments