Package org.dspace.ctask.general
Class AbstractTranslator
- java.lang.Object
-
- org.dspace.curate.AbstractCurationTask
-
- org.dspace.ctask.general.AbstractTranslator
-
- All Implemented Interfaces:
CurationTask
- Direct Known Subclasses:
MicrosoftTranslator
@Distributive public abstract class AbstractTranslator extends AbstractCurationTask
MicrosoftTranslator translates stuff- Author:
- Kim Shepherd
-
-
Field Summary
Fields Modifier and Type Field Description protected StringapiKeyprotected StringauthLangprotected StringauthLangFieldprotected String[]langsprotected StringPLUGIN_PREFIXprotected List<String>resultsprotected intstatusprotected String[]toTranslate-
Fields inherited from class org.dspace.curate.AbstractCurationTask
communityService, curator, handleService, itemService, taskId
-
-
Constructor Summary
Constructors Constructor Description AbstractTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(Curator curator, String taskId)Initialize task - parameters inform the task of it's invoking curator.protected voidinitApi()intperform(DSpaceObject dso)Perform the curation task upon passed DSOprotected StringtranslateText(String from, String to, String text)-
Methods inherited from class org.dspace.curate.AbstractCurationTask
dereference, distribute, perform, performItem, performObject, report, setResult, taskArrayProperty, taskBooleanProperty, taskIntProperty, taskLongProperty, taskProperty
-
-
-
-
Field Detail
-
status
protected int status
-
PLUGIN_PREFIX
protected final String PLUGIN_PREFIX
- See Also:
- Constant Field Values
-
authLangField
protected String authLangField
-
authLang
protected String authLang
-
toTranslate
protected String[] toTranslate
-
langs
protected String[] langs
-
apiKey
protected String apiKey
-
-
Method Detail
-
init
public void init(Curator curator, String taskId) throws IOException
Description copied from interface:CurationTaskInitialize task - parameters inform the task of it's invoking curator. Since the curator can provide services to the task, this represents curation DI.- Specified by:
initin interfaceCurationTask- Overrides:
initin classAbstractCurationTask- Parameters:
curator- the Curator controlling this tasktaskId- identifier task should use in invoking services- Throws:
IOException- if error
-
perform
public int perform(DSpaceObject dso) throws IOException
Description copied from interface:CurationTaskPerform the curation task upon passed DSO- Specified by:
performin interfaceCurationTask- Specified by:
performin classAbstractCurationTask- Parameters:
dso- the DSpace object- Returns:
- status code
- Throws:
IOException- if error
-
initApi
protected void initApi()
-
translateText
protected String translateText(String from, String to, String text) throws IOException
- Throws:
IOException
-
-