Search in sources :

Example 26 with IncomingBatch

use of org.jumpmind.symmetric.model.IncomingBatch in project symmetric-ds by JumpMind.

the class RestService method loadProfileImpl.

private void loadProfileImpl(ISymmetricEngine engine, MultipartFile file) {
    IDataLoaderService dataLoaderService = engine.getDataLoaderService();
    boolean inError = false;
    try {
        String content = new String(file.getBytes());
        List<IncomingBatch> batches = dataLoaderService.loadDataBatch(content);
        for (IncomingBatch batch : batches) {
            if (batch.getStatus() == Status.ER) {
                inError = true;
            }
        }
    } catch (Exception e) {
        inError = true;
    }
    if (inError) {
        throw new InternalServerErrorException();
    }
}
Also used : IDataLoaderService(org.jumpmind.symmetric.service.IDataLoaderService) IncomingBatch(org.jumpmind.symmetric.model.IncomingBatch) IOException(java.io.IOException) IoException(org.jumpmind.exception.IoException)

Aggregations

IncomingBatch (org.jumpmind.symmetric.model.IncomingBatch)26 Test (org.junit.Test)9 IOException (java.io.IOException)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 Level (org.apache.log4j.Level)7 CsvWriter (org.jumpmind.symmetric.csv.CsvWriter)7 ProcessInfo (org.jumpmind.symmetric.model.ProcessInfo)7 ProcessInfoKey (org.jumpmind.symmetric.model.ProcessInfoKey)7 IoException (org.jumpmind.exception.IoException)6 Node (org.jumpmind.symmetric.model.Node)6 NodeSecurity (org.jumpmind.symmetric.model.NodeSecurity)4 MalformedURLException (java.net.MalformedURLException)3 SymmetricException (org.jumpmind.symmetric.SymmetricException)3 ArrayList (java.util.ArrayList)2 UniqueKeyException (org.jumpmind.db.sql.UniqueKeyException)2 FileConflictException (org.jumpmind.symmetric.file.FileConflictException)2 TransformPoint (org.jumpmind.symmetric.io.data.transform.TransformPoint)2 RegistrationRequiredException (org.jumpmind.symmetric.service.RegistrationRequiredException)2 IIncomingTransport (org.jumpmind.symmetric.transport.IIncomingTransport)2 InternalIncomingTransport (org.jumpmind.symmetric.transport.internal.InternalIncomingTransport)2