[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/xml PersistenceManager.java,1.28,1.29
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-03-25 16:55:38
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31954/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: Minor changes to persistensemanager Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** PersistenceManager.java 23 Mar 2006 10:43:49 -0000 1.28 --- PersistenceManager.java 25 Mar 2006 16:55:15 -0000 1.29 *************** *** 90,95 **** // Create all references ! loadRefConstructionSpace(bp.getConstructionspace()); ! loadRefFunctionalSpace(bp.getFunctionalspace()); loadRefSurface(bp.getSurface()); loadRefEdge(bp.getEdge()); --- 90,95 ---- // Create all references ! loadRefSpace(bp.getConstructionspace()); ! loadRefSpace(bp.getFunctionalspace()); loadRefSurface(bp.getSurface()); loadRefEdge(bp.getEdge()); *************** *** 116,123 **** Iterator it = l.iterator(); while (it.hasNext()) { ! Constructionspace cs = (Constructionspace)it.next(); Space csm = Space.createConstructionSpace(cs.getName()); ! csm.setDescription(cs.getDescription()); Project.getInstance().add(csm); --- 116,123 ---- Iterator it = l.iterator(); while (it.hasNext()) { ! DomainType cs = (DomainType)it.next(); Space csm = Space.createConstructionSpace(cs.getName()); ! Project.getInstance().add(csm); *************** *** 134,144 **** Iterator it = l.iterator(); while (it.hasNext()) { ! Functionalspace fs = (Functionalspace)it.next(); ! Space fsm = Space.createFunctionalSpace(fs.getName()); - fsm.setDescription(fs.getDescription()); - Project.getInstance().add(fsm); - mapper.put(new Long(fs.getId()), fsm); } --- 134,140 ---- Iterator it = l.iterator(); while (it.hasNext()) { ! DomainType fs = (DomainType)it.next(); Space fsm = Space.createFunctionalSpace(fs.getName()); Project.getInstance().add(fsm); mapper.put(new Long(fs.getId()), fsm); } *************** *** 152,167 **** Iterator it = l.iterator(); while (it.hasNext()) { ! net.sourceforge.bprocessor.model.xml.Surface s = ! (net.sourceforge.bprocessor.model.xml.Surface)it.next(); ! net.sourceforge.bprocessor.model.Surface sm = new net.sourceforge.bprocessor.model.Surface(); - sm.setConstructor(s.isConstructor()); - - //sm.setIsInner(s.isIsinner()); - Project.getInstance().add(sm); - mapper.put(new Long(s.getId()), sm); } --- 148,156 ---- Iterator it = l.iterator(); while (it.hasNext()) { ! SurfaceType s = (SurfaceType)it.next(); net.sourceforge.bprocessor.model.Surface sm = new net.sourceforge.bprocessor.model.Surface(); sm.setConstructor(s.isConstructor()); Project.getInstance().add(sm); mapper.put(new Long(s.getId()), sm); } *************** *** 212,265 **** } /** ! * Create the references ! * @param l The list */ ! private static void loadRefConstructionSpace(List l) { ! Iterator it = l.iterator(); ! while (it.hasNext()) { ! Constructionspace cs = (Constructionspace)it.next(); ! ! Space csm = (Space) mapper.get(new Long(cs.getId())); ! ! List ss = cs.getSurfaceref(); ! if (ss != null && ss.size() > 0) { ! Set sr = new HashSet(); ! Iterator iss = ss.iterator(); ! while (iss.hasNext()) { ! net.sourceforge.bprocessor.model.Surface s = ! (net.sourceforge.bprocessor.model.Surface) mapper.get((Long)iss.next()); ! sr.add(s); ! } ! csm.setEnvelope(sr); } } } ! /** * Create the references * @param l The list */ ! private static void loadRefFunctionalSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { ! Functionalspace fs = (Functionalspace)it.next(); ! ! Space fsm = (Space) mapper.get(new Long(fs.getId())); ! ! List ss = fs.getSurfaceref(); ! if (ss != null && ss.size() > 0) { ! Set sr = new HashSet(); ! Iterator iss = ss.iterator(); ! while (iss.hasNext()) { ! net.sourceforge.bprocessor.model.Surface s = ! (net.sourceforge.bprocessor.model.Surface) mapper.get((Long)iss.next()); ! sr.add(s); ! } ! fsm.setEnvelope(sr); ! } } } ! /** * Create the references --- 201,246 ---- } + /** ! * Convert xml surface-list into a surface set ! * @param ss Surface-list ! * @return Surface-set */ ! private static Set loadSurfaceSet(List ss) { ! Set sr = new HashSet(); ! if (ss != null && ss.size() > 0) { ! Iterator iss = ss.iterator(); ! while (iss.hasNext()) { ! net.sourceforge.bprocessor.model.Surface s = ! (net.sourceforge.bprocessor.model.Surface) mapper.get((Long)iss.next()); ! sr.add(s); } } + return sr; } ! ! /** ! * Load content ! * @param domain The data ! * @param space The result ! */ ! private static void loadDomainContent(DomainType domain, Space space) { ! space.setDescription(domain.getDescription()); ! space.setEnvelope(loadSurfaceSet(domain.getSurfaceref())); ! } ! /** * Create the references * @param l The list */ ! private static void loadRefSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { ! DomainType domain = (DomainType)it.next(); ! Space space = (Space) mapper.get(new Long(domain.getId())); ! loadDomainContent(domain, space); } } ! /** * Create the references *************** *** 397,401 **** saveRefSurface(bp, project.getSurfaces()); saveRefVertex(bp, project.getVertices()); - return bp; } --- 378,381 ---- |