Пример #1
0
  /**
   * @return list of FiscalYearMaker implementations with two fiscal year maker implementations for
   *     the same business object class
   */
  public static List<FiscalYearMaker> getFiscalYearMakerList_duplicateBusinessObjectClass() {
    List<FiscalYearMaker> fiscalYearMakers = new ArrayList<FiscalYearMaker>();

    fiscalYearMakers.add(OPTIONS.createFiscalYearMaker());
    fiscalYearMakers.add(OBJECT_CODE.createFiscalYearMaker());
    //        fiscalYearMakers.add(BENEFITS_CALCULATION.createFiscalYearMaker());
    fiscalYearMakers.add(ACCOUNTING_PERIOD.createFiscalYearMaker());
    fiscalYearMakers.add(OBJECT_CODE.createFiscalYearMaker());

    return fiscalYearMakers;
  }
 @Test
 public void getMatchingConditionWithEmptyConditions() throws Exception {
   RequestMethodsRequestCondition condition = new RequestMethodsRequestCondition();
   for (RequestMethod method : RequestMethod.values()) {
     if (!OPTIONS.equals(method)) {
       ServerWebExchange exchange = createExchange(method.name());
       assertNotNull(condition.getMatchingCondition(exchange));
     }
   }
   testNoMatch(condition, OPTIONS);
 }
  /**
   * Constructs a new {@code EnumParam}, initialized to the default value. Limit the set of options
   * with the supplied {@code EnumSet}.
   *
   * @param name of the {@code Param} (max 72 chars)
   * @param info {@code String} for use in tooltips; a {@code null} value will be set to an empty
   *     {@code String} (max 256 chars)
   * @param defaultValue of the {@code Param}
   * @param options a subset of the option type
   * @throws IllegalArgumentException if {@code name} is an empty string, {@code options} is empty,
   *     or the {@code defaultValue} is not included in {@code options}
   */
  DefaultEnumParam(String name, String info, E defaultValue, Set<E> options) {
    super(name, info, defaultValue);
    checkNotNull(options);
    checkArgument(!options.isEmpty(), "Options is empty");
    checkArgument(options.contains(defaultValue), "Default missing from options");
    this.options = Sets.immutableEnumSet(options);

    // init state
    state.addProperty(TYPE.toString(), ENUM.toString());
    JsonArray stateOptions = new JsonArray();
    for (E option : options) {
      stateOptions.add(new JsonPrimitive(option.name()));
    }
    state.add(OPTIONS.toString(), stateOptions);
  }
Пример #4
0
  /** @return list of FiscalYearMaker implementations with valid parent-child configuration */
  public static List<FiscalYearMaker> getFiscalYearMakerList_valid() {
    List<FiscalYearMaker> fiscalYearMakers = new ArrayList<FiscalYearMaker>();

    fiscalYearMakers.add(OPTIONS.createFiscalYearMaker());
    fiscalYearMakers.add(ORGANIZATION_REVERSION_DETAIL.createFiscalYearMaker());
    fiscalYearMakers.add(ORGANIZATION_REVERSION.createFiscalYearMaker());
    fiscalYearMakers.add(SUB_OBJECT_CODE.createFiscalYearMaker());
    fiscalYearMakers.add(OBJECT_CODE.createFiscalYearMaker());
    //        fiscalYearMakers.add(LABOR_OBJECT.createFiscalYearMaker());
    fiscalYearMakers.add(OFFSET_DEFINITION.createFiscalYearMaker());
    //        fiscalYearMakers.add(BENEFITS_CALCULATION.createFiscalYearMaker());
    //        fiscalYearMakers.add(POSITION_OBJECT_BENEFIT.createFiscalYearMaker());
    fiscalYearMakers.add(ACCOUNTING_PERIOD.createFiscalYearMaker());
    fiscalYearMakers.add(INDIRECT_COST_RECOVERY_RATE_DETAIL.createFiscalYearMaker());
    fiscalYearMakers.add(WIRE_CHARGE.createFiscalYearMaker());
    //
    // fiscalYearMakers.add(EFFORT_CERTIFICATION_REPORT_EARN_PAYGROUP.createFiscalYearMaker());
    //        fiscalYearMakers.add(EFFORT_CERTIFICATION_REPORT_POSITION.createFiscalYearMaker());
    //        fiscalYearMakers.add(EFFORT_CERTIFICATION_REPORT_DEFINITION.createFiscalYearMaker());
    //        fiscalYearMakers.add(SYSTEM_INFORMATION.createFiscalYearMaker());
    fiscalYearMakers.add(UNIVERSITY_DATE.createFiscalYearMaker());

    return fiscalYearMakers;
  }
  public void init() throws IOException, MojoFailureException, Exception {
    try {

      String options = "";
      state = State.INIT;
      long delay = 0;

      if (this.getBuildOption() != null) {
        String opt = this.getBuildOption();
        // To Support legacy
        opt = opt.replace("-", "");
        buildOption = BUILDOPTIONS.valueOf(opt);
      } else {
        buildOption = BUILDOPTIONS.valueOf("NULL");
      }

      // Options.delay=0;
      if (this.getDelay() != null) {
        delay = this.getDelay();
        Options.delay = delay;
      }
      if (this.getOverridedelay() != null) {
        delay = this.getOverridedelay();
        Options.override_delay = delay;
      }

      options = super.getOptions();
      if (options != null) {
        String[] opts = options.split(",");
        for (String opt : opts) {
          switch (OPTIONS.valueOf(opt)) {
            case validate:
              Options.validate = true;
              break;
            case force:
              Options.force = true;
              break;
            case inactive:
              Options.inactive = true;
              break;
            case clean:
              Options.clean = true;
              break;
            case update:
              Options.update = true;
              break;
            case override:
              Options.override = true;
              break;
            default:
              break;
          }
        }
      }

      logger.info("\n\n=============Initializing Maven Deployment================\n\n");

    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      // This "throws Exception" bothers me so much
      throw e;
    }
  }
Пример #6
0
  public void handle(HttpExchange http) throws IOException {
    /**
     * Request Verification - before the request is handled a set of checks are performed for CSRF
     * and XSS
     */

    /*
     * Completely disallow OPTIONS - if the browser suspects this is a cross site request just reject it.
     */
    final String requestMethod = http.getRequestMethod();
    if (OPTIONS.equals(requestMethod)) {
      drain(http);
      http.sendResponseHeaders(METHOD_NOT_ALLOWED, -1);

      return;
    }

    /*
     *  Origin check, if it is set the Origin header should match the Host otherwise reject the request.
     *
     *  This check is for cross site scripted GET and POST requests.
     */
    final Headers headers = http.getRequestHeaders();
    final URI request = http.getRequestURI();
    if (headers.containsKey(ORIGIN)) {
      String origin = headers.getFirst(ORIGIN);
      String host = headers.getFirst(HOST);
      String protocol = http.getHttpContext().getServer() instanceof HttpServer ? HTTP : HTTPS;
      String allowedOrigin = protocol + "://" + host;

      // This will reject multi-origin Origin headers due to the exact match.
      if (origin.equals(allowedOrigin) == false) {
        drain(http);
        http.sendResponseHeaders(FORBIDDEN, -1);

        return;
      }
    }

    /*
     *  Cross Site Request Forgery makes use of a specially constructed form to pass in what appears to be
     *  a valid operation request - except for upload requests any inbound requests where the Content-Type
     *  is not application/json or application/dmr-encoded will be rejected.
     */

    final boolean uploadRequest = UPLOAD_REQUEST.equals(request.getPath());
    if (POST.equals(requestMethod)) {
      if (uploadRequest) {
        // This type of request doesn't need the content type check.
        processUploadRequest(http);

        return;
      }

      String contentType = extractContentType(headers.getFirst(CONTENT_TYPE));
      if (!(APPLICATION_JSON.equals(contentType) || APPLICATION_DMR_ENCODED.equals(contentType))) {
        drain(http);
        http.sendResponseHeaders(FORBIDDEN, -1);

        return;
      }
    }

    processRequest(http);
  }