@Override
  public NSArray getRequestHandlerPathForRequest(WORequest request) {
    NSMutableArray<Object> requestHandlerPath = new NSMutableArray<Object>();

    try {
      String path = request._uriDecomposed().requestHandlerPath();

      ERXRoute matchingRoute =
          setupRequestWithRouteForMethodAndPath(request, request.method(), path);
      if (matchingRoute != null) {
        @SuppressWarnings("unchecked")
        NSDictionary<ERXRoute.Key, String> keys =
            (NSDictionary<ERXRoute.Key, String>)
                request.userInfo().objectForKey(ERXRouteRequestHandler.KeysKey);
        String controller = keys.objectForKey(ERXRoute.ControllerKey);
        String actionName = keys.objectForKey(ERXRoute.ActionKey);
        requestHandlerPath.addObject(controller);
        requestHandlerPath.addObject(actionName);
      } else {
        requestHandlerPath.addObject(
            ERXProperties.stringForKeyWithDefault(
                "ERXRest.missingControllerName", "ERXMissingRouteController"));
        requestHandlerPath.addObject("missing");
        // throw new FileNotFoundException("There is no controller for the route '" + path + "'.");
      }

    } catch (Throwable t) {
      throw new RuntimeException("Failed to process the requested route.", t);
    }

    return requestHandlerPath;
  }
Example #2
0
  public NSArray salless(EOQualifier qualifier, NSArray sortOrderings, boolean fetch) {
    NSArray results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          new EOKeyValueQualifier(
              org.cocktail.superplan.server.metier.Salles.LOCAL_KEY,
              EOQualifier.QualifierOperatorEqual,
              this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        NSMutableArray qualifiers = new NSMutableArray();
        qualifiers.addObject(qualifier);
        qualifiers.addObject(inverseQualifier);
        fullQualifier = new EOAndQualifier(qualifiers);
      }

      results =
          org.cocktail.superplan.server.metier.Salles.fetchSalleses(
              editingContext(), fullQualifier, sortOrderings);
    } else {
      results = salless();
      if (qualifier != null) {
        results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }
Example #3
0
  public static void sendCommandInstancesToWotaskds(
      String command, NSArray instanceArray, NSArray wotaskdArray, WOTaskdHandler collector) {
    if (instanceArray.count() > 0 && wotaskdArray.count() > 0) {
      int instanceCount = instanceArray.count();

      NSMutableDictionary monitorRequest = new NSMutableDictionary(1);
      NSMutableArray commandWotaskd = new NSMutableArray(instanceArray.count() + 1);

      commandWotaskd.addObject(command);

      for (int i = 0; i < instanceCount; i++) {
        MInstance anInst = (MInstance) instanceArray.objectAtIndex(i);
        commandWotaskd.addObject(
            new NSDictionary(
                new Object[] {
                  anInst.applicationName(), anInst.id(), anInst.hostName(), anInst.port()
                },
                commandInstanceKeys));
      }
      monitorRequest.takeValueForKey(commandWotaskd, "commandWotaskd");

      WOResponse[] responses = collector.sendRequest(monitorRequest, wotaskdArray, false);
      NSDictionary[] responseDicts = collector.generateResponseDictionaries(responses);
      if (NSLog.debugLoggingAllowedForLevelAndGroups(
          NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment)) {
        NSLog.debug.appendln(
            "OUT: "
                + NSPropertyListSerialization.stringFromPropertyList(monitorRequest)
                + "\n\nIN: "
                + NSPropertyListSerialization.stringFromPropertyList(new NSArray(responseDicts)));
      }
      collector.getCommandErrors(responseDicts);
    }
  }
  public NSArray repartValidations(EOQualifier qualifier, NSArray sortOrderings, boolean fetch) {
    NSArray results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          new EOKeyValueQualifier(
              fr.univlr.cri.conges.eos.modele.conges.EORepartValidation.OCCUPATION_KEY,
              EOQualifier.QualifierOperatorEqual,
              this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        NSMutableArray qualifiers = new NSMutableArray();
        qualifiers.addObject(qualifier);
        qualifiers.addObject(inverseQualifier);
        fullQualifier = new EOAndQualifier(qualifiers);
      }

      results =
          fr.univlr.cri.conges.eos.modele.conges.EORepartValidation.fetchRepartValidations(
              editingContext(), fullQualifier, sortOrderings);
    } else {
      results = repartValidations();
      if (qualifier != null) {
        results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }
Example #5
0
  public NSArray tosIntervention(EOQualifier qualifier, NSArray sortOrderings, boolean fetch) {
    NSArray results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          new EOKeyValueQualifier(
              org.cocktail.dt.server.metier.EOIntervention.TO_ACTIVITES_KEY,
              EOQualifier.QualifierOperatorEqual,
              this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        NSMutableArray qualifiers = new NSMutableArray();
        qualifiers.addObject(qualifier);
        qualifiers.addObject(inverseQualifier);
        fullQualifier = new EOAndQualifier(qualifiers);
      }

      results =
          org.cocktail.dt.server.metier.EOIntervention.fetchAll(
              editingContext(), fullQualifier, sortOrderings);
    } else {
      results = tosIntervention();
      if (qualifier != null) {
        results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }
 // CLAUSE WHERE "UV.ANUNIV || UV.PRDUNIV = ... AND UV.UVC = ...
 // AND UV.ANUNIV || UV.PRDUNIV = EIA.ANUNIV || EIA.PRDUNIV" UV o� est
 // inscris l'�tudiant
 private static EOQualifier qualForUv(String uv, String periode) {
   // ARGSUV.addObject(uv);
   NSMutableArray quals = new NSMutableArray();
   EOEditingContext myContext = ERXEC.newEditingContext();
   EOQualifier qalUv =
       EOVueInsuv.UVC
           .eq(uv)
           .and(
               EOVueInsuv.EO_ETUDIANT_INSCR_ADM
                   .dot(EOEtudiantInscrAdm.ETU_ID)
                   .eq(EOVueInsuv.ETU_ID));
   quals.addObject(qalUv);
   if (periode != null) {
     EOQualifier qualPer =
         EOQualifier.qualifierWithQualifierFormat("anUniv=%@ AND prdUniv=%@", ARGSUV);
     quals.addObject(qualPer);
   }
   EOFetchSpecification spec = null;
   if (quals.count() == 2) {
     EOQualifier qual = new EOAndQualifier(quals);
     spec = new EOFetchSpecification("EOVueInsuv", qual, null);
   } else {
     spec = new EOFetchSpecification("EOVueInsuv", qalUv, null);
   }
   spec.setUsesDistinct(true);
   NSArray uvs = myContext.objectsWithFetchSpecification(spec);
   NSMutableArray etuids = new NSMutableArray();
   for (int i = 0; i < uvs.count(); i++) {
     EOVueInsuv luv = (EOVueInsuv) uvs.objectAtIndex(i);
     Long etu_id = luv.etuId();
     etuids.addObject(etu_id);
   }
   EOQualifier fin = ETU_INSCR_ADMS.dot(EOEtudiantInscrAdm.ETU_ID).in(etuids.immutableClone());
   return fin;
 }
  public NSArray scolMaquetteRepartitionAps(
      EOQualifier qualifier, NSArray sortOrderings, boolean fetch) {
    NSArray results;
    if (fetch) {
      EOQualifier fullQualifier;
      EOQualifier inverseQualifier =
          new EOKeyValueQualifier(
              org.cocktail.groupescol.client.eof.ScolMaquetteRepartitionAp.SCOL_MAQUETTE_AP_KEY,
              EOQualifier.QualifierOperatorEqual,
              this);

      if (qualifier == null) {
        fullQualifier = inverseQualifier;
      } else {
        NSMutableArray qualifiers = new NSMutableArray();
        qualifiers.addObject(qualifier);
        qualifiers.addObject(inverseQualifier);
        fullQualifier = new EOAndQualifier(qualifiers);
      }

      results =
          org.cocktail.groupescol.client.eof.ScolMaquetteRepartitionAp
              .fetchScolMaquetteRepartitionAps(editingContext(), fullQualifier, sortOrderings);
    } else {
      results = scolMaquetteRepartitionAps();
      if (qualifier != null) {
        results = (NSArray) EOQualifier.filteredArrayWithQualifier(results, qualifier);
      }
      if (sortOrderings != null) {
        results = (NSArray) EOSortOrdering.sortedArrayUsingKeyOrderArray(results, sortOrderings);
      }
    }
    return results;
  }
Example #8
0
  public Application() {
    super();

    PachySanity.adjustEnvironment();

    if (isFirstTime()) {

      PachySanity.showEnvironment();

    } else {

      if (ERXProperties.booleanForKeyWithDefault("pachy.CreateEnvironment", false)) {
        PachySanity.createEnvironment();
      }

      if (ERXProperties.booleanForKeyWithDefault("pachy.ShowEnvironment", true)) {
        PachySanity.showEnvironment();
      }

      PachySanity.testEnvironment();

      if (ERXProperties.booleanForKey("pachy.exitAfterInitialize")) {
        LOG.info("[APPLICATION] EXIT AFTER INITIALIZING [pachy.exitAfterInitialize == true]");
        System.exit(0);
        /* ############################################# MIGHT STOP HERE (pachy.exitAfterInitialize) #### */
      }
    }

    er.extensions.ERXExtensions.setAdaptorLogging(
        ERXProperties.booleanForKeyWithDefault("pachy.optionEnableAdaptorLog", false));

    /*------------------------------------------------------------------------------------------------*
     *  ... add the metadata database to the objectStores (why does EOModel not do this?)
     *------------------------------------------------------------------------------------------------*/
    try {
      CXObjectStoreCoordinator.getDefaultCoordinator()
          .addObjectStore(
              "org.pachyderm.assetdb", ERXProperties.stringForKey("dbConnectURLGLOBAL"));
      LOG.info("org.pachyderm.assetdb registered.");
    } catch (Exception x) {
      LOG.error("org.pachyderm.assetdb not registered.", x);
    }

    /*------------------------------------------------------------------------------------------------*
     *  add the English and French locales to the locale array ...
     *------------------------------------------------------------------------------------------------*/
    locales = new NSMutableArray<Locale>();
    locales.addObject(Locale.ENGLISH);
    locales.addObject(Locale.FRENCH);

    /*------------------------------------------------------------------------------------------------*
     *  loading this class, causes "UTRuntimeProvider" to scan for UTI definitions which can take
     *  a long time (~10 seconds on a good day).  Rather than have the first unfortunate user incur
     *  that penalty unpredictably, we get it over with now, before anyone logs in ...
     *------------------------------------------------------------------------------------------------*/
    UTType.loadThisClassNow();
  }
Example #9
0
  /* ******** Error Handling ********* */
  public NSMutableArray getUpdateErrors(
      NSDictionary[] responseDicts,
      String updateType,
      boolean hasHosts,
      boolean hasApplications,
      boolean hasInstances,
      boolean hasSite) {
    NSMutableArray errorArray = new NSMutableArray();

    boolean clearOverwrite = false;
    if ((updateType.equals("overwrite")) || (updateType.equals("clear"))) clearOverwrite = true;

    for (int i = 0; i < responseDicts.length; i++) {
      if (responseDicts[i] != null) {
        NSDictionary responseDict = responseDicts[i];
        getGlobalErrorFromResponse(responseDict, errorArray);

        NSDictionary updateWotaskdResponseDict =
            (NSDictionary) responseDict.valueForKey("updateWotaskdResponse");

        if (updateWotaskdResponseDict != null) {
          NSDictionary updateTypeResponse =
              (NSDictionary) updateWotaskdResponseDict.valueForKey(updateType);
          if (updateTypeResponse != null) {
            if (clearOverwrite) {
              String errorMessage = (String) updateTypeResponse.valueForKey("errorMessage");
              if (errorMessage != null) {
                errorArray.addObject(errorMessage);
              }
            } else {
              if (hasSite) {
                NSDictionary aDict = (NSDictionary) updateTypeResponse.valueForKey("site");
                String errorMessage = (String) aDict.valueForKey("errorMessage");
                if (errorMessage != null) {
                  errorArray.addObject(errorMessage);
                }
              }
              if (hasHosts)
                _addUpdateResponseToErrorArray(updateTypeResponse, "hostArray", errorArray);
              if (hasApplications)
                _addUpdateResponseToErrorArray(updateTypeResponse, "applicationArray", errorArray);
              if (hasInstances)
                _addUpdateResponseToErrorArray(updateTypeResponse, "instanceArray", errorArray);
            }
          }
        }
      }
    }
    if (NSLog.debugLoggingAllowedForLevelAndGroups(
        NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
      NSLog.debug.appendln("##### getUpdateErrors: " + errorArray);
    mySession().addObjectsFromArrayIfAbsentToErrorMessageArray(errorArray);
    return errorArray;
  }
Example #10
0
 protected static NSArray prepareJournalZPU(
     Enumeration substitutes, Enumeration variations, SchoolSection section) {
   NSMutableArray result = new NSMutableArray();
   NSMutableSet lessons = new NSMutableSet();
   if (variations != null) {
     while (variations.hasMoreElements()) {
       Variation var = (Variation) variations.nextElement();
       if (section != null && !section.equals(var.valueForKeyPath("course.cycle.section")))
         continue;
       EduLesson lesson = var.relatedLesson();
       if (lesson != null) {
         if (lessons.containsObject(lesson)) continue;
         lessons.addObject(lesson);
       }
       NSMutableDictionary dict = convertEvent(var);
       NSArray multiply = (NSArray) dict.valueForKey("multiply");
       if (multiply != null) {
         Enumeration mul = multiply.objectEnumerator();
         while (mul.hasMoreElements()) {
           Substitute sub = (Substitute) mul.nextElement();
           NSMutableDictionary clon = dict.mutableClone();
           clon.takeValueForKey(sub.teacher(), "plusTeacher");
           clon.takeValueForKey(sub.value(), "value");
           result.addObject(clon);
         }
       } else {
         result.addObject(dict);
       }
     }
   }
   if (substitutes != null) {
     while (substitutes.hasMoreElements()) {
       Substitute sub = (Substitute) substitutes.nextElement();
       EduLesson lesson = sub.lesson();
       if (lessons.containsObject(lesson)) continue;
       if (section != null && !section.equals(lesson.valueForKeyPath("course.cycle.section")))
         continue;
       //				lessons.addObject(sub.lesson());
       NSMutableDictionary dict = convertEvent(sub);
       result.addObject(dict);
     }
   }
   NSArray sorter =
       new NSArray(
           new EOSortOrdering[] {
             new EOSortOrdering("date", EOSortOrdering.CompareAscending),
             new EOSortOrdering("minusTeacher", EOSortOrdering.CompareAscending),
             new EOSortOrdering("grade", EOSortOrdering.CompareAscending),
             new EOSortOrdering("eduGroup", EOSortOrdering.CompareAscending),
             new EOSortOrdering("plusTeacher", EOSortOrdering.CompareAscending)
           });
   EOSortOrdering.sortArrayUsingKeyOrderArray(result, sorter);
   return result;
 }
Example #11
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();
  }
Example #12
0
 public NSArray primaryKeySupportStatementsForEntityGroups(NSArray entityGroups) {
   String primaryKeyTableName = ((JDBCAdaptor) this.adaptor()).plugIn().primaryKeyTableName();
   NSMutableArray primaryKeyExpressions = new NSMutableArray();
   primaryKeyExpressions.addObject(
       this._expressionForString(
           "CREATE TABLE " + primaryKeyTableName + " (NAME char(40), PK long)"));
   primaryKeyExpressions.addObject(
       this._expressionForString(
           "ALTER TABLE " + primaryKeyTableName + " ADD PRIMARY KEY (NAME)"));
   primaryKeyExpressions.addObject(
       this._expressionForString("CREATE UNIQUE INDEX " + primaryKeyTableName + " NAME"));
   return primaryKeyExpressions.immutableClone();
 }
    /**
     * Gets the sql string for the named attribute using the provided expression. The difference
     * between this and the standard {@link EOSQLExpression#sqlStringForAttributeNamed} is this one
     * can handle an "attribute" name that ends in a EORelationship rather than an actual
     * EOAttribute. This is necessary to support the {@link ERXExistsQualifier#baseKeyPath} syntax
     * (being the relationship path to the entity to which the subqualifier will be applied) chosen
     * for this qualifier.
     *
     * @param name of the attribute to get, e.g., department.division
     * @param expression to use when generating the SQL
     * @return the SQL string for the attribute
     */
    private String sqlStringForAttributeNamedInExpression(String name, EOSQLExpression expression) {
      NSArray pieces = NSArray.componentsSeparatedByString(name, ".");
      EOEntity entity = expression.entity();
      EORelationship rel;
      EOAttribute att;
      NSMutableArray path = new NSMutableArray();
      int numPieces = pieces.count();

      if (numPieces == 1 && null == entity.anyRelationshipNamed(name)) {
        att = entity.anyAttributeNamed(name);
        if (null == att) {
          return null;
        }
        return expression.sqlStringForAttribute(att);
      } else {
        for (int i = 0; i < numPieces - 1; i++) {
          rel = entity.anyRelationshipNamed((String) pieces.objectAtIndex(i));
          if (null == rel) {
            return null;
          }
          path.addObject(rel);
          entity = rel.destinationEntity();
        }

        String key = (String) pieces.lastObject();
        if (entity.anyRelationshipNamed(key) != null) { // Test first for a relationship.
          rel = entity.anyRelationshipNamed(key);
          if (rel.isFlattened()) {
            String relPath = rel.relationshipPath();
            NSArray relParts = NSArray.componentsSeparatedByString(relPath, ".");
            for (int i = 0; i < relParts.count(); i++) {
              rel = entity.anyRelationshipNamed((String) pieces.objectAtIndex(i));
              path.addObject(rel);
              entity = rel.destinationEntity();
            }
          } else {
            path.addObject(rel);
          }
          att = (EOAttribute) rel.destinationAttributes().lastObject();
        } else { // The test for an attribute.
          att = entity.anyAttributeNamed(key);
        }

        if (null == att) {
          return null;
        }
        path.addObject(att);
      }

      return expression.sqlStringForAttributePath(path);
    }
Example #14
0
  private void doCreateDummyData() {
    try {
      log.info("load");

      String wordFile = ERXFileUtilities.stringFromFile(new File("/usr/share/dict/words"));
      words = NSArray.componentsSeparatedByString(wordFile, "\n");
      log.info("loaded words: {}", words.count());

      int MAX = 100;
      int MAX_ASSETS = MAX * 10;

      for (int i = 0; i < MAX; i++) {
        Tag tag = Tag.clazz.createAndInsertObject(ec);
        tag.setName(randomWord());
        tags.addObject(tag);
      }
      log.info("created tags: {}", tags.count());

      for (int i = 0; i < MAX; i++) {
        AssetGroup group = AssetGroup.clazz.createAndInsertObject(ec);
        group.setName(randomWord());
        groups.addObject(group);
      }
      log.info("created groups: {}", groups.count());

      for (int i = 0; i < MAX_ASSETS; i++) {
        Asset asset = Asset.clazz.createAndInsertObject(ec);
        asset.setAssetGroup(randomAssetGroup());
        asset.setCreationDate(randomTime());
        asset.setUserCount((long) randomInt(10000));
        asset.setPrice(randomPrice());

        for (int j = 0; j < 10; j++) {
          asset.addToTags(randomTag());
        }

        asset.setContent(randomText(1000));

        asset.setGenericInfo(randomText(1000));

        assets.addObject(asset);
      }
      log.info("created assets: {}", assets.count());

      ec.saveChanges();
      log.info("fin: {}", words.count());
    } catch (IOException e) {
      throw NSForwardException._runtimeExceptionForThrowable(e);
    }
  }
Example #15
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;
  }
 /**
  * Adds a new route to this request handler.
  *
  * @param route the route to add
  */
 public void addRoute(ERXRoute route) {
   if (log.isDebugEnabled()) {
     log.debug("adding route " + route);
   }
   verifyRoute(route);
   _routes.addObject(route);
 }
Example #17
0
  protected NSMutableArray getQueryErrors(NSDictionary[] responseDicts) {
    NSMutableArray errorArray = new NSMutableArray();

    for (int i = 0; i < responseDicts.length; i++) {
      if (responseDicts[i] != null) {
        NSDictionary responseDict = responseDicts[i];
        getGlobalErrorFromResponse(responseDict, errorArray);

        NSArray commandWotaskdResponse =
            (NSArray) responseDict.valueForKey("commandWotaskdResponse");
        if ((commandWotaskdResponse != null) && (commandWotaskdResponse.count() > 0)) {
          int count = commandWotaskdResponse.count();
          for (int j = 1; j < count; j++) {
            NSDictionary aDict = (NSDictionary) commandWotaskdResponse.objectAtIndex(j);
            String errorMessage = (String) aDict.valueForKey("errorMessage");
            if (errorMessage != null) {
              errorArray.addObject(errorMessage);
              if (j == 0) break; // the command produced an error,
              // parsing didn't finish
            }
          }
        }
      }
    }
    if (NSLog.debugLoggingAllowedForLevelAndGroups(
        NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
      NSLog.debug.appendln("##### getQueryErrors: " + errorArray);
    mySession().addObjectsFromArrayIfAbsentToErrorMessageArray(errorArray);
    return errorArray;
  }
Example #18
0
 @Override
 protected void _applicationCreatedSession(WOSession wosession) {
   synchronized (this) {
     sessions.addObject(wosession);
     super._applicationCreatedSession(wosession);
   }
 }
Example #19
0
    public NSArray statementsToDropPrimaryKeyConstraintsOnEntityGroups(
        NSArray entityGroups,
        EOSchemaSynchronizationModelChanges changes,
        EOSchemaGenerationOptions options) {
      if (entityGroups == null) return NSArray.EmptyArray;
      if (changes == null) changes = newChanges();

      NSMutableArray expressions = new NSMutableArray();
      for (Enumeration enumerator = entityGroups.objectEnumerator();
          enumerator.hasMoreElements(); ) {
        NSArray entities = (NSArray) enumerator.nextElement();
        EOEntity _last =
            (EOEntity)
                entities.lastObject(); // only need entity to get the table name for the group
        String nameInObjectStore =
            _nameInObjectStoreForEntityGroupWithChangeDictionary(
                entities, changes.changesForTableNamed(_last.externalName()));
        if ((nameInObjectStore != null) && (!"".equals(nameInObjectStore))) {
          expressions.addObject(
              this._expressionForString(
                  "delete from _SYS_RELATIONSHIP where source_table = '"
                      + nameInObjectStore
                      + "' or dest_table = '"
                      + nameInObjectStore
                      + "'"));
        }
      }
      return expressions.immutableClone();
    }
Example #20
0
  public NSArray columnList() {
    String compIdStr =
        (String) currentComponent().customInfo().valueForKey("swsidebyside_partnumbers");
    String colWidthsStr =
        (String) currentComponent().customInfo().valueForKey("swsidebyside_columnwidths");
    NSArray compIds = NSArray.componentsSeparatedByString(compIdStr, " ");
    NSArray colWidths = NSArray.componentsSeparatedByString(colWidthsStr, " ");

    if (compIds != null
        && colWidths != null
        && compIds.count() > 0
        && colWidths.count() > 0
        && compIds.count() == colWidths.count()) {
      SideBySideComponentInfo theComponent;

      _columnList = new NSMutableArray();
      String ownerIdStr = currentComponent().primaryKey().toString();
      for (int i = 0; i < compIds.count(); i++) {
        compIdStr = (String) compIds.objectAtIndex(i);
        if (!compIdStr.equals(ownerIdStr)) {
          theComponent =
              new SideBySideComponentInfo(compIdStr, (String) colWidths.objectAtIndex(i));
          _columnList.addObject(theComponent);
        }
      }
    }

    return _columnList;
  }
Example #21
0
 public static void invalidateObjects(EOEditingContext ec, NSArray list) {
   NSMutableArray listGIDs = new NSMutableArray();
   for (int i = 0; i < list.count(); i++) {
     listGIDs.addObject(ec.globalIDForObject((EOEnterpriseObject) list.objectAtIndex(i)));
   }
   ec.invalidateObjectsWithGlobalIDs(listGIDs);
 }
Example #22
0
 /** retourne des faults d'objets à partir des globalIDs */
 public static NSArray faultsForGlobalIDs(EOEditingContext eContext, NSArray ids) {
   NSMutableArray objects = new NSMutableArray();
   for (int i = 0; i < ids.count(); i++) {
     objects.addObject(eContext.faultForGlobalID((EOGlobalID) ids.objectAtIndex(i), eContext));
   }
   return objects;
 }
Example #23
0
 /** retourne les globalIDs des objets */
 public static NSArray globalIDsForObjects(EOEditingContext eContext, NSArray objects) {
   NSMutableArray gids = new NSMutableArray();
   for (int i = 0; i < objects.count(); i++) {
     gids.addObject(eContext.globalIDForObject((EOEnterpriseObject) objects.objectAtIndex(i)));
   }
   return gids;
 }
Example #24
0
 /**
  * Generate tab descriptors from an dictionary of property values.
  *
  * @param dict the properties to use
  * @return An array of the new tab descriptors
  */
 public static NSArray<TabDescriptor> tabsFromDictionary(
     NSDictionary<String, NSDictionary<String, Object>> dict) {
   NSMutableArray<TabDescriptor> tabs = new NSMutableArray<TabDescriptor>();
   for (String label : dict.keySet()) {
     NSDictionary<String, Object> settings = dict.get(label);
     String pageName = (String) settings.objectForKey("pageName");
     int accessLevel =
         ERXValueUtilities.intValueWithDefault(settings.objectForKey("accessLevel"), 0);
     int priority = ERXValueUtilities.intValueWithDefault(settings.objectForKey("priority"), 0);
     boolean wantsStart =
         ERXValueUtilities.booleanValueWithDefault(settings.objectForKey("wantsStart"), false);
     @SuppressWarnings("unchecked")
     NSDictionary<String, NSDictionary<String, Object>> children =
         (NSDictionary<String, NSDictionary<String, Object>>) settings.objectForKey("children");
     String overridingLabel = (String) settings.objectForKey("label");
     if (overridingLabel != null) {
       label = overridingLabel;
     }
     @SuppressWarnings("unchecked")
     NSDictionary<String, Object> tabConfig =
         (NSDictionary<String, Object>) settings.objectForKey("config");
     tabs.addObject(
         new TabDescriptor(
             pageName,
             label,
             accessLevel,
             priority,
             wantsStart,
             (children == null) ? null : tabsFromDictionary(children),
             (String) settings.objectForKey("id"),
             tabConfig));
   }
   return tabs;
 }
 /**
  * Called when firing this assignment with the key-path: <b>tabSectionsContents</b>. Constructs an
  * array of {@link ERD2WContainer}s representing each tab and optionally another array of
  * containers representing each section. See {@link ERD2WTabInspectPage} for the exact format of
  * the tabs and sections.
  *
  * @return array of containers for each tab
  */
 public Object tabSectionsContents(D2WContext context) {
   NSMutableArray tabSectionsContents = new NSMutableArray();
   for (Enumeration e = ((NSArray) value()).objectEnumerator(); e.hasMoreElements(); ) {
     NSArray tab = (NSArray) e.nextElement();
     ERD2WContainer c = new ERD2WContainer();
     c.name = (String) tab.objectAtIndex(0);
     c.keys = new NSMutableArray();
     Object testObject = tab.objectAtIndex(1);
     if (testObject instanceof NSArray) { // format #2
       for (int i = 1; i < tab.count(); i++) {
         NSArray sectionArray = (NSArray) tab.objectAtIndex(i);
         ERD2WContainer section = new ERD2WContainer();
         section.name = (String) sectionArray.objectAtIndex(0);
         section.keys = new NSMutableArray(sectionArray);
         section.keys.removeObjectAtIndex(0);
         c.keys.addObject(section);
       }
     } else { // format #1
       ERD2WContainer fakeTab = new ERD2WContainer();
       fakeTab.name = "";
       fakeTab.keys = new NSMutableArray(tab);
       fakeTab.keys.removeObjectAtIndex(0);
       c.keys.addObject(fakeTab);
     }
     tabSectionsContents.addObject(c);
   }
   return tabSectionsContents;
 }
Example #26
0
  /**
   * <div class="ja"> ネットワークインアーフェースからIP一覧を得る
   *
   * @return 動作マシンのネットワーク設定が所有しているIPアドレス配列
   * @exception Exception </div>
   */
  private static NSArray<String> _machineIpList() throws Exception {
    // ワーク用
    NSMutableArray<String> workArray = new NSMutableArray<String>();

    // 全ネットワーク・インタフェース
    Enumeration<NetworkInterface> enNi = NetworkInterface.getNetworkInterfaces();
    while (enNi.hasMoreElements()) {
      NetworkInterface ni = enNi.nextElement();

      // 全 InetAddress
      Enumeration<InetAddress> enIp = ni.getInetAddresses();
      while (enIp.hasMoreElements()) {
        String ip = enIp.nextElement().getHostAddress();

        // IP アドレスとプロパティー内に保存されている優先順を合体する
        if ((ip.indexOf(":") < 0) && (!ip.equals(LOCAL_IP_ADDRESS))) {

          String ipPri =
              ERXProperties.stringFor2Keys(
                  "er.erxtensions.ERXTcpIp.IpPriority" + ip, "wodka.a10.A10TcpIp.IpPriority" + ip);
          if (ERXStringUtilities.stringIsNullOrEmpty(ipPri)) {
            ipPri = "9999";
          } else {
            ipPri = ERXStringUtilities.trimZeroInFrontOfNumbers(ipPri);

            while (ipPri.length() < 4) {
              ipPri = "0" + ipPri;
            }
          }

          workArray.addObject(ipPri + UNDER_BAR + ip);
        }
      }
    }

    // 優先順位順に並べ、IPのみ抜き出してArrayListにする
    workArray.sortUsingComparator(NSComparator.AscendingStringComparator);

    // 戻す配列の準備
    NSMutableArray<String> resultArray = new NSMutableArray<String>(workArray.count());

    for (String obj : workArray) {
      resultArray.addObject(obj.substring(5));
    }

    return resultArray.immutableClone();
  }
Example #27
0
 public NSArray modelPages() {
   Enumeration e = model.publicDynamicPages().elements();
   NSMutableArray arr = new NSMutableArray();
   while (e.hasMoreElements()) {
     arr.addObject(fixString(e.nextElement()));
   }
   return arr;
 }
 /** @return the lesCapacites */
 public NSArray lesCapacites() {
   if (lesCapacites == null) {
     NSMutableArray<EOCapacite> tmp = new NSMutableArray<EOCapacite>();
     NSMutableArray<EOCapacite> tmp2 = new NSMutableArray<EOCapacite>();
     NSArray<EODomaine> domaines = null;
     NSArray<EORepartDomCapacite> rdcs = null;
     domaines = EODomaine.fetchDomaines(ec, wocomponent().mySession().TODAY);
     if (!wocomponent().droitTout()) domaines = filtreDomaine(domaines).immutableClone();
     domaines =
         ERXArrayUtilities.arrayWithoutDuplicateKeyValue(
             domaines, EODomaine.REPART_DOM_CAPACITES_KEY);
     rdcs =
         (NSArray<EORepartDomCapacite>) domaines.valueForKey(EODomaine.REPART_DOM_CAPACITES_KEY);
     rdcs =
         ERXArrayUtilities.arrayWithoutDuplicateKeyValue(rdcs, EORepartDomCapacite.CAPACITE_KEY);
     if (rdcs != null && rdcs.count() > 0 && verifCap(rdcs)) {
       NSArray tt = (NSArray<EOCapacite>) rdcs.valueForKey(EORepartDomCapacite.CAPACITE_KEY);
       for (int t = 0; t < tt.count(); t++) {
         Object obj = (NSMutableArray) tt.objectAtIndex(t);
         // Correction bug plusieur objet dans un objet
         if (((NSMutableArray) obj).count() > 1) {
           for (Object ob : (NSMutableArray) obj) {
             EOCapacite cp = (EOCapacite) ob;
             if (cp != null) tmp2.addObject(cp);
           }
         } else {
           EOCapacite cp = (EOCapacite) ((NSMutableArray) obj).lastObject();
           if (cp != null) tmp2.addObject(cp);
         }
       }
       NSArray tmp3 = tmp2.immutableClone();
       tmp.addObjectsFromArray(tmp3);
     } else {
       tmp.addObjectsFromArray(EOCapacite.fetchCapacites(ec, wocomponent().mySession().TODAY));
     }
     EOCapacite capacite = selectedCapacite();
     if (capacite != null && !tmp.contains(capacite)) {
       tmp.addObject(capacite);
     }
     if (tmp != null && tmp.count() > 0) {
       ERXArrayUtilities.sortArrayWithKey(tmp, EOCapacite.LBL_COURT_KEY);
       lesCapacites = ERXArrayUtilities.arrayWithoutDuplicates(tmp);
     }
   }
   return lesCapacites;
 }
 public Object fire(D2WContext c) {
   NSMutableArray<Object> results = new NSMutableArray<Object>();
   NSArray<String> keyPaths = (NSArray<String>) value();
   for (String path : keyPaths) {
     results.addObject(c.valueForKeyPath(path));
   }
   return results;
 }
Example #30
0
 public void setNavigationLevel(int level, String state) {
   if (level > 0) {
     NSMutableArray navTemp = new NSMutableArray(navigationState());
     if (navTemp.count() >= level) navTemp.replaceObjectAtIndex(state, level - 1);
     else navTemp.addObject(state);
     setNavigationState(navTemp);
   }
 }