use of org.pentaho.platform.dataaccess.datasource.api.resources.MetadataTempFilesListBundleDto in project data-access by pentaho.
the class DataSourceWizardService method publishDswFromTemp.
public String publishDswFromTemp(String domainId, MetadataTempFilesListDto fileList, boolean overwrite, boolean checkConnection, RepositoryFileAclDto acl) throws PentahoAccessControlException, IllegalArgumentException, DswPublishValidationException, Exception {
String metadataTempFileName = fileList.getXmiFileName();
InputStream metaDataFileInputStream = createInputStreamFromFile(MetadataService.getUploadDir() + File.separatorChar + metadataTempFileName);
List<MetadataTempFilesListBundleDto> locBundles = fileList.getBundles();
List<String> localeFileNames = new ArrayList<String>();
List<InputStream> localeFileStreams = new ArrayList<InputStream>();
if (locBundles != null) {
for (MetadataTempFilesListBundleDto bundle : locBundles) {
localeFileNames.add(bundle.getOriginalFileName());
localeFileStreams.add(new FileInputStream(MetadataService.getUploadDir() + File.separatorChar + bundle.getTempFileName()));
}
}
return publishDsw(domainId + DataSourceWizardService.METADATA_EXT, metaDataFileInputStream, localeFileStreams, localeFileNames, overwrite, checkConnection, acl);
}
use of org.pentaho.platform.dataaccess.datasource.api.resources.MetadataTempFilesListBundleDto in project data-access by pentaho.
the class MetadataService method uploadMetadataFilesToTempDir.
public MetadataTempFilesListDto uploadMetadataFilesToTempDir(InputStream metadataFile, List<InputStream> localeFileStreams, List<String> localeFileNames) throws Exception {
String fileName = uploadFile(metadataFile);
MetadataTempFilesListDto dto = new MetadataTempFilesListDto();
dto.setXmiFileName(fileName);
logger.info("metadata file uploaded: " + fileName);
if (localeFileStreams != null && localeFileStreams.size() != 0) {
List<MetadataTempFilesListBundleDto> bundles = new ArrayList<MetadataTempFilesListBundleDto>();
int cntr = 0;
for (InputStream inputStream : localeFileStreams) {
fileName = uploadFile(inputStream);
MetadataTempFilesListBundleDto bundle = new MetadataTempFilesListBundleDto(localeFileNames.get(cntr), fileName);
bundles.add(bundle);
logger.info("locale file uploaded: " + fileName);
cntr++;
}
dto.setBundles(bundles);
}
return dto;
}
use of org.pentaho.platform.dataaccess.datasource.api.resources.MetadataTempFilesListBundleDto in project data-access by pentaho.
the class MetadataService method importMetadataFromTemp.
public void importMetadataFromTemp(String domainId, MetadataTempFilesListDto fileList, boolean overwrite, RepositoryFileAclDto acl) throws PentahoAccessControlException, PlatformImportException, Exception {
String metadataTempFileName = fileList.getXmiFileName();
InputStream metaDataFileInputStream = createInputStreamFromFile(internalGetUploadDir() + File.separatorChar + metadataTempFileName);
List<MetadataTempFilesListBundleDto> locBundles = fileList.getBundles();
List<String> localeFileNames = new ArrayList<String>();
List<InputStream> localeFileStreams = new ArrayList<InputStream>();
if (locBundles != null) {
for (MetadataTempFilesListBundleDto bundle : locBundles) {
localeFileNames.add(bundle.getOriginalFileName());
localeFileStreams.add(createInputStreamFromFile(internalGetUploadDir() + File.separatorChar + bundle.getTempFileName()));
}
}
importMetadataDatasource(domainId, metaDataFileInputStream, overwrite, localeFileStreams, localeFileNames, acl);
}
Aggregations