1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.app.images;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
import org.springframework.transaction.TransactionStatus;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
|
16
|
import eu.etaxonomy.cdm.api.service.IAgentService;
|
17
|
import eu.etaxonomy.cdm.api.service.IClassificationService;
|
18
|
import eu.etaxonomy.cdm.api.service.ICommonService;
|
19
|
import eu.etaxonomy.cdm.api.service.IDescriptionService;
|
20
|
import eu.etaxonomy.cdm.api.service.IReferenceService;
|
21
|
import eu.etaxonomy.cdm.api.service.ITaxonService;
|
22
|
import eu.etaxonomy.cdm.io.common.CdmImportBase;
|
23
|
|
24
|
/**
|
25
|
* @author n.hoffmann
|
26
|
* @created 11.11.2008
|
27
|
*/
|
28
|
public abstract class AbstractImageImporter
|
29
|
extends CdmImportBase<ImageImportConfigurator, ImageImportState> {
|
30
|
|
31
|
private static final long serialVersionUID = 6178173988325980060L;
|
32
|
private static final Logger logger = Logger.getLogger(AbstractImageImporter.class);
|
33
|
|
34
|
protected CdmApplicationController appCtr;
|
35
|
|
36
|
protected CdmApplicationController cdmApp;
|
37
|
protected ITaxonService taxonService;
|
38
|
protected IClassificationService classificationService;
|
39
|
//TODO:
|
40
|
protected IAgentService agentService;
|
41
|
protected IDescriptionService descriptionService;
|
42
|
protected IReferenceService referenceService;
|
43
|
protected ICommonService commonService;
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#doInvoke(eu.etaxonomy.cdm.io.common.IImportConfigurator, java.util.Map)
|
47
|
*/
|
48
|
@Override
|
49
|
public void doInvoke(ImageImportState state) {
|
50
|
//cdmApp = config.getCdmAppController();
|
51
|
//if (config instanceof ImageImportConfigurator){
|
52
|
|
53
|
TransactionStatus status = startTransaction();
|
54
|
|
55
|
taxonService = getTaxonService();
|
56
|
agentService = getAgentService();
|
57
|
referenceService = getReferenceService();
|
58
|
commonService = getCommonService();
|
59
|
classificationService = getClassificationService();
|
60
|
|
61
|
invokeImageImport(state);
|
62
|
|
63
|
commitTransaction(status);
|
64
|
|
65
|
return;
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* This method defines the image import.
|
70
|
* It should take care of where to get the images from and what object they get attached to.
|
71
|
*
|
72
|
* @param config
|
73
|
*/
|
74
|
protected abstract void invokeImageImport(ImageImportState state);
|
75
|
|
76
|
|
77
|
/* (non-Javadoc)
|
78
|
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IImportConfigurator)
|
79
|
*/
|
80
|
@Override
|
81
|
protected boolean doCheck(ImageImportState state) {
|
82
|
boolean result = true;
|
83
|
logger.warn("No check implemented for abstract image import");
|
84
|
return result;
|
85
|
}
|
86
|
|
87
|
|
88
|
/* (non-Javadoc)
|
89
|
* @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IImportConfigurator)
|
90
|
*/
|
91
|
@Override
|
92
|
protected boolean isIgnore(ImageImportState state) {
|
93
|
return false;
|
94
|
}
|
95
|
|
96
|
|
97
|
|
98
|
}
|