views:

35

answers:

0

Hey everyone,

I'd like a few pointers as to a very specific situation i'm in regarding desigining and implementing a package in Java in an object-oriented manner. I hope i can get the idea across in a clear and not so sophisticated manner - or maybe not. Any ideas on useful design patterns to look at?

Here goes..

The outline of the project is to achieve two goals..which are related. Import excel data and export data from a DB to an excel spradsheet. At my disposal I have Apache POI - reading and writing workbooks using the HSSF (Horrible Stylesheet Format)API.

When you export you can export data related to one specific tyre or a group of tyres and materials that maybe used in a project of tyres. - Factor in the idea that other ideas could spring up on where it useful to require Excel export.

So to begin I thought/desigined something just for exporting data. As follows the overall data is related to the manufacture of real life objects. So i have an object(car tyre) and the manufacturer wants to display specific types of data- rubber data, class of tyre, manufacturing related information - each related to a particular design of a tyre. Each likely section of data needs to be in a seperate sheet in the Excel workbook. So you can have a number of attributes related to a tyre design per section e.g. class of tyre or rubber data.

So a method is kicked of from the web saying this is what I want - i collect the selected attributes..and now have to split them up into relevant sheets and designs related to whether the request was for one tyre item or a tyre project. Needs to be handle what ever is thrown at it like a black box..nobody else needs to know whats going on behind the scenes just what to throw at it.

We move on.. in my design I have a factory that accepts and Array of all the attributes - the idea this sorts the attributes into specific attribute objects related to which tyre etc. However depending on the worksheet that is being crafted the inner attribute details may change thus relating to the brain fart i'm having when thinking of actually building the spreadsheet. As a process for creating the rubber for the tyre cna have a number of processes where properties change for instance: Stage one the temperature may be 85 degrees but stage 2 and 3 it might be 105 degrees. This can occure for per tyre design. So the spreadhseet needs to have a row per tyre design. The idea of having a bunch of attributes inherited from a single attribute now becomes a problem when trying to fit all of them into the spreadsheet in a logiical fashion..So the other idea I have is a composition of a tyre being made of a design which in turn is made up of attributes. The design would include these layers..I can then search for attributes that make up the design that belong to a layer and right them out into the spreadsheet a row at a time.

I then have the other problem of wanting to use a similar principal for importing back in using the same objects - reading the excel data with POI to create a group of attributes(or tyre designs with attributes) then submitting them back into the DB.

Sorry for the mind f**k here but it seeming overly complicated to explain for what on the outside seems straighforward. I am determined to do it the OO way as it seems the most logical way of breaking the problem and allowing for future additions and ease of maintenance.

Any pointers (if you have any idea what i'm going on about) would be appreciated.