Ejemplo n.º 1
0
  public void initCustomerIssues() {
    EOFetchSpecification fs;
    NSDictionary bindings = null;
    Session s = (Session) session();
    NSMutableArray qual = new NSMutableArray();
    NSMutableArray qual1 = new NSMutableArray();
    EOQualifier qualifier;

    // 'Open items'
    // qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugStatus !='CLOSED'", null));
    // qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugStatus !='RESOLVED'", null));
    // qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugStatus !='VERIFIED'", null));

    // Taser
    qual1.addObject(EOQualifier.qualifierWithQualifierFormat("type = 'Prospect'", null));
    qual1.addObject(EOQualifier.qualifierWithQualifierFormat("type = 'Customer'", null));
    qual.addObject(new EOOrQualifier(qual1));

    // Single Customer
    if (customerId() != null) {
      qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugId=" + customerId(), null));
      showProductSelector = true;
    } else {
      // Products
      if (selectedProducts.count() == 1) {
        if (selectedProducts.contains("Trusted Access")) {
          qual.addObject(
              EOQualifier.qualifierWithQualifierFormat(
                  "product.productName = 'Device: Trusted Access'", null));
        } else if (selectedProducts.contains("Secure Storage")) {
          qual.addObject(
              EOQualifier.qualifierWithQualifierFormat(
                  "product.productName = 'Device: Secure Storage'", null));
        }
      }
    }

    Object orderings[] = {
      EOSortOrdering.sortOrderingWithKey("version", EOSortOrdering.CompareAscending),
      EOSortOrdering.sortOrderingWithKey("targetMilestone", EOSortOrdering.CompareAscending),
      EOSortOrdering.sortOrderingWithKey(
          "priority", EOSortOrdering.CompareCaseInsensitiveAscending),
      EOSortOrdering.sortOrderingWithKey(
          "bugSeverity", EOSortOrdering.CompareCaseInsensitiveAscending),
    };

    fs = new EOFetchSpecification("Item", new EOAndQualifier(qual), new NSArray(orderings));
    fs.setRefreshesRefetchedObjects(true);

    ((EODatabaseDataSource) customerIssueDisplayGroup.dataSource()).setFetchSpecification(fs);
    customerIssueDisplayGroup.fetch();
  }
Ejemplo n.º 2
0
  public NSArray customerIssues() {
    NSMutableArray allChildren = new NSMutableArray();
    NSMutableArray qual = new NSMutableArray();
    Item customer;
    Item child;

    if (customerIssues == null) {

      if (bugId() != null) {
        qual.addObject(EOQualifier.qualifierWithQualifierFormat("bugId=" + bugId(), null));
        EOFetchSpecification spec =
            new EOFetchSpecification("Item", new EOAndQualifier(qual), null);

        // Perform actual fetch
        customerIssues =
            (NSArray) session().defaultEditingContext().objectsWithFetchSpecification(spec);

      } else {

        Enumeration enumer = ((NSArray) customerIssueDisplayGroup.allObjects()).objectEnumerator();
        // For each Customer
        while (enumer.hasMoreElements()) {
          customer = (Item) enumer.nextElement();
          NSArray children = (NSArray) customer.valueForKey("allChildren");

          // Add all of their issues (if they haven't been added already
          Enumeration enumer2 = children.objectEnumerator();
          while (enumer2.hasMoreElements()) {
            child = (Item) enumer2.nextElement();
            if (!allChildren.contains(child)) {
              allChildren.addObject(child);
            }
          }
        }
        Object orderings[] = {
          EOSortOrdering.sortOrderingWithKey("version", EOSortOrdering.CompareAscending),
          EOSortOrdering.sortOrderingWithKey("targetMilestone", EOSortOrdering.CompareAscending),
          EOSortOrdering.sortOrderingWithKey(
              "priority", EOSortOrdering.CompareCaseInsensitiveAscending),
          EOSortOrdering.sortOrderingWithKey(
              "bugSeverity", EOSortOrdering.CompareCaseInsensitiveAscending),
        };

        // Sort the issues
        customerIssues =
            EOSortOrdering.sortedArrayUsingKeyOrderArray(allChildren, new NSArray(orderings));
      }
    }
    return customerIssues;
  }
Ejemplo n.º 3
0
 public NSArray itemsWithMultipleParents() {
   if (itemsWithMultipleParents == null) {
     NSMutableArray temp = new NSMutableArray();
     Enumeration enumer = customerIssues().objectEnumerator();
     while (enumer.hasMoreElements()) {
       Item taserIssue = (Item) enumer.nextElement();
       NSArray parents =
           (NSArray) taserIssue.topMostParents(); // will get some non-taser parents.
       if ((parents != null) && (parents.count() > 1)) {
         temp.addObject(taserIssue);
       }
     }
     itemsWithMultipleParents = new NSArray(temp);
   }
   return itemsWithMultipleParents;
 }
Ejemplo n.º 4
0
  public NSArray topMostTaserParents() {
    Enumeration enumer = anItem.topMostParents().objectEnumerator();
    NSMutableArray temp = new NSMutableArray();
    // System.out.println("Item - " + anItem.valueForKey("bugId")  + " - " + anItem.shortDesc());

    while (enumer.hasMoreElements()) {
      Item tempEo = (Item) enumer.nextElement();
      // System.out.println("\t\tparentA - " + tempEo.bugId() + " - " + tempEo.shortDesc());

      if ((tempEo.type().equals("Prospect")) || (tempEo.type().equals("Customer"))) {
        temp.addObject(tempEo);

        // System.out.println("\t\tparentB - " + tempEo.bugId() + " - " + tempEo.shortDesc());
      }
    }
    return temp;
  }
Ejemplo n.º 5
0
  public void invalidateObjects(NSArray pObjects) {
    // System.out.println("ReleasePlan.invalidateObjects()");

    // Invalidate Objects
    if (pObjects != null) {
      // System.out.println("ReleasePlan.invalidateObjects() - 2");

      Enumeration enumer = pObjects.objectEnumerator();
      NSMutableArray temp = new NSMutableArray();
      while (enumer.hasMoreElements()) {
        Item i = (Item) enumer.nextElement();
        i.invalidateAllChildren();
        EOGlobalID id = (EOGlobalID) (session().defaultEditingContext().globalIDForObject(i));
        if (id != null) {
          temp.addObject(id);
        }
      }
      session().defaultEditingContext().invalidateObjectsWithGlobalIDs((NSArray) temp);
    }
  }