Wednesday, September 19, 2007

backup

Design:

Types (classes):
DigitalEntity, SIP, PrimaryDE extend DigitalEntity
Relation

DigitalEntity
Data members:
Boolean isParent (true if the DE is a parent, false otherwise)
File deFile (Digital Entity file that this DigitalEntity object represent)
FCLA_JAXPDOMParser parser;
String pid;
Set subordinateSet;
int sizeOfSet;


Methods:

public String getEntityType(FCLA_JAXDOMParser parser){}
public String getUsageType(FCLA_JAXDOMParser parser){}
public String getIngestID(FCLA_JAXDOMParser parser){}
public Set getIncludingList(FCLA_JAXDOMParser parser){}
//for PRIMARYTYPE_A only























1. createDESet(String dir) return deSet
In this step, method takes in digital_entities directory path as parameter, create a set of digital entity objects (DigitalEntity). The method calls to construct DigitalEntity instance for each file in the specified directory, within which primary type of each digital entity is roughly defined as A1, B, C1 and NONE. (by roughly we mean 1 if a DE has a non-null value of , it is a parent of some other DE but not necessary a primary of a set because it might be include in other DE as kid; 2 if begins with “dep”, it may fall into case a or case b, we can not tell without look into other Des of the same set with same ingest id.) The construction method of individual DigitalEntity also define isParent of the DE by looking at .
The method also creates sets of ingestIDs and includedPids. The set ingestIDs contains the unique (no duplicate) names (String) of ingest_id from those of primary type of C1. The set includedPids contains unique of those pids that appear in and of includes.
The method returns a set contain all DgitalEntity objects corresponding to all the files in digital_entities export directory of digitool.

2. createPrimarySet(Set deSet) return pSet
The method take the set of DEs, using the sets of ingestIDs and includedPids to determine the set of primary DEs by iterating each of the instance of the DEs.
First we create a HashMap of cSets to contain sets of type C1 DEs for each ingest_id.
Then we iterate each of the DE in the deSet and do the following:
• If the primary type of a DE is A1, check to see if the pid of the DE is contained in includedPids. If not, set its primary type to A and add it to pSet which is a set of primary DEs and remove it from deSet. If yes, set its primary type to NONE.
• If the primary type is B, put it to pSet and remove it from deSet.
• If the primary type is C1, check if is ingest_id is still contained in ingestIDs, if yes, create a set cSet containing the DE and add to cSets with its ingest_id, i.e., cSets.put(ingest_id, cSet), and remove the ingest_id from set ingestIDs; on the other hand, if ingest_id is not contained in the ingestIDs set, get the cSet of the specific ingest_id and add the DE to the set. For both cases, remove the DE from deSet upon done.

Next, we iterate the pSet containing both type A and B primary DEs, for each DE:
• As A, We include all the DEs (non-primary) referenced in this primary DE’s blocks where the value of is “includes” to its data member subordinateSet, wrapped by Relation, with relation property of “including”, remove from deSet upon finished, adjust the sizeOfSet. *We check to see if the non-primary DE is parent or not, if it is also a parent, add those children DE that the parent indicates in the blocks to the non-primary DE’s subordinateSet, remove these children from deSet and adjust the primary DE’s sizeOfSet. In The meanwhile, we also check to see either type(parent or not-a-parent) DE included has contain manifestation links that are not referenced in the primary DE by checking the primary DE’s including list. If the manifestation is not included in the list, we add the DE of the manifestation to the non-primary (also non-parent) DE’s subordinateSet wrapped by Relation (with property of “manifestation”) * The step (within *) recursively execute until all included DEs containing no parent.
• As B, we add all the DEs wrapped by Relation (with property of “manifestation”.) that are manifestations referenced by the primary DE to subordinateSet, adjust the sizeOfSet, remove the every DE from deSet when done. We check the manifestation list of the subordinate DE to see if there is any referenced manifestation not included in the primary DE’s manifestation list. If yes, add the DE wrapped with Relation to the non-primary DE’s subordinateSet, and remove it from deSet, adjust the sizeOfSet of the primary DE.

To treat the sets of C, we iterate cSets, let cSet be a set in cSets with key “key”, all the DEs in cSet has ingest_id==”key”. We mark the DE with “entity” if we find one and only one that has non-null entity_type, mark DE with “usage_type” if we find one and only one DE with usage_type of “WIEW-MAIN”, mark “zero” if we find one and only one with element in is “0”.
• If we have entity is not null (one DE in the set has been marked), we change the DE with the mark of “entity” to have primary type of A, and as above step to include the children DE to its subordinateSet and remove it from the cSet.
• Else if we have entity is null (no such DE) , and have “usage_type” not equal to null (some DE has been marked by usage_type), ), we change the DE with the mark of “entity” to have primary type of B, and as above step to include the children DE to its subordinateSet and remove it from the cSet.
• Else if we have both entity and usage_type equal to null, but zero is not, we change the DE with the mark of “entity” to have primary type of C and including all the rest of DE to its subordinateSet.
• Else, error.

Finally We combine each of the cSet in cSets to pSet.

3. aaaa

4. bbbb