Example #1
0
  /**
   * The project should be inherited to sub-nodes. This method returns the project from the first
   * parent with a
   *
   * <ul>
   *   customer
   * </ul>
   *
   * defined. If that node has no project deined this method returns <null>. The reason we check the
   * customer is that this customer is inherited to sub-nodes and this customer defines available
   * project numbers. If no project is defined then there is no default project number or sub-nodes.
   *
   * @param node
   * @return customer - first Customer defined up-streams.
   */
  public Project getProjectFromParent() {
    Project project = null;
    Node node = this;

    while (node != null) {
      if (node.getCustomer() != null) {
        project = node.getProject();
        break;
      }

      switch (node.eClass().getClassifierID()) {
        case RememberPackage.FOLDER:
          node = ((Folder) node).getParent();
          break;

        case RememberPackage.TASK:
          node = ((Task) node).getParent();
          break;

        default:
          node = null;
      }
    }

    return project;
  }
Example #2
0
  /**
   * The customer should be inherited to sub-nodes. This method returns the customer from the first
   * parent with a customer defined.
   *
   * @param node
   * @return customer - first Customer defined up-streams.
   */
  public Customer getCustomerFromParent() {
    Customer customer = null;
    Node node = this;

    while (node != null) {
      customer = node.getCustomer();
      if (customer != null) break;

      switch (node.eClass().getClassifierID()) {
        case RememberPackage.FOLDER:
          node = ((Folder) node).getParent();
          break;

        case RememberPackage.TASK:
          node = ((Task) node).getParent();
          break;

        default:
          node = null;
      }
    }

    return customer;
  }