@Experimental(comment="https://jira.nuxeo.com/browse/NXP-12200") public class UserProfileImporter extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BLOB_FOLDER_PROPERTY |
protected ImporterConfig |
config |
static String |
CONTENT_FILED_TYPE_NAME |
protected long |
currentRecord |
protected String |
dataFileName |
protected DateFormat |
dateformat |
protected Character |
escapeCharacter |
protected Date |
startDate |
protected long |
totalRecords |
static String |
USER_PROFILE_IMPORTER_USERNAME_COL |
Constructor and Description |
---|
UserProfileImporter() |
Modifier and Type | Method and Description |
---|---|
protected void |
commitOrRollbackTransaction()
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 |
getCurrentRecord() |
protected DateFormat |
getDateFormat() |
protected InputStream |
getResourceAsStream(String resource) |
long |
getTotalRecords() |
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 |
startTransaction()
Starts a new transaction.
|
static Throwable |
unwrapException(Throwable t) |
protected boolean |
updateDocument(long lineNumber,
String name,
DocumentType docType,
CoreSession session,
UserProfileService userProfileService,
Map<String,Serializable> properties) |
public static final String CONTENT_FILED_TYPE_NAME
public static final String USER_PROFILE_IMPORTER_USERNAME_COL
protected Character escapeCharacter
protected ImporterConfig config
protected String dataFileName
protected transient DateFormat dateformat
protected long totalRecords
protected long currentRecord
public static final String BLOB_FOLDER_PROPERTY
public UserProfileImporter()
public void doImport(CoreSession session)
protected InputStream getResourceAsStream(String resource)
public void doImport(CoreSession session, org.apache.commons.csv.CSVParser parser, UserProfileService userProfileService) throws IOException
IOException
protected boolean importLine(org.apache.commons.csv.CSVRecord record, long lineNumber, Integer nameIndex, DocumentType docType, CoreSession session, UserProfileService userProfileService, Map<String,Integer> headerValues)
true
if a document has been created or updated, false
otherwise.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)
protected DateFormat getDateFormat()
protected boolean updateDocument(long lineNumber, String name, DocumentType docType, CoreSession session, UserProfileService userProfileService, Map<String,Serializable> properties)
protected void commitOrRollbackTransaction()
protected boolean startTransaction()
Usually called after commitOrRollbackTransaction()
, for instance for saving back the results of a long
process.
protected void logImportError(long lineNumber, String message, String... params)
protected void logImportInfo(long lineNumber, String message, String... params)
public static Throwable unwrapException(Throwable t)
public long getTotalRecords()
public long getCurrentRecord()
Copyright © 2019 Nuxeo. All rights reserved.