Example of retrieving the form data. A data may be manipulated as a resource.
public void data_getData( IDocumentManagementModule module, IContext context, ISimpleDataForm form ) throws Exception { IDataUnitCollection dataUnits = module.GetDataUnits( form ); for ( int index = 0 ; index < dataUnits.getCount() ; index++ ) { IDataUnit dataUnit = dataUnits.getItem( index ); IResource resource = dataUnit.getResource(); LOGGER.info( "data:" + resource.getId().getAsString() ); } }
Example of creating data under a standard form.
public void data_createData( IDocumentManagementModule module, IContext context, ISimpleDataForm form ) throws Exception { // creating data from a standard form IDataUnit dataUnit = module.CreateDataUnit( form ); IResource resource = dataUnit.getResource(); resource.SetValueAsFloat( "bigint", 1 ); resource.SetValueAsBool( "bit", true ); resource.SetValueAsString( "char", "a" ); resource.SetValueAsDate( "datetime", new Date() ); resource.SetValueAsFloat( "decimal", (float)12.500 ); resource.SetValueAsFloat( "float", (float)7.5 ); resource.SetValueAsString( "nchar", "AZERTY" ); resource.Save(); }
Example of retrieving the data versions.
public void data_getDataVersions( IDocumentManagementModule module, IContext context, IDataUnit dataUnit ) throws Exception { IVersionCollection versions = dataUnit.getVersions(); for ( int index = 0 ; index < versions.getCount() ; index++ ) { IVersion version = versions.getItem( index ); LOGGER.info( "version:" + version.getResource().getId().getAsString() + ", reference:" + version.getReference() + ", title:" + version.getTitle() + ", version:" + version.getVersion() + ", comment:" + version.getComment() ); } }