コード例 #1
0
  /**
   * Execute action's workflow.
   *
   * @throws org.areasy.runtime.engine.base.AREasyException if any global error occurs. All errors
   *     comming from action's execution will become output items
   */
  public void run() throws AREasyException {
    // execute the requested action for each user
    for (int i = 0; i < getUsers().size(); i++) {
      String username = (String) getUsers().get(i);

      try {
        People person = new People();
        person.setLoginId(username);
        person.read(getServerConnection());

        if (person.exists()) {
          // check people unrestricted access flag.
          if (person.getAttributeValue(1000003975) != null) {
            person.setNullAttribute(1000003975);
            person.setIgnoreNullValues(false);

            person.update(getServerConnection());
            RuntimeLogger.info("Unrestricted access flag was removed for user '" + username + "'");
          }
        } else RuntimeLogger.error("People account wasn't found: " + person);
      } catch (Throwable th) {
        RuntimeLogger.error(
            "Error removing unrestricted access for user '" + username + "': " + th.getMessage());
        getLogger().debug("Exception", th);
      }

      // check interruption and and exit if the execution was really interrupted
      if (isInterrupted()) {
        RuntimeLogger.warn("Execution interrupted by user");
        return;
      }
    }
  }
コード例 #2
0
ファイル: FormData.java プロジェクト: stefandmn/AREasy
  public void runMerge(CoreItem entry) throws AREasyException {
    if (getConfiguration().getBoolean("mergevaliddata", false) && !entry.exists()) {
      RuntimeLogger.debug("Skip merging because data was not validated: " + entry.toFullString());
      return;
    }

    // set data values
    setDataFields(entry);

    List qualList = getConfiguration().getList("mergematchingfieldids", null);

    RuntimeLogger.debug("Merging data entry: " + entry.toFullString());
    if (qualList != null)
      entry.merge(getServerConnection(), getMergeTypeAndOptions(getConfiguration()), qualList);
    else entry.merge(getServerConnection(), getMergeTypeAndOptions(getConfiguration()));
  }
コード例 #3
0
  public void perform(DevProcessAction develop) {
    // prepare data for export
    for (int i = 0; getObjectsList() != null && i < getObjectsList().size(); i++) {
      String objname = null;
      String objtype = null;

      try {
        // read developed object
        WorksheetObject devobj = (WorksheetObject) getObjectsList().get(i);

        objname = devobj.getObjectName();
        objtype = devobj.getSignature();

        // take the corresponding action
        OverlayAction action = new OverlayAction();
        action.init(develop);

        // get the base object instance and run the action
        String objSignature = getPluralObjectTypeNameBySignature(objtype);
        ObjectWrapper wrapper = action.getObjectWrapper(objSignature);

        if (wrapper instanceof FormRelatedWrapper) {
          ((FormRelatedWrapper) wrapper).setFormName(objname);
          objname = devobj.getRelatedData();
        }

        ObjectBase object = wrapper.getInstance(objname);

        action.execute(object);
      } catch (Throwable th) {
        RuntimeLogger.error(
            "Error running overlay action for a '" + objname + "' definition: " + th.getMessage());
        getLogger().debug("Exception", th);
      }
    }

    RuntimeLogger.info("Overlay action for the specified development package has been done");
  }
コード例 #4
0
ファイル: FormData.java プロジェクト: stefandmn/AREasy
  /**
   * Remove/delete data froma Remedy regular form.
   *
   * @param entry <code>CoreItem</code> structure, which should be instantiated.
   * @throws org.areasy.runtime.engine.base.AREasyException if any error will occur.
   */
  public void runRemove(CoreItem entry) throws AREasyException {
    if (entry.exists()) {
      if (getConfiguration().getBoolean("multipart", false) && entry instanceof MultiPartItem) {
        // set multipart form names
        setMultiPartForms(entry);

        setMultiPartQueryFields(entry);
        ((MultiPartItem) entry).readParts(getServerConnection());
        ((MultiPartItem) entry).removeParts(getServerConnection());
      }

      RuntimeLogger.debug("Removing data entry: " + entry.toFullString());
      entry.remove(getServerConnection());
    }
  }
コード例 #5
0
ファイル: FormData.java プロジェクト: stefandmn/AREasy
  /**
   * This is the recursive operation method aimed to search or read data from Remedy and then to
   * apply requested operation (transaction)
   *
   * @param searchEntry empty <code>CoreItem</code> structure used by read or search process
   * @throws AREasyException in case any error occurs
   */
  protected void operation(CoreItem searchEntry) throws AREasyException {
    if (getConfiguration().getBoolean("firstmatchreading", false)
        || getConfiguration().getBoolean("exactmatchreading", false)) {
      CoreItem entry = readData(searchEntry);
      run(entry);
    } else {
      List entries = searchData(searchEntry);

      if (entries == null || entries.size() == 0) {
        run(searchEntry);
      } else {
        int chunk = getConfiguration().getInt("chunk", 0);
        boolean nextChunk = chunk > 0 && entries.size() == chunk;

        for (Object entryObj : entries) {
          CoreItem entry = (CoreItem) entryObj;
          if (nextChunk) getConfiguration().setKey("nextchunkid", entry.getEntryId());

          try {
            run(entry);
          } catch (Throwable th) {
            setErrorsCounter();

            if (isForced()) {
              RuntimeLogger.error("Error updating data: " + th.getMessage());
            } else {
              if (th instanceof AREasyException) throw (AREasyException) th;
              else throw new AREasyException(th);
            }
          }

          // execution counter incrementation
          setRecordsCounter();
        }

        // run for next chunk
        if (nextChunk) operation(searchEntry);
      }
    }
  }
コード例 #6
0
ファイル: FormData.java プロジェクト: stefandmn/AREasy
  public void runUpdate(CoreItem entry) throws AREasyException {
    if (entry.exists()) {
      // set data values
      setDataFields(
          entry,
          getConfiguration().getBoolean("createifnotexist", false),
          getConfiguration().getBoolean("updateifexists", false));

      RuntimeLogger.debug("Updating data entry: " + entry.toFullString());
      entry.update(getServerConnection());

      if (getConfiguration().getBoolean("multipart", false) && entry instanceof MultiPartItem) {
        // set multipart form names
        setMultiPartForms(entry);

        // execute transactions
        ((MultiPartItem) entry)
            .commitParts(
                getServerConnection(), getMultiPartQueryFields(), getMultiPartDataFields());
      }
    } else if (getConfiguration().getBoolean("createifnotexist", false) && !entry.exists())
      runCreate(entry);
  }