Package org.cyclos.impl.system
Class AdImportHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseNetworkedHandlerImpl
-
- org.cyclos.impl.system.BaseImportHandlerImpl<IFDTO,IFD,IF,E>
-
- org.cyclos.impl.system.BaseWithFieldsImportHandlerImpl<AdCustomField,CustomFieldValueDTO,AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
- org.cyclos.impl.system.AdImportHandlerImpl
-
- All Implemented Interfaces:
ImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>,ImportWithImageHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
@Component public class AdImportHandlerImpl extends BaseWithFieldsImportHandlerImpl<AdCustomField,CustomFieldValueDTO,AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement> implements ImportWithImageHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
Implementation forAdImportHandlerImpl
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.system.BaseWithFieldsImportHandlerImpl
CUSTOM_FIELD_IMPORT_PREFIX, CUSTOM_FIELD_PRIVATE_IMPORT_SUFFIX
-
Fields inherited from class org.cyclos.impl.system.BaseImportHandlerImpl
currencyService, rawEntityManagerHandler
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description AdImportHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Predicate<String>getAllowedImportFieldsPredicate(AdImportedFile importedFile)Returns a predicate that evaluates true for a field allowed to be importedAdImportedFileDatagetData(AdImportedFile importedFile)Returns the data associated to an importClass<Advertisement>getEntityClass()Returns the class of the imported entityImportFieldgetImagesColumn()Class<AdImportedFile>getImportedFileClass()Returns the imported file classImportTypegetImportType()Returns the type of imports handled by this classList<String>getKeywordFields()Returns a list of field names that can be used to search for imported linesSet<String>getMissingRequiredFields(AdImportedFile importedFile, List<String> headers)Return the fields that are required and are not present in the given headers.List<ImportField>getSearchImportedLineFields()Returns the list of fields that will be used to show the information of import lines.ObjectinstantiateContext()Returns an import context that will be used in the validation and processing of each import line.AdImportedFilenewImportedFile(AdImportedFileDTO dto)Instantiates anImportedFilea new entity based on a dtovoidprocessImportedImages(Advertisement ad, List<ImportedImage> images)AdvertisementprocessImportedLine(ImportedLine importedLine, Object processContext)Imports an entity with the information in the imported line and returns the imported entity.ValidatorresolveValidator(AdImportedFileDTO dto)Returns a new validator for the import.voidvalidateImportedLine(ImportedLine importedLine, Object context)Validates the imported line-
Methods inherited from class org.cyclos.impl.system.BaseWithFieldsImportHandlerImpl
fieldName, getCustomFields, getCustomFieldValueDto, getCustomFieldValues, getImportFieldName, getImportFieldNames, getPrivateImportFieldName, getPrivateImportFieldNames, parseCustomFieldValue, setCustomFieldValues, setCustomFieldValues
-
Methods inherited from class org.cyclos.impl.system.BaseImportHandlerImpl
find, finishImport, getImportField, locateUser, locateUser, parseAmount, parseBoolean, parseDate, parseDateTime
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.system.ImportHandler
fieldName, finishImport
-
-
-
-
Method Detail
-
getAllowedImportFieldsPredicate
public Predicate<String> getAllowedImportFieldsPredicate(AdImportedFile importedFile)
Description copied from interface:ImportHandlerReturns a predicate that evaluates true for a field allowed to be imported- Specified by:
getAllowedImportFieldsPredicatein interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getData
public AdImportedFileData getData(AdImportedFile importedFile)
Description copied from interface:ImportHandlerReturns the data associated to an import- Specified by:
getDatain interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getEntityClass
public Class<Advertisement> getEntityClass()
Description copied from interface:ImportHandlerReturns the class of the imported entity- Specified by:
getEntityClassin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getImagesColumn
public ImportField getImagesColumn()
- Specified by:
getImagesColumnin interfaceImportWithImageHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getImportedFileClass
public Class<AdImportedFile> getImportedFileClass()
Description copied from interface:ImportHandlerReturns the imported file class- Specified by:
getImportedFileClassin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getImportType
public ImportType getImportType()
Description copied from interface:ImportHandlerReturns the type of imports handled by this class- Specified by:
getImportTypein interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getKeywordFields
public List<String> getKeywordFields()
Description copied from interface:ImportHandlerReturns a list of field names that can be used to search for imported lines- Specified by:
getKeywordFieldsin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getMissingRequiredFields
public Set<String> getMissingRequiredFields(AdImportedFile importedFile, List<String> headers)
Description copied from interface:ImportHandlerReturn the fields that are required and are not present in the given headers.- Specified by:
getMissingRequiredFieldsin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
getSearchImportedLineFields
public List<ImportField> getSearchImportedLineFields()
Description copied from interface:ImportHandlerReturns the list of fields that will be used to show the information of import lines.- Specified by:
getSearchImportedLineFieldsin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
instantiateContext
public Object instantiateContext()
Description copied from interface:ImportHandlerReturns an import context that will be used in the validation and processing of each import line.- Specified by:
instantiateContextin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
newImportedFile
public AdImportedFile newImportedFile(AdImportedFileDTO dto)
Description copied from interface:ImportHandlerInstantiates anImportedFilea new entity based on a dto- Specified by:
newImportedFilein interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
processImportedImages
public void processImportedImages(Advertisement ad, List<ImportedImage> images)
- Specified by:
processImportedImagesin interfaceImportWithImageHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
processImportedLine
public Advertisement processImportedLine(ImportedLine importedLine, Object processContext)
Description copied from interface:ImportHandlerImports an entity with the information in the imported line and returns the imported entity.- Specified by:
processImportedLinein interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
resolveValidator
public Validator resolveValidator(AdImportedFileDTO dto)
Description copied from interface:ImportHandlerReturns a new validator for the import.- Specified by:
resolveValidatorin interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
validateImportedLine
public void validateImportedLine(ImportedLine importedLine, Object context)
Description copied from interface:ImportHandlerValidates the imported line- Specified by:
validateImportedLinein interfaceImportHandler<AdImportedFileDTO,AdImportedFileData,AdImportedFile,Advertisement>
-
-