budget/src/main/java/budget/backend/stores/TagStore.java
public boolean add(Tag t) throws Exception
  {
    try {
      dataChecker.verifyTag(t);
      iTag parent = this.find(t.getParent().getId());
      if (parent == null){
        String newParentID = t.getId().substring(0, 1);
        newParentID += "0000"; //recreate the id of a default tag
        parent = this.find(newParentID);
        t.setParent((Tag)parent);
      }
      //add to parent as descendant
      parent.getDescendants().add(t);

      map.put(t.getId(), t);
      
    } catch (Exception e) {
      throw e;
    }
    return true;
  }
/**
   * Add a predefined Tag to the structure. Parent has to be a known tag to the structure, or a default tag.
   * 
   * If the parent is not found, but the id is verified, add this to one of the default tags.
   * @param t
   * @return true if the tag was added to the structure
   */
Add a predefined Tag to the structure. Parent has to be a known tag to the structure, or a default tag.

If the parent is not found, but the id is verified, add this to one of the default tags.
@param t
@return true if the tag was added to the structure
Add a predefined Tag to the structure . Parent has to be a known tag to the structure or a default tag . If the parent is not found but the id is verified add this to one of the default tags . @param t @return true if the tag was added to the structure
public boolean add(Tag t) throws Exception
  {
    try {
      dataChecker.verifyTag(t);
      iTag parent = this.find(t.getParent().getId());
      if (parent == null){
        String newParentID = t.getId().substring(0, 1);
        newParentID += "0000"; 
        parent = this.find(newParentID);
        t.setParent((Tag)parent);
      }
      parent.getDescendants().add(t);
      map.put(t.getId(), t);
    } catch (Exception e) {
      throw e;
    }
    return true;
  }
public boolean add ( Tag t ) throws Exception { try { dataChecker . verifyTag ( t ) ; iTag parent = this . find ( t . getParent ( ) . getId ( ) ) ; if ( parent == null ) { String newParentID = t . getId ( ) . substring ( 0 , 1 ) ; newParentID += "0000" ; parent = this . find ( newParentID ) ; t . setParent ( ( Tag ) parent ) ; } parent . getDescendants ( ) . add ( t ) ; map . put ( t . getId ( ) , t ) ; } catch ( Exception e ) { throw e ; } return true ; }
Add a predefined Tag to the structure.
Add a predefined Tag to the structure .
//recreate the id of a default tag //add to parent as descendant