KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > doctaskrunner > commonimpl > TaskDocDetailImpl


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.outerj.daisy.doctaskrunner.commonimpl;
17
18 import org.outerj.daisy.doctaskrunner.TaskDocDetail;
19 import org.outerj.daisy.doctaskrunner.DocumentExecutionState;
20 import org.outerj.daisy.repository.VariantKey;
21 import org.outerx.daisy.x10Doctaskrunner.TaskDocDetailDocument;
22
23 public class TaskDocDetailImpl implements TaskDocDetail {
24     private final VariantKey variantKey;
25     private final DocumentExecutionState state;
26     private final String JavaDoc details;
27
28     public TaskDocDetailImpl(VariantKey variantKey, DocumentExecutionState state, String JavaDoc details) {
29         this.variantKey = variantKey;
30         this.state = state;
31         this.details = details;
32     }
33
34     public VariantKey getVariantKey() {
35         return variantKey;
36     }
37
38     public DocumentExecutionState getState() {
39         return state;
40     }
41
42     public String JavaDoc getDetails() {
43         return details;
44     }
45
46     public TaskDocDetailDocument getXml() {
47         TaskDocDetailDocument taskDocDetailDocument = TaskDocDetailDocument.Factory.newInstance();
48         TaskDocDetailDocument.TaskDocDetail taskDocDetailXml = taskDocDetailDocument.addNewTaskDocDetail();
49
50         taskDocDetailXml.setDocumentId(variantKey.getDocumentId());
51         taskDocDetailXml.setBranchId(variantKey.getBranchId());
52         taskDocDetailXml.setLanguageId(variantKey.getLanguageId());
53         taskDocDetailXml.setState(TaskDocDetailDocument.TaskDocDetail.State.Enum.forString(state.toString()));
54         if (details != null)
55             taskDocDetailXml.setDetails(details);
56
57         return taskDocDetailDocument;
58     }
59 }
60
Popular Tags