Search in sources :

Example 1 with InvalidFileOperationException

use of org.pentaho.di.plugins.fileopensave.api.providers.exception.InvalidFileOperationException in project pentaho-kettle by pentaho.

the class RepositoryFileProvider method copy.

@Override
public RepositoryFile copy(RepositoryFile file, String toPath, boolean overwrite) throws FileException {
    RepositoryElementInterface repositoryElementInterface = getObject(file.getObjectId(), file.getType());
    if (repositoryElementInterface != null) {
        repositoryElementInterface.setName(Util.getName(toPath));
        repositoryElementInterface.setObjectId(null);
        try {
            getRepository().save(repositoryElementInterface, null, null);
        } catch (KettleException e) {
        }
    } else {
        throw new InvalidFileOperationException();
    }
    RepositoryFile repositoryFile = new RepositoryFile();
    return repositoryFile;
}
Also used : RepositoryElementInterface(org.pentaho.di.repository.RepositoryElementInterface) KettleException(org.pentaho.di.core.exception.KettleException) RepositoryFile(org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryFile) InvalidFileOperationException(org.pentaho.di.plugins.fileopensave.api.providers.exception.InvalidFileOperationException)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)1 InvalidFileOperationException (org.pentaho.di.plugins.fileopensave.api.providers.exception.InvalidFileOperationException)1 RepositoryFile (org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryFile)1 RepositoryElementInterface (org.pentaho.di.repository.RepositoryElementInterface)1