[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Relation.java, 1.6, 1.7 Persistence.
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2007-03-13 09:56:52
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9733/src/net/sourceforge/bprocessor/model Modified Files: Relation.java Persistence.java Log Message: Persistence implemented for relations Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Persistence.java 31 Jan 2007 20:52:33 -0000 1.34 --- Persistence.java 13 Mar 2007 09:56:50 -0000 1.35 *************** *** 26,29 **** --- 26,30 ---- import net.sourceforge.bprocessor.model.xml.PointType; import net.sourceforge.bprocessor.model.xml.RefType; + import net.sourceforge.bprocessor.model.xml.RelationType; import net.sourceforge.bprocessor.model.xml.RotateType; import net.sourceforge.bprocessor.model.xml.ScaleType; *************** *** 53,56 **** --- 54,58 ---- import net.sourceforge.bprocessor.model.xml.impl.PointTypeImpl; import net.sourceforge.bprocessor.model.xml.impl.RefTypeImpl; + import net.sourceforge.bprocessor.model.xml.impl.RelationImpl; import net.sourceforge.bprocessor.model.xml.impl.RotateTypeImpl; import net.sourceforge.bprocessor.model.xml.impl.ScaleTypeImpl; *************** *** 585,588 **** --- 587,598 ---- } + + private static Relation internalizeRelation(RelationType xml, Map mapper) { + Relation relation = new Relation(); + relation.setOffset(xml.getOffset()); + relation.setGeometric((Geometric) get(xml.getGeometric(), mapper)); + return relation; + } + /** * *************** *** 617,620 **** --- 627,639 ---- constructor.connect((Geometric)get(((Long)iter.next()).longValue(), map)); } + + if (constructor instanceof CoordinateSystem) { + CoordinateSystem system = (CoordinateSystem) constructor; + CoordinateSystemType xml = (CoordinateSystemType) type; + List<RelationType> relations = xml.getRelation(); + for (RelationType current : relations) { + system.add(internalizeRelation(current, map)); + } + } } *************** *** 1160,1163 **** --- 1179,1189 ---- } + private static RelationType externalizeRelation(Relation relation, Map map) { + RelationType xml = new RelationImpl(); + xml.setOffset(relation.getOffset()); + xml.setGeometric(id(map, relation.geometric())); + return xml; + } + /** * Return the id of an xml entity by looking the entity up in the map *************** *** 1350,1353 **** --- 1376,1388 ---- xml.getConnected().add(new Long(l)); } + + if (object instanceof CoordinateSystem) { + CoordinateSystem system = (CoordinateSystem) object; + CoordinateSystemType cs = (CoordinateSystemType) xml; + Collection<Relation> relations = system.relations(); + for (Relation current : relations) { + cs.getRelation().add(externalizeRelation(current, map)); + } + } } Index: Relation.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Relation.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Relation.java 12 Mar 2007 08:32:47 -0000 1.6 --- Relation.java 13 Mar 2007 09:56:50 -0000 1.7 *************** *** 28,31 **** --- 28,40 ---- private String offset; + + /** + * Construct an empty Relation + * + */ + public Relation() { + + } + /** * Constructs a Relation *************** *** 55,58 **** --- 64,75 ---- /** + * Sets the offset. + * @param offset The offset + */ + public void setOffset(String offset) { + this.offset = offset; + } + + /** * * @return geometric *************** *** 63,66 **** --- 80,91 ---- /** + * Sets the geometric + * @param geometric The geometric + */ + public void setGeometric(Geometric geometric) { + this.geometric = geometric; + } + + /** * @return offset */ |