BIRT programatically get data from CSV data source - java

I have code which uses BIRT 2.6.1 runtime to get data from JDBC data source which works fine. but I want to change it to use a CSV file instead. what's the code to achieve this?
I have the following:
OdaDataSourceHandle dsHandle = designFactory.newOdaDataSource(
this.dataSourceName, "org.eclipse.birt.report.data.oda.jdbc" );
so what I am looking for is the 2nd parameter "extension id" for the csv type. flat file is supported in GUI.. so it should be exposed via api. although the only data packages I see are jdbc and xml.

got it. "org.eclipse.datatools.connectivity.oda.flatfile" is the extensionId. which I obtained by running birt in the design mode and checking the XML.

Related

Is it possible to access the saved data programmatically in a .rpt file, using existing crystal jar/java api?

I have a .rpt file with saved data. I need to access the values in group tree Nodes. I am using crystal jar/java api for this. Is it possible?
Using the same api , I am able to export the report to .pdf/.xls and also able to view the report in a jframe.
Any help/lead will be highly appreciated.

How to export data from a IBM Lotus Notes Database using Java

I want to export data from a Lotus Notes database .nsf that lives on my local computer. I want to write a java program that will connect to this .nsf lotus notes database and export data from a view/form.
I am not sure how to do that ? Is there a sample code that i can refer too or a JDBC-ODBC driver ?
You actually have two issues/questions.
1) How to use Java to connect to a Notes database
2) How to export data from documents (let's use the correct terminology, form is a design element, data is stored in documents)
For 1) there is plenty of sample code available, like the link poisonedYouth referenced in his response.
For 2) I would suggest looking at the samples in the Domino Designer help. You need to undertand that Domino Object Model (DOM) first, and know how that data is stored.
But you would probably do something like this:
Create a new NotesSession object
Get a NotesDatabase object from the session
Get a NotesView object from the database
Now you can do it different ways, depending on éxactly what you want to do and things like what items are being displayed in the view.
If all fields you want to export are displayed in the view, I would do this:
Get a NotesViewEntryCollection document from the view
Use GetFirstEntry and GetNextEntry methods to loop through the collection and get the individual entries
Use the ColumnValues property of the NotesViewEntry object to get the values displayed in the view, then export those values the way you want it.
If you don't have all the values displayed in the view, use this (slower) method:
Use the GetFirstDocument and GetNextDocument methods to loop through all NotesDocuments in the view
For each document, read the field values using GetItemValues (remember that all field values are returned as an array, even if they only contain one value) and export them the way you like.
Exporting data from Notes is a very common process, and you should be able to find plenty of code.
I have a tool available(it is not open source, though) here: http://www.texasswede.com/websites/texasswede.nsf/Page/Notes%20XML%20Exporter
I also posted code on my blog that you can look at and modify: http://blog.texasswede.com/export-notes-view-to-excel-with-multi-value-fields/
I found an article with topic "Writing standalone Java code that connects to IBM Lotus Domino"
http://www-10.lotus.com/ldd/dominowiki.nsf/dx/06082009125716AMWEB7TU.htm
I recommend trying IBM Security Directory Integrator (former Tivoli Directory Integrator, or TDI). It's a integration tool especially built for your purpose.
SDI operates using so-called assembly lines where you have one or more sources and one or more destinations. In between you can manipulate your data to your hearts desire.
Some versions of TDI/SDI are free with the newest versions of IBM Domino.
Check out these sites for more info:
http://www.tdi-users.org/twiki/bin/view/Integrator/WebHome
http://www.ibm.com/developerworks/downloads/tiv/tdi/
http://www-03.ibm.com/software/products/en/directoryintegrator
Good luck!
Ove

how to see the custom properties information in the Windows property on a specific file when i right click on it using Explore?

can anybody explain to me, how to proceed in the following scenario ?
I need to add custom properties(that is new metadata to a file like example classification_of_file with value sensitive) to all files like txt,pdf,doc,docx, ppt pptx , xls,xlsx etc.. using JAVA and then i want to see this custom properties information in the Windows property on a specific file when i right click on it using Explorer .
note:
Is there any API using which i can do this ?
Is it possible to do this by using Apache Jackrabbit?
Are you talking about Windows property on a specific file when you right click on it using Explorer?
If so, you need to use the Java API for file attributes, precisely UserDefinedFileAttributeView.
You can use this view to write any property you may want on a specific file.
Path path = FileSystems.getDefault().getPath("C:/file.txt");
UserDefinedFileAttributeView view =
Files.getFileAttributeView(path, UserDefinedFileAttributeView.class);
view.write("classification_of_file", Charset.defaultCharset().encode("sensitive"));
You can also call FileStore.supportsFileAttributeView() to check if your file system supports it.
You will find more explanations on file attributes in the Java documentation.
As for the second point, I don't know Apache Jackrabbit so I can't help you that much.
Apache Jackrabbit will not help you set properties on a file that's stored in your filesystem.
It can nicely manage metadata of any kind for files that it stores itself, and which you can make available via WebDAV, but that requires storing files in the JCR repository.

Extracting Multiple Embedded Files via Oracle Search and Export

I am currently implementing the Oracle OutsideIn Search and Export tool in Java to extract the metadata and content of different files. I was able to do this on multiple files inside a folder however I wasn't able to extract the files embedded on another file. I would like to know if this is possible in Search and Export.
If not, I'd go for CleanContent but it only accepts Microsoft and PDF files.
Search Export can convert or extract embedded files from within archives or within other types of files. We distinguish between three different types of embeddings, each of which has its own option to control their conversion. The three types are archive sub-docs, email attachments, and generic embeddings. By default the first two are converted, but the third isn't. To enable generic embeddings conversion, set the SCCEX_XML_EMBEDDINGS flag in the SCCOPT_XML_SEARCHML_FLAGS option. If you are using the exporter sample app supplied with the SDK, try enabling the following in your CFG file.
embeddingsflag yes
If you are trying to extract a binary copy of the embedding, it becomes a three step process. On your initial conversion, set the SCCEX_XML_PRODUCEOBJECTINFO flag in the SCCOPT_XML_SEARCHML_FLAGS option. Use that information for the desired embedding(s) to fill in a SCCDAOBJECT structure that is passed to DAOpenDocument. The hDoc that is returned from that function can be passed to DASaveInputObject to save a binary copy of the embedding. This works for any of the three types of embeddings described above. There is no Java sample app that demonstrates this process.

How to Refresh Excel Data Source Via Java

I have an excel file that pulls in data via data connection from bunch of CSV files. The CSV files are generated every now so often by a JAVA program.
Is it possible to refresh the data too via. JAVA program? I see JXCELAPI and JOI are there, but briefly looking at their documentation doesn't indicate my use case is even possible.
In short, I need API that could achieve this effect: clicking on menu Data->Refresh All.
Thanks,
_Madhu
You could try XLLoop. This lets your spreadsheet talk directly to a java server (or a number of other languages) via function calls.
So you can have your spreadsheet call eg GetMyData("somedata") and it will load the data directly from your server whenever you re-calc (ie. Shift-F9).
BTW, I work on the project so let me know if you have any questions.
This tutorial sounds like it might help: Accessing Excel from Java
You could also try Obba which is another solution to access a Java library via Excel cell functions (UDFs)...
However, what you describe could also be done by a very small vb/vba macro which checks/polls for modification of these CVS files. I don't know if this is suitable in your situation, but there is an event listener for that: http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.changed.aspx#Y0

Categories