1 | /** |
---|
2 | * Copyright (C) 2013 DASISH |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU General Public License |
---|
6 | * as published by the Free Software Foundation; either version 2 |
---|
7 | * of the License, or (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | */ |
---|
18 | package eu.dasish.annotation.backend; |
---|
19 | |
---|
20 | import eu.dasish.annotation.schema.Annotation; |
---|
21 | import eu.dasish.annotation.schema.AnnotationBody; |
---|
22 | import eu.dasish.annotation.schema.AnnotationBody.TextBody; |
---|
23 | import eu.dasish.annotation.schema.TargetInfo; |
---|
24 | import eu.dasish.annotation.schema.TargetInfoList; |
---|
25 | |
---|
26 | /** |
---|
27 | * |
---|
28 | * @author olhsha |
---|
29 | */ |
---|
30 | public class TestInstances { |
---|
31 | |
---|
32 | final private Annotation _annotationOne; |
---|
33 | final private Annotation _annotationToAdd; |
---|
34 | |
---|
35 | public TestInstances(){ |
---|
36 | _annotationOne = makeAnnotationOne(); |
---|
37 | _annotationToAdd = makeAnnotationToAdd(); |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | private Annotation makeAnnotationOne(){ |
---|
42 | Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_2_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_HTML, TestBackendConstants._TEST_ANNOT_2_HEADLINE, TestBackendConstants._TEST_ANNOT_2_OWNER); |
---|
43 | return result; |
---|
44 | } |
---|
45 | |
---|
46 | private Annotation makeAnnotationToAdd(){ |
---|
47 | Annotation result = makeAnnotation(TestBackendConstants._TEST_ANNOT_TO_ADD_BODY, TestBackendConstants._TEST_BODY_MIMETYPE_TEXT, TestBackendConstants._TEST_ANNOT_TO_ADD_HEADLINE, 5); |
---|
48 | |
---|
49 | TargetInfo TargetInfo = new TargetInfo(); |
---|
50 | TargetInfo.setLink(TestBackendConstants._TEST_Target_1_LINK); |
---|
51 | TargetInfo.setRef(TestBackendConstants._TEST_Target_1_EXT_ID); |
---|
52 | TargetInfo.setVersion(TestBackendConstants._TEST_Target_1_VERSION); |
---|
53 | |
---|
54 | TargetInfoList targetInfos = new TargetInfoList(); |
---|
55 | targetInfos.getTargetInfo().add(TargetInfo); |
---|
56 | result.setTargets(targetInfos); |
---|
57 | |
---|
58 | return result; |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | private Annotation makeAnnotation(String bodyTxt, String bodyMimeType, String headline, int ownerId){ |
---|
63 | Annotation result = new Annotation(); |
---|
64 | AnnotationBody body = new AnnotationBody(); |
---|
65 | result.setBody(body); |
---|
66 | TextBody textBody = new TextBody(); |
---|
67 | body.setTextBody(textBody); |
---|
68 | textBody.setMimeType(bodyMimeType); |
---|
69 | textBody.setValue(bodyTxt); |
---|
70 | |
---|
71 | result.setHeadline(headline); |
---|
72 | result.setOwnerRef(String.valueOf(ownerId)); |
---|
73 | |
---|
74 | result.setLastModified(null); |
---|
75 | result.setURI(null); |
---|
76 | result.setTargets(null); |
---|
77 | result.setURI(null); |
---|
78 | |
---|
79 | return result; |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | public Annotation getAnnotationOne(){ |
---|
84 | return _annotationOne; |
---|
85 | } |
---|
86 | |
---|
87 | public Annotation getAnnotationToAdd(){ |
---|
88 | return _annotationToAdd; |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | } |
---|