Пример #1
0
  /**
   * Consume an Install event. If the item is being installed and it is not embargoed then we want
   * to set the item's policies. See {@link DuoPolicyManager} for details
   *
   * @param context
   * @param event
   * @throws Exception
   */
  public void consume(Context context, Event event) throws Exception {
    Item item = (Item) event.getSubject(context);

    // check to see if the item has a StudentWeb grade of "fail"
    if (this.isFail(context, item)) {
      // if so, withdraw the item
      item.withdraw();
      return;
    }

    // we mustn't set the policies if the item is embargoed; these will have already
    // been removed, and should stay that way
    if (this.isEmbargoed(context, item)) {
      return;
    }

    DuoPolicyManager dpm = new DuoPolicyManager();
    dpm.setDefaultPolicies(context, item);
  }