Skip to content

Commit 8125d67

Browse files
committed
Added LinkComponent and removed warnings
1 parent a23744c commit 8125d67

File tree

4 files changed

+67
-10
lines changed

4 files changed

+67
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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 numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package ch.uzh.marugoto.core.exception;
22

3+
@SuppressWarnings("serial")
34
public class ResourceNotFoundException extends Throwable {
4-
public ResourceNotFoundException(String resourceUrl) {
5+
6+
public ResourceNotFoundException(String resourceUrl) {
57
super(String.format("Resource not exists: %s", resourceUrl));
68
}
79
}

core/src/test/java/ch/uzh/marugoto/core/test/service/ImageServiceTest.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
package ch.uzh.marugoto.core.test.service;
22

3-
import org.junit.Before;
4-
import org.junit.Test;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNotEquals;
55

66
import java.io.File;
77
import java.io.IOException;
88
import java.net.URL;
99

1010
import javax.imageio.ImageIO;
1111

12+
import org.junit.Test;
13+
1214
import ch.uzh.marugoto.core.data.entity.ImageResource;
1315
import ch.uzh.marugoto.core.exception.ResourceNotFoundException;
1416
import ch.uzh.marugoto.core.service.FileService;
1517
import ch.uzh.marugoto.core.service.ImageService;
1618
import ch.uzh.marugoto.core.test.BaseCoreTest;
1719

18-
import static org.junit.Assert.assertEquals;
19-
import static org.junit.Assert.assertNotEquals;
20-
2120
public class ImageServiceTest extends BaseCoreTest {
2221

2322
private final int imageWidth = 600;

shell/src/main/java/ch/uzh/marugoto/shell/deserializer/ImageComponentDeserializer.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package ch.uzh.marugoto.shell.deserializer;
22

3+
import java.io.IOException;
4+
35
import com.fasterxml.jackson.core.JsonParser;
46
import com.fasterxml.jackson.databind.DeserializationContext;
57
import com.fasterxml.jackson.databind.JsonNode;
68
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
79

8-
import java.io.IOException;
9-
import java.nio.file.Files;
10-
import java.nio.file.Paths;
11-
1210
import ch.uzh.marugoto.core.data.entity.ImageComponent;
1311
import ch.uzh.marugoto.core.data.entity.ImageResource;
1412
import ch.uzh.marugoto.core.data.repository.ComponentRepository;
@@ -17,6 +15,7 @@
1715
import ch.uzh.marugoto.core.service.ImageService;
1816
import ch.uzh.marugoto.shell.util.BeanUtil;
1917

18+
@SuppressWarnings("serial")
2019
public class ImageComponentDeserializer extends StdDeserializer<ImageComponent> {
2120

2221
public ImageComponentDeserializer() {

0 commit comments

Comments
 (0)