[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model/xml PersistenceManager.java,1.23,1.24
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-02-01 11:37:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30832/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: removed all references to attribute Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** PersistenceManager.java 1 Feb 2006 09:00:22 -0000 1.23 --- PersistenceManager.java 1 Feb 2006 11:36:56 -0000 1.24 *************** *** 12,16 **** import net.sourceforge.bprocessor.model.Space; - import net.sourceforge.bprocessor.model.xml.impl.AttributeImpl; import net.sourceforge.bprocessor.model.xml.impl.BprocessorImpl; import net.sourceforge.bprocessor.model.xml.impl.ConstructionspaceImpl; --- 12,15 ---- *************** *** 89,96 **** mapper = new HashMap(); - Map attribs = new HashMap(); - // Create all objects - loadAttribute(bp.getAttribute(), attribs); loadConstructionSpace(bp.getConstructionspace()); loadFunctionalSpace(bp.getFunctionalspace()); --- 88,92 ---- *************** *** 100,108 **** // Create all references ! loadRefConstructionSpace(bp.getConstructionspace(), attribs); ! loadRefFunctionalSpace(bp.getFunctionalspace(), attribs); ! loadRefSurface(bp.getSurface(), attribs); ! loadRefEdge(bp.getEdge(), attribs); ! loadRefVertex(bp.getVertex(), attribs); fis.close(); --- 96,104 ---- // Create all references ! loadRefConstructionSpace(bp.getConstructionspace()); ! loadRefFunctionalSpace(bp.getFunctionalspace()); ! loadRefSurface(bp.getSurface()); ! loadRefEdge(bp.getEdge()); ! loadRefVertex(bp.getVertex()); fis.close(); *************** *** 110,133 **** /** - * Load attributes - * @param al The attribute list - * @param attribs The attribute map - */ - private static void loadAttribute(List al, Map attribs) { - Iterator it = al.iterator(); - while (it.hasNext()) { - net.sourceforge.bprocessor.model.xml.Attribute a = - (net.sourceforge.bprocessor.model.xml.Attribute)it.next(); - - net.sourceforge.bprocessor.model.Attribute am = - new net.sourceforge.bprocessor.model.Attribute(a.getName(), a.getType(), a.getValue()); - - mapper.put(new Long(a.getId()), am.getId()); - - attribs.put(am.getId(), am); - } - } - - /** * Load construction spaces * @param l The list --- 106,109 ---- *************** *** 235,241 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefConstructionSpace(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 211,216 ---- * Create the references * @param l The list */ ! private static void loadRefConstructionSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 243,259 **** Space csm = (Space) mapper.get(new Long(cs.getId())); ! ! List as = cs.getAttributeref(); ! if (as != null && as.size() > 0) { ! Set ar = new HashSet(); ! Iterator ias = as.iterator(); ! while (ias.hasNext()) { ! Long aid = (Long)mapper.get((Long)ias.next()); ! net.sourceforge.bprocessor.model.Attribute a = ! (net.sourceforge.bprocessor.model.Attribute)attribs.get(aid); ! ar.add(a); ! } ! csm.setAttributes(ar); ! } List ss = cs.getSurfaceref(); if (ss != null && ss.size() > 0) { --- 218,222 ---- Space csm = (Space) mapper.get(new Long(cs.getId())); ! List ss = cs.getSurfaceref(); if (ss != null && ss.size() > 0) { *************** *** 273,279 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefFunctionalSpace(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 236,241 ---- * Create the references * @param l The list */ ! private static void loadRefFunctionalSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 282,297 **** Space fsm = (Space) mapper.get(new Long(fs.getId())); - List as = fs.getAttributeref(); - if (as != null && as.size() > 0) { - Set ar = new HashSet(); - Iterator ias = as.iterator(); - while (ias.hasNext()) { - Long aid = (Long)mapper.get((Long)ias.next()); - net.sourceforge.bprocessor.model.Attribute a = - (net.sourceforge.bprocessor.model.Attribute)attribs.get(aid); - ar.add(a); - } - fsm.setAttributes(ar); - } List ss = fs.getSurfaceref(); if (ss != null && ss.size() > 0) { --- 244,247 ---- *************** *** 311,317 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefSurface(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 261,266 ---- * Create the references * @param l The list */ ! private static void loadRefSurface(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 364,370 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefEdge(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 313,318 ---- * Create the references * @param l The list */ ! private static void loadRefEdge(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 388,394 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefVertex(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 336,341 ---- * Create the references * @param l The list */ ! private static void loadRefVertex(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 455,476 **** /** - * Save the attribute - * @param bp The BProcessor document - * @param a The attribute - * @return The attribute id - */ - private static Long saveAttribute(Bprocessor bp, net.sourceforge.bprocessor.model.Attribute a) { - net.sourceforge.bprocessor.model.xml.Attribute ax = new AttributeImpl(); - ax.setId(counter++); - ax.setName(a.getName()); - ax.setType(a.getType()); - ax.setValue(a.getValue()); - - bp.getAttribute().add(ax); - - return new Long(ax.getId()); - } - - /** * Save the construction space * @param bp The BProcessor document --- 402,405 ---- *************** *** 487,502 **** csx.setDescription(cs.getDescription()); - Set data = cs.getAttributes(); - if (data != null) { - Iterator it = data.iterator(); - while (it.hasNext()) { - net.sourceforge.bprocessor.model.Attribute a = - (net.sourceforge.bprocessor.model.Attribute)it.next(); - - Long aid = saveAttribute(bp, a); - - csx.getAttributeref().add(aid); - } - } Map csm = (Map)mapper.get(KEY_DOMAIN); csm.put(cs.getId(), new Long(csx.getId())); --- 416,419 ---- *************** *** 521,536 **** fsx.setDescription(fs.getDescription()); - Set data = fs.getAttributes(); - if (data != null) { - Iterator it = data.iterator(); - while (it.hasNext()) { - net.sourceforge.bprocessor.model.Attribute a = - (net.sourceforge.bprocessor.model.Attribute)it.next(); - - Long aid = saveAttribute(bp, a); - - fsx.getAttributeref().add(aid); - } - } Map fsm = (Map)mapper.get(KEY_DOMAIN); fsm.put(fs.getId(), new Long(fsx.getId())); --- 438,441 ---- |