[Nextobjects-devel] nextobjects/nextobjects/src/org/devaki/nextobjects/util MeriseTransform.java,1.1
Status: Alpha
Brought to you by:
eflorent
From: <efl...@us...> - 2003-05-26 17:48:54
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util In directory sc8-pr-cvs1:/tmp/cvs-serv4283/src/org/devaki/nextobjects/util Modified Files: MeriseTransform.java Log Message: Fixed major bugs in Merise Transformation Index: MeriseTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/MeriseTransform.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MeriseTransform.java 26 May 2003 17:15:53 -0000 1.17 --- MeriseTransform.java 26 May 2003 17:48:51 -0000 1.18 *************** *** 340,345 **** Association pAsso) { ! /* Rule 3 */ Column newField; Constraint newCst=null; // here we try to reach the left or the right part of the Association Class. --- 340,350 ---- Association pAsso) { ! /* ! * a temp column to be created under one of the two tables. ! */ Column newField; + /* + * The constraint to be created + */ Constraint newCst=null; // here we try to reach the left or the right part of the Association Class. *************** *** 371,377 **** if (pAsso.getCardAt(0)==ConceptualModel._11_) { newField.setRequired(true); - } else { //force cause we have a 1 in 1N. ! // (even if it'salways already set, the value is forced) newField.setRequired(false); } --- 376,382 ---- if (pAsso.getCardAt(0)==ConceptualModel._11_) { newField.setRequired(true); //force cause we have a 1 in 1N. ! // (even if it'salways already set, the value is forced) ! } else { newField.setRequired(false); } *************** *** 395,399 **** // attributes towards entity provided with cardinalities 1:1. ! for (int i=0;i<pAsso.getData().size();i++) { pAsso.getEntityAt(1).getSubsequentTable().getData() .addElement(new Column((Column)pAsso.getData().elementAt(i))); --- 400,405 ---- // attributes towards entity provided with cardinalities 1:1. ! for (int i=0;i<pAsso.getData().size();i++) ! { pAsso.getEntityAt(1).getSubsequentTable().getData() .addElement(new Column((Column)pAsso.getData().elementAt(i))); *************** *** 403,411 **** pAsso.getEntityAt(1).getSubsequentTable().setIdMethod("none"); ! if (pAsso.getCardAt(1)==ConceptualModel._11_) { ! newField.setRequired(true); ! } else { //force cause we have a 1 in 1N. ! // (even if it'salways already set, the value is forced) newField.setRequired(false); } --- 409,418 ---- pAsso.getEntityAt(1).getSubsequentTable().setIdMethod("none"); ! if (pAsso.getCardAt(1)==ConceptualModel._11_) ! { //force cause we have a 1 in 1N. ! // (even if it'salways already set, the value is forced) ! newField.setRequired(true); ! } else { // this is the statement wich interrest me: newField.setRequired(false); } *************** *** 419,431 **** } private static void applyRule_NN_(PhysicalModel theDatabase, Association pAsso) { ! ! // Rule 4 : In the case of entities connected by associations of the n:m ! // type, an intermediate Table known as "Link Table", must be created, and ! // must have as primary key a conjunction of the primary keys of the two ! // tables for which it is connected. ! Table newTable=new Table(theDatabase); --- 426,447 ---- } + /* + * Rule 4 : In the case of entities connected by associations of the n:m + * type, an intermediate Table known as "Link Table", must be created, and + * must have as primary key a conjunction of the primary keys of the two + * tables for which it is connected. + * + * @param theDatabase The context database + * @param pAsso The association to be treated. + * @author efl...@de... + * @see http://www.devaki.org/transformation.html + */ + private static void applyRule_NN_(PhysicalModel theDatabase, Association pAsso) { ! /* ! * The table to be created. ! */ Table newTable=new Table(theDatabase); *************** *** 455,460 **** (Column)pAsso.getData().elementAt(i))); } ! Column newField; Constraint newCst=null; for (int i=0;i<pAsso.getMyAssociationLinks().size();i++) --- 471,483 ---- (Column)pAsso.getData().elementAt(i))); } ! ! /* ! * Column we create ! */ Column newField; + + /* + * Constraint to be created(s) + */ Constraint newCst=null; for (int i=0;i<pAsso.getMyAssociationLinks().size();i++) *************** *** 462,466 **** newField=new Column(pAsso.getIdentifierAt(i)); newField.setPrimaryKey(true); ! newField.setRequired(true); newField.setAutoIncrement(false); // always in that case! newTable.getData().addElement(newField); --- 485,492 ---- newField=new Column(pAsso.getIdentifierAt(i)); newField.setPrimaryKey(true); ! if (pAsso.getCardAt(i)==ConceptualModel._0N_) ! { ! newField.setRequired(false); ! } newField.setAutoIncrement(false); // always in that case! newTable.getData().addElement(newField); |