本文整理了Java中org.pentaho.di.trans.steps.zipfile.ZipFileMeta
类的一些代码示例,展示了ZipFileMeta
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFileMeta
类的具体详情如下:
包路径:org.pentaho.di.trans.steps.zipfile.ZipFileMeta
类名称:ZipFileMeta
暂无
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testGettersSetters() {
ZipFileMeta zipFileMeta = new ZipFileMeta();
zipFileMeta.setDynamicSourceFileNameField( SOURCE_FILENAME );
zipFileMeta.setDynamicTargetFileNameField( TARGET_FILENAME );
zipFileMeta.setBaseFolderField( BASE_FOLDER );
zipFileMeta.setOperationType( ZipFileMeta.getOperationTypeByDesc( OPERATION_TYPE ) );
zipFileMeta.setaddTargetFileNametoResult( ADD_RESULT_FILENAME );
zipFileMeta.setOverwriteZipEntry( OVERWRITE_ZIP_ENTRY );
zipFileMeta.setCreateParentFolder( CREATE_PARENT_FOLDER );
zipFileMeta.setKeepSouceFolder( KEEP_SOURCE_FOLDER );
zipFileMeta.setMoveToFolderField( MOVE_TO_FOLDER_FIELD );
assertEquals( SOURCE_FILENAME, zipFileMeta.getDynamicSourceFileNameField() );
assertEquals( TARGET_FILENAME, zipFileMeta.getDynamicTargetFileNameField() );
assertEquals( BASE_FOLDER, zipFileMeta.getBaseFolderField() );
assertEquals( ZipFileMeta.getOperationTypeByDesc( OPERATION_TYPE ), zipFileMeta.getOperationType() );
assertEquals( MOVE_TO_FOLDER_FIELD, zipFileMeta.getMoveToFolderField() );
assertTrue( zipFileMeta.isaddTargetFileNametoResult() );
assertTrue( zipFileMeta.isOverwriteZipEntry() );
assertTrue( zipFileMeta.isKeepSouceFolder() );
assertTrue( zipFileMeta.isCreateParentFolder() );
assertEquals( MOVE_TO_FOLDER_FIELD, zipFileMeta.getMoveToFolderField() );
assertNotNull( zipFileMeta.getStepData() );
assertTrue( zipFileMeta.supportsErrorHandling() );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Copy information from the meta-data input to the dialog fields.
*/
public void getData() {
if ( log.isDebug() ) {
log.logDebug( toString(), BaseMessages.getString( PKG, "ZipFileDialog.Log.GettingKeyInfo" ) );
}
if ( input.getBaseFolderField() != null ) {
wBaseFolderField.setText( input.getBaseFolderField() );
}
if ( input.getDynamicSourceFileNameField() != null ) {
wSourceFileNameField.setText( input.getDynamicSourceFileNameField() );
}
if ( input.getDynamicTargetFileNameField() != null ) {
wTargetFileNameField.setText( input.getDynamicTargetFileNameField() );
}
wOperation.setText( ZipFileMeta.getOperationTypeDesc( input.getOperationType() ) );
if ( input.getMoveToFolderField() != null ) {
wMoveToFolderField.setText( input.getMoveToFolderField() );
}
wAddResult.setSelection( input.isaddTargetFileNametoResult() );
wOverwriteZipEntry.setSelection( input.isOverwriteZipEntry() );
wCreateParentFolder.setSelection( input.isCreateParentFolder() );
wKeepFolders.setSelection( input.isKeepSouceFolder() );
wStepname.selectAll();
wStepname.setFocus();
}
代码示例来源:origin: pentaho/pentaho-kettle
private void ok() {
if ( Utils.isEmpty( wStepname.getText() ) ) {
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setMessage( BaseMessages.getString( PKG, "System.Error.StepNameMissing.Message" ) );
mb.setText( BaseMessages.getString( PKG, "System.Error.StepNameMissing.Title" ) );
mb.open();
return;
}
input.setBaseFolderField( wBaseFolderField.getText() );
input.setDynamicSourceFileNameField( wSourceFileNameField.getText() );
input.setDynamicTargetFileNameField( wTargetFileNameField.getText() );
input.setaddTargetFileNametoResult( wAddResult.getSelection() );
input.setOverwriteZipEntry( wOverwriteZipEntry.getSelection() );
input.setCreateParentFolder( wCreateParentFolder.getSelection() );
input.setKeepSouceFolder( wKeepFolders.getSelection() );
input.setOperationType( ZipFileMeta.getOperationTypeByDesc( wOperation.getText() ) );
input.setMoveToFolderField( wMoveToFolderField.getText() );
stepname = wStepname.getText(); // return value
dispose();
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testReadRep() throws Exception {
ZipFileMeta zipFileMeta = new ZipFileMeta();
Repository rep = mock( Repository.class );
IMetaStore metastore = mock( IMetaStore.class );
when( rep.getStepAttributeString( oid, "movetofolderfield" ) ).thenReturn( MOVE_TO_FOLDER_FIELD );
zipFileMeta.readRep( rep, metastore, oid, Collections.singletonList( dbMeta ) );
assertEquals( SOURCE_FILENAME, zipFileMeta.getDynamicSourceFileNameField() );
assertEquals( TARGET_FILENAME, zipFileMeta.getDynamicTargetFileNameField() );
assertEquals( BASE_FOLDER, zipFileMeta.getBaseFolderField() );
assertEquals( ZipFileMeta.getOperationTypeByDesc( OPERATION_TYPE ), zipFileMeta.getOperationType() );
assertEquals( MOVE_TO_FOLDER_FIELD, zipFileMeta.getMoveToFolderField() );
assertTrue( zipFileMeta.isaddTargetFileNametoResult() );
assertTrue( zipFileMeta.isOverwriteZipEntry() );
assertTrue( zipFileMeta.isKeepSouceFolder() );
assertTrue( zipFileMeta.isCreateParentFolder() );
zipFileMeta.saveRep( rep, metastore, transid, oid );
verify( rep ).saveStepAttribute( transid, oid, "sourcefilenamefield", SOURCE_FILENAME );
verify( rep ).saveStepAttribute( transid, oid, "targetfilenamefield", TARGET_FILENAME );
代码示例来源:origin: pentaho/pentaho-kettle
meta.getFields( data.outputRowMeta, getStepname(), null, null, this, getTrans().getRepository(), getTrans()
.getMetaStore() );
if ( Utils.isEmpty( meta.getDynamicSourceFileNameField() ) ) {
throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Error.SourceFilenameFieldMissing" ) );
if ( Utils.isEmpty( meta.getDynamicTargetFileNameField() ) ) {
throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Error.TargetFilenameFieldMissing" ) );
data.indexOfSourceFilename = getInputRowMeta().indexOfValue( meta.getDynamicSourceFileNameField() );
if ( data.indexOfSourceFilename < 0 ) {
.getDynamicSourceFileNameField() ) );
data.indexOfZipFilename = getInputRowMeta().indexOfValue( meta.getDynamicTargetFileNameField() );
if ( data.indexOfZipFilename < 0 ) {
.getDynamicTargetFileNameField() ) );
if ( meta.isKeepSouceFolder() ) {
if ( !Utils.isEmpty( meta.getBaseFolderField() ) ) {
data.indexOfBaseFolder = getInputRowMeta().indexOfValue( meta.getBaseFolderField() );
if ( data.indexOfBaseFolder < 0 ) {
.getBaseFolderField() ) );
if ( meta.getOperationType() == ZipFileMeta.OPERATION_TYPE_MOVE ) {
if ( Utils.isEmpty( meta.getMoveToFolderField() ) ) {
代码示例来源:origin: pentaho/pentaho-kettle
private void assertXmlOutputMeta( ZipFileMeta zipOutputFile ) {
assertEquals( "BaseFolder", zipOutputFile.getBaseFolderField() );
assertEquals( "Files", zipOutputFile.getDynamicSourceFileNameField() );
assertEquals( "ZipFile", zipOutputFile.getDynamicTargetFileNameField() );
assertEquals( null, zipOutputFile.getMoveToFolderField() );
assertEquals( " <sourcefilenamefield>Files</sourcefilenamefield>" + Const.CR
+ " <targetfilenamefield>ZipFile</targetfilenamefield>" + Const.CR
+ " <baseFolderField>BaseFolder</baseFolderField>" + Const.CR
+ " <operation_type>move</operation_type>" + Const.CR
+ " <addresultfilenames>Y</addresultfilenames>" + Const.CR
+ " <overwritezipentry>Y</overwritezipentry>" + Const.CR
+ " <createparentfolder>Y</createparentfolder>" + Const.CR
+ " <keepsourcefolder>Y</keepsourcefolder>" + Const.CR
+ " <movetofolderfield/>" + Const.CR, zipOutputFile.getXML() );
zipOutputFile.setDefault();
assertEquals( " <sourcefilenamefield>Files</sourcefilenamefield>" + Const.CR
+ " <targetfilenamefield>ZipFile</targetfilenamefield>" + Const.CR
+ " <baseFolderField>BaseFolder</baseFolderField>" + Const.CR
+ " <operation_type/>" + Const.CR
+ " <addresultfilenames>N</addresultfilenames>" + Const.CR
+ " <overwritezipentry>N</overwritezipentry>" + Const.CR
+ " <createparentfolder>N</createparentfolder>" + Const.CR
+ " <keepsourcefolder>N</keepsourcefolder>" + Const.CR
+ " <movetofolderfield/>" + Const.CR, zipOutputFile.getXML() );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
updateZip = ( data.zipFile.exists() && meta.isOverwriteZipEntry() );
if ( meta.isKeepSouceFolder() ) {
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testOperationType() {
assertEquals( 0, ZipFileMeta.getOperationTypeByDesc( null ) );
assertEquals( 1, ZipFileMeta.getOperationTypeByDesc( "Move source file" ) );
assertEquals( 1, ZipFileMeta.getOperationTypeByDesc( "move" ) );
assertEquals( 0, ZipFileMeta.getOperationTypeByDesc( "doesn't exist" ) );
assertEquals( "Move source file", ZipFileMeta.getOperationTypeDesc( 1 ) );
assertEquals( "Do nothing", ZipFileMeta.getOperationTypeDesc( 100 ) );
assertEquals( "Do nothing", ZipFileMeta.getOperationTypeDesc( -1 ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void addFilenameToResult() throws FileSystemException {
if ( meta.isaddTargetFileNametoResult() ) {
// Add this to the result file names...
ResultFile resultFile =
new ResultFile( ResultFile.FILE_TYPE_GENERAL, data.zipFile, getTransMeta().getName(), getStepname() );
resultFile.setComment( BaseMessages.getString( PKG, "ZipFile.Log.FileAddedResult" ) );
addResultFile( resultFile );
if ( log.isDetailed() ) {
log.logDetailed( toString(), BaseMessages.getString( PKG, "ZipFile.Log.FilenameAddResult", data.sourceFile
.toString() ) );
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void processFile( String folder ) throws Exception {
switch ( meta.getOperationType() ) {
case ZipFileMeta.OPERATION_TYPE_MOVE:
FileObject file = null;
代码示例来源:origin: pentaho/pentaho-kettle
private void updateOperation() {
wlMoveToFolderField
.setEnabled( ZipFileMeta.getOperationTypeByDesc( wOperation.getText() ) == ZipFileMeta.OPERATION_TYPE_MOVE );
wMoveToFolderField
.setEnabled( ZipFileMeta.getOperationTypeByDesc( wOperation.getText() ) == ZipFileMeta.OPERATION_TYPE_MOVE );
}
}
内容来源于网络,如有侵权,请联系作者删除!