Class MultilingualFieldWebScript
java.lang.Object
org.springframework.extensions.webscripts.AbstractWebScript
fr.becpg.repo.web.scripts.multilingual.MultilingualFieldWebScript
- All Implemented Interfaces:
org.springframework.extensions.webscripts.WebScript
public class MultilingualFieldWebScript
extends org.springframework.extensions.webscripts.AbstractWebScript
Return or save MLText field
- Version:
- $Id: $Id
- Author:
- matthieu
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.extensions.webscripts.AbstractWebScript
org.springframework.extensions.webscripts.AbstractWebScript.ScriptDetails -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate Stringprivate EntityFormatServiceprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final org.apache.commons.logging.Logprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate org.alfresco.service.ServiceRegistry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res) private org.alfresco.service.cmr.repository.MLTextextractMLTextFromVersion(org.alfresco.service.cmr.repository.NodeRef versionNodeRef, String itemType, String itemId, org.alfresco.service.namespace.QName propertyQName, Locale defaultLocale) Extract MLText property from version JSON data.private StringgetTranslatedText(org.alfresco.service.cmr.repository.MLText mlText, String target) voidsetDeepLAPIKey(String deepLAPIKey) Setter for the fielddeepLAPIKey.voidsetEntityFormatService(EntityFormatService entityFormatService) Setter for the fieldentityFormatService.voidsetGoogleApiKey(String googleApiKey) Setter for the fieldgoogleApiKey.voidsetServiceRegistry(org.alfresco.service.ServiceRegistry serviceRegistry) Setter for the fieldserviceRegistry.Methods inherited from class org.springframework.extensions.webscripts.AbstractWebScript
addModuleBundleToCache, checkModuleBundleCache, createArgs, createArgsM, createHeaders, createHeadersM, createScriptParameters, createStatusException, createTemplateParameters, executeScript, getContainer, getDescription, getExecuteScript, getResources, getStatusTemplate, init, renderString, renderString, renderTemplate, sendStatus, setURLModelFactory, toString
-
Field Details
-
logger
private static final org.apache.commons.logging.Log logger -
PARAM_NODEREF
- See Also:
-
PARAM_FIELD
- See Also:
-
PARAM_DIFF_FIELD
- See Also:
-
PARAM_SUGGEST
- See Also:
-
PARAM_TARGET
- See Also:
-
PARAM_COPY
- See Also:
-
PARAM_DEST_FIELD
- See Also:
-
DEEPL_API_URL
- See Also:
-
GOOGLE_TRANSLATE_API_URL
- See Also:
-
DEEPL_AUTH_KEY
- See Also:
-
DEEPL_TEXT
- See Also:
-
DEEPL_SOURCE_LANG
- See Also:
-
DEEPL_TARGET_LANG
- See Also:
-
GOOGLE_KEY
- See Also:
-
GOOGLE_SOURCE
- See Also:
-
GOOGLE_QUERY
- See Also:
-
JSON_DATA
- See Also:
-
JSON_TRANSLATIONS
- See Also:
-
JSON_TEXT
- See Also:
-
JSON_TRANSLATED_TEXT
- See Also:
-
NO_SUGGESTION_MSG
- See Also:
-
NO_API_KEY_MSG
- See Also:
-
googleApiKey
-
deepLAPIKey
-
serviceRegistry
private org.alfresco.service.ServiceRegistry serviceRegistry -
entityFormatService
-
-
Constructor Details
-
MultilingualFieldWebScript
public MultilingualFieldWebScript()
-
-
Method Details
-
setServiceRegistry
public void setServiceRegistry(org.alfresco.service.ServiceRegistry serviceRegistry) Setter for the field
serviceRegistry.- Parameters:
serviceRegistry- aServiceRegistryobject.
-
setEntityFormatService
Setter for the field
entityFormatService.- Parameters:
entityFormatService- aEntityFormatServiceobject.
-
setGoogleApiKey
Setter for the field
googleApiKey.- Parameters:
googleApiKey- aStringobject.
-
setDeepLAPIKey
Setter for the field
deepLAPIKey.- Parameters:
deepLAPIKey- aStringobject
-
execute
public void execute(org.springframework.extensions.webscripts.WebScriptRequest req, org.springframework.extensions.webscripts.WebScriptResponse res) throws IOException - Throws:
IOException
-
getTranslatedText
-
extractMLTextFromVersion
private org.alfresco.service.cmr.repository.MLText extractMLTextFromVersion(org.alfresco.service.cmr.repository.NodeRef versionNodeRef, String itemType, String itemId, org.alfresco.service.namespace.QName propertyQName, Locale defaultLocale) Extract MLText property from version JSON data.- Parameters:
versionNodeRef- the version node referenceitemType- the item type from versioned nodeRefitemId- the item ID from versioned nodeRefpropertyQName- the property QName to extractdefaultLocale- the default locale to use if MLText is not found- Returns:
- the extracted MLText or empty MLText if not found
-