Class UserProfileImporter
java.lang.Object
org.nuxeo.ecm.user.center.profile.UserProfileImporter
@Experimental(comment="https://jira.nuxeo.com/browse/NXP-12200")
public class UserProfileImporter
extends Object
- Since:
- 7.2
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected ImporterConfig
static final String
protected long
protected String
protected DateFormat
protected Character
protected final Date
protected long
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Releases the transaction resources by committing the existing transaction (if any).protected Map<String,
Serializable> computePropertiesMap
(long lineNumber, DocumentType docType, Map<String, Integer> headerValues, org.apache.commons.csv.CSVRecord record) protected Serializable
convertValue
(DocumentType docType, String fieldName, String headerValue, String stringValue, long lineNumber) void
doImport
(CoreSession session) void
doImport
(CoreSession session, org.apache.commons.csv.CSVParser parser, UserProfileService userProfileService) long
protected DateFormat
protected InputStream
getResourceAsStream
(String resource) long
protected boolean
importLine
(org.apache.commons.csv.CSVRecord record, long lineNumber, Integer nameIndex, DocumentType docType, CoreSession session, UserProfileService userProfileService, Map<String, Integer> headerValues) Import a line from the CSV file.protected void
logImportError
(long lineNumber, String message, String... params) protected void
logImportInfo
(long lineNumber, String message, String... params) protected boolean
Starts a new transaction.static Throwable
protected boolean
updateDocument
(long lineNumber, String name, DocumentType docType, CoreSession session, UserProfileService userProfileService, Map<String, Serializable> properties)
-
Field Details
-
CONTENT_FILED_TYPE_NAME
- See Also:
-
USER_PROFILE_IMPORTER_USERNAME_COL
- See Also:
-
escapeCharacter
-
config
-
dataFileName
-
dateformat
-
startDate
-
totalRecords
protected long totalRecords -
currentRecord
protected long currentRecord -
BLOB_FOLDER_PROPERTY
- See Also:
-
-
Constructor Details
-
UserProfileImporter
public UserProfileImporter()
-
-
Method Details
-
doImport
-
getResourceAsStream
-
doImport
public void doImport(CoreSession session, org.apache.commons.csv.CSVParser parser, UserProfileService userProfileService) throws IOException - Throws:
IOException
-
importLine
protected boolean importLine(org.apache.commons.csv.CSVRecord record, long lineNumber, Integer nameIndex, DocumentType docType, CoreSession session, UserProfileService userProfileService, Map<String, Integer> headerValues) Import a line from the CSV file.- Returns:
true
if a document has been created or updated,false
otherwise.
-
computePropertiesMap
protected Map<String,Serializable> computePropertiesMap(long lineNumber, DocumentType docType, Map<String, Integer> headerValues, org.apache.commons.csv.CSVRecord record) -
convertValue
protected Serializable convertValue(DocumentType docType, String fieldName, String headerValue, String stringValue, long lineNumber) -
getDateFormat
-
updateDocument
protected boolean updateDocument(long lineNumber, String name, DocumentType docType, CoreSession session, UserProfileService userProfileService, Map<String, Serializable> properties) -
commitOrRollbackTransaction
protected void commitOrRollbackTransaction()Releases the transaction resources by committing the existing transaction (if any). This is recommended before running a long process. -
startTransaction
protected boolean startTransaction()Starts a new transaction.Usually called after
commitOrRollbackTransaction()
, for instance for saving back the results of a long process.- Returns:
- true if a new transaction was started
-
logImportError
-
logImportInfo
-
unwrapException
-
getTotalRecords
public long getTotalRecords() -
getCurrentRecord
public long getCurrentRecord()
-