[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Classification.java, 1.5, 1.6 Space.
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nikolaj B. <nbr...@us...> - 2007-01-06 21:07:08
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29473/src/net/sourceforge/bprocessor/model Modified Files: Classification.java Space.java Project.java Attribute.java Persistence.java Log Message: Fixed types so the id field is now correct aswell. Also added so types are saved and loaded. Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Attribute.java 10 Nov 2006 13:48:45 -0000 1.15 --- Attribute.java 6 Jan 2007 21:06:59 -0000 1.16 *************** *** 30,35 **** private Classification classification; ! /** The level of the space ie if its space, element or part level */ ! private int level; /** The precision of the object */ --- 30,35 ---- private Classification classification; ! /** The space the classification is for */ ! private Space level; /** The precision of the object */ *************** *** 97,101 **** * @param level the level of the space ie 1: space, 2: element or 3: part */ ! public Attribute(String name, Object value, Classification classification, int level) { setName(name); setValue(value); --- 97,101 ---- * @param level the level of the space ie 1: space, 2: element or 3: part */ ! public Attribute(String name, Object value, Classification classification, Space level) { setName(name); setValue(value); *************** *** 216,220 **** * @return Returns the level. */ ! public int getLevel() { return level; } --- 216,220 ---- * @return Returns the level. */ ! public Space getLevel() { return level; } *************** *** 223,227 **** * @param level The level of the space. */ ! public void setLevel(int level) { this.level = level; } --- 223,227 ---- * @param level The level of the space. */ ! public void setLevel(Space level) { this.level = level; } Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Persistence.java 5 Jan 2007 13:54:48 -0000 1.30 --- Persistence.java 6 Jan 2007 21:06:59 -0000 1.31 *************** *** 210,213 **** --- 210,215 ---- space.setClassification(Project.getInstance(). getClassification(xml.getClassification(), 0)); + space.setTypeClassification(Project.getInstance(). + getProduktType(xml.getClassification())); } else { Classification newclas = new Classification("-1", xml.getClassification(), *************** *** 821,825 **** xml.setClassification(space.getClassification().getName()); } else { ! xml.setClassification(space.getClassification().getFullId()); } } else { --- 823,827 ---- xml.setClassification(space.getClassification().getName()); } else { ! xml.setClassification(space.getClassification().getFullId(space)); } } else { Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** Space.java 2 Jan 2007 17:48:58 -0000 1.108 --- Space.java 6 Jan 2007 21:06:59 -0000 1.109 *************** *** 1505,1512 **** if (isConstructionSpace()) { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), 1)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), 1)); } } else { --- 1505,1512 ---- if (isConstructionSpace()) { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), this)); } } else { *************** *** 1516,1531 **** if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), 2)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), 2)); } } else { if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), 2)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), 2)); } } --- 1516,1531 ---- if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), this)); } } else { if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), this)); } } *************** *** 1534,1549 **** if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), 3)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), 3)); } } else { if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), 3)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), 3)); } } --- 1534,1549 ---- if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), this)); } } else { if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), this)); } } *************** *** 1552,1556 **** if (getClassification() != null && !getClassification().getProdukt().equalsIgnoreCase("")) { res.add(new Attribute("Type", Project.getInstance(). ! getType(getClassification().getName()), getTypeClassification(), 4)); } res.add(new Attribute("ID", getId().toString(), false)); --- 1552,1556 ---- if (getClassification() != null && !getClassification().getProdukt().equalsIgnoreCase("")) { res.add(new Attribute("Type", Project.getInstance(). ! getType(getClassification().getName()), getTypeClassification(), this)); } res.add(new Attribute("ID", getId().toString(), false)); Index: Classification.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Classification.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Classification.java 17 Dec 2006 20:23:36 -0000 1.5 --- Classification.java 6 Jan 2007 21:06:59 -0000 1.6 *************** *** 151,163 **** /** * Generates the full id for this classification * @return the full id */ ! public String getFullId() { String fullId = id.toString(); Classification par = parent; if (par != null) { ! while (!par.getName().equalsIgnoreCase("Classification")) { ! fullId = par.getId() + "." + fullId; ! par = par.getParent(); } } --- 151,193 ---- /** * Generates the full id for this classification + * @param cur the Space that the full id is generated for * @return the full id */ ! public String getFullId(Space cur) { ! Space current = cur; String fullId = id.toString(); + if (current.getTypeClassification() != null) { + if (!("" + fullId.charAt(0)).equalsIgnoreCase("-")) { + if (!current.getTypeClassification().getId().equalsIgnoreCase("0")) { + fullId = current.getTypeClassification().getId() + fullId; + } + } else { + if (!current.getTypeClassification().getId().equalsIgnoreCase("0")) { + fullId = "-" + current.getTypeClassification().getId() + fullId.replaceFirst("-", ""); + } + } + } Classification par = parent; if (par != null) { ! if (cur.getOwner().getLevel() != 2) { ! current = cur.getOwner(); ! if (current.getClassification() == par) { ! if (current.getTypeClassification() != null) { ! fullId = current.getClassification().getFullId(current) + "." + fullId; ! } else { ! fullId = current.getClassification().getFullId(current) + "." + fullId; ! } ! par = par.getParent(); ! current = current.getOwner(); ! } else { ! fullId = current.getClassification().getFullId(current) + "." + fullId; ! par = par.getParent(); ! } ! ! } else { ! while (!par.getName().equalsIgnoreCase("Classification")) { ! fullId = par.getId() + "." + fullId; ! par = par.getParent(); ! } } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** Project.java 2 Jan 2007 18:30:55 -0000 1.106 --- Project.java 6 Jan 2007 21:06:59 -0000 1.107 *************** *** 932,935 **** --- 932,953 ---- while (st.hasMoreTokens()) { curid = st.nextToken(); + if (("" + curid.charAt(0)).equalsIgnoreCase("-")) { + if (!Character.isDigit(curid.charAt(1))) { + if (!Character.isDigit(curid.charAt(2))) { + curid = "-" + curid.substring(3); + } else { + curid = "-" + curid.substring(2); + } + } + } else { + if (!Character.isDigit(curid.charAt(0))) { + if (!Character.isDigit(curid.charAt(1))) { + curid = curid.substring(2); + } else { + curid = curid.substring(1); + } + } + } + Iterator it = cl.getChildren().iterator(); while (it.hasNext()) { *************** *** 966,980 **** } - /** * this method returns the produkt type * @param id the id of the type wanted ! * @param clas is the classification the type is for ! * @return tmep the produkt type * */ ! public Classification getProduktType(Classification clas, String id) { ! Classification temp = getType(clas.getProdukt()); ! return temp; } --- 984,1031 ---- } /** * this method returns the produkt type * @param id the id of the type wanted ! * @return temp the produkt type * */ ! public Classification getProduktType(String id) { ! Classification temp = getClassification(id, 0); ! Classification pt = Project.getInstance().getType(temp.getName()); ! StringTokenizer st = new StringTokenizer(id, "."); ! String last = ""; ! while (st.hasMoreElements()) { ! last = st.nextToken(); ! } ! if (("" + last.charAt(0)).equalsIgnoreCase("-")) { ! if (!Character.isDigit(last.charAt(1))) { ! if (!Character.isDigit(last.charAt(2))) { ! last = last.charAt(1) + "." + last.charAt(2); ! } else { ! last = last.charAt(1) + ""; ! } ! } ! } else { ! if (!Character.isDigit(last.charAt(0))) { ! if (!Character.isDigit(last.charAt(1))) { ! last = last.charAt(0) + "." + last.charAt(1); ! } else { ! last = last.charAt(0) + ""; ! } ! } ! } ! StringTokenizer s = new StringTokenizer(last, "."); ! while (s.hasMoreTokens()) { ! ! String curid = s.nextToken(); ! Iterator it = pt.getChildren().iterator(); ! while (it.hasNext()) { ! Classification current = (Classification) it.next(); ! if (curid.equalsIgnoreCase(current.getId())) { ! pt = current; ! } ! } ! } ! return pt; } |