Package org.cyclos.impl.system
Class RecordImportHandlerImpl
- 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<RecordCustomField,CustomFieldValueDTO,RecordImportedFileDTO,RecordImportedFileData,RecordImportedFile,Record>
-
- org.cyclos.impl.system.RecordImportHandlerImpl
-
- All Implemented Interfaces:
ImportHandler<RecordImportedFileDTO,RecordImportedFileData,RecordImportedFile,Record>
@Component public class RecordImportHandlerImpl extends BaseWithFieldsImportHandlerImpl<RecordCustomField,CustomFieldValueDTO,RecordImportedFileDTO,RecordImportedFileData,RecordImportedFile,Record>
Implementation forRecordImportHandlerImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected static Set<String>REQUIRED_HEADERS-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Predicate<String>getAllowedImportFieldsPredicate(RecordImportedFile importedFile)Returns a predicate that evaluates true for a field allowed to be importedprotected Collection<RecordCustomField>getCustomFields(ImportedLine importedLine, List<ImportedLineValue> values)Returns the custom fields to be set for the given line.
For most of the cases the fields are the same for all lines but this method could be overridden by subclasses to implement some custom behavior (e.g Records).RecordImportedFileDatagetData(RecordImportedFile importedFile)Returns the data associated to an importClass<Record>getEntityClass()Returns the class of the imported entityClass<RecordImportedFile>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(RecordImportedFile 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.RecordImportedFilenewImportedFile(RecordImportedFileDTO dto)Instantiates anImportedFilea new entity based on a dtoRecordprocessImportedLine(ImportedLine importedLine, Object processContext)Imports an entity with the information in the imported line and returns the imported entity.ValidatorresolveValidator(RecordImportedFileDTO 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, 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, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
getAllowedImportFieldsPredicate
public Predicate<String> getAllowedImportFieldsPredicate(RecordImportedFile importedFile)
Description copied from interface:ImportHandlerReturns a predicate that evaluates true for a field allowed to be imported
-
getData
public RecordImportedFileData getData(RecordImportedFile importedFile)
Description copied from interface:ImportHandlerReturns the data associated to an import
-
getEntityClass
public Class<Record> getEntityClass()
Description copied from interface:ImportHandlerReturns the class of the imported entity
-
getImportedFileClass
public Class<RecordImportedFile> getImportedFileClass()
Description copied from interface:ImportHandlerReturns the imported file class
-
getImportType
public ImportType getImportType()
Description copied from interface:ImportHandlerReturns the type of imports handled by this class
-
getKeywordFields
public List<String> getKeywordFields()
Description copied from interface:ImportHandlerReturns a list of field names that can be used to search for imported lines
-
getMissingRequiredFields
public Set<String> getMissingRequiredFields(RecordImportedFile importedFile, List<String> headers)
Description copied from interface:ImportHandlerReturn the fields that are required and are not present in the given headers.
-
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.
-
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.
-
newImportedFile
public RecordImportedFile newImportedFile(RecordImportedFileDTO dto)
Description copied from interface:ImportHandlerInstantiates anImportedFilea new entity based on a dto
-
processImportedLine
public Record processImportedLine(ImportedLine importedLine, Object processContext)
Description copied from interface:ImportHandlerImports an entity with the information in the imported line and returns the imported entity.
-
resolveValidator
public Validator resolveValidator(RecordImportedFileDTO dto)
Description copied from interface:ImportHandlerReturns a new validator for the import.
-
validateImportedLine
public void validateImportedLine(ImportedLine importedLine, Object context)
Description copied from interface:ImportHandlerValidates the imported line
-
getCustomFields
protected Collection<RecordCustomField> getCustomFields(ImportedLine importedLine, List<ImportedLineValue> values)
Description copied from class:BaseWithFieldsImportHandlerImplReturns the custom fields to be set for the given line.
For most of the cases the fields are the same for all lines but this method could be overridden by subclasses to implement some custom behavior (e.g Records). The default implementation reads all fields specified in the given list ofImportedLineValueif any. Otherwise read the fields from theImportedLineSeeUserImportHandlerImplfor an usage with a values list
-
-