John,

It would not take that much effort (to make a converter). In fact -- I have
already written much of it (3 years ago during a summer vacation in
Connecticut).
(OK -- I looked at the code -- *** it is over 4 years ago)

I called my system (Rubedy) -- as I was taking arxml files and generating
Ruby On Rails code.

I created:
Migrations (table definitions)
Controllers (filters)

I ignored the UI side (including active links) -- as to me the whole thing
was about learning Ruby/Rails…


So - I could take any arxml file and re-generate the system in Ruby On
Rails -- it was a fun project.


johnsmac:Main jdsundberg$ ls -al
total 88
drwxr-xr-x  14 jdsundberg  jdsundberg   476 Jan 12 12:32 .
drwxr-xr-x  18 jdsundberg  jdsundberg   612 Jan  3  2011 ..
-rwxr--r--@  1 jdsundberg  jdsundberg   440 Jul 20  2007 HISTORY
-rw-r--r--@  1 jdsundberg  jdsundberg  1994 Jul 10  2007 README
-rw-r--r--@  1 jdsundberg  jdsundberg  4221 May 10  2008 TODO
-rwx------@  1 jdsundberg  jdsundberg  1296 Feb 27  2009 breakUpXML.rb
-rwx------@  1 jdsundberg  jdsundberg  1067 Jun 24  2007 buildFieldList.rb
-rwx------@  1 jdsundberg  jdsundberg   947 Jun 25  2007 getAllFieldNames.rb
drwxr-xr-x  19 jdsundberg  jdsundberg   646 Sep 25  2007 lib
-rwx------@  1 jdsundberg  jdsundberg  5284 Feb 16  2009 parseXML.rb
-rw-r--r--@  1 jdsundberg  jdsundberg   192 Jun  3  2007 rakefile.rb
-rw-r--r--   1 jdsundberg  jdsundberg  2130 Jan 12 12:32 rubedy_listing
drwxr-xr-x   3 jdsundberg  jdsundberg   102 Jul 17  2007 skel
drwxr-xr-x  12 jdsundberg  jdsundberg   408 Aug  2  2007 test



Here is the contents of the filter qualification code:
$:.unshift(File.dirname(__FILE__) + "/../")

require 'rexml/document'
require 'value_type'

module Remedy
  module Filters
    class QualificationTree
      # a QualificationTree - will either have a value/valueType
      # or an operation with a left operand an a right operand

      attr_reader :valueType, :value, :operation, :left, :right

      def initialize(qual)

          if (qual.nil?) then
            # FIXME -- I think this can be deleted
            # This appears to exist only when noQualification exists for a
filter
            # I try to init a qualificationTree from Filter when writing
out the
            # if statement of the filter
            return ""
          end

          if qual.elements[1].name == "and" then
            @operation = "and"
            @left = QualificationTree.new(qual.elements[1].elements[1])
            @right = QualificationTree.new(qual.elements[1].elements[2])
            return
          end

          if qual.elements[1].name == "or" then
            @operation = "or"
            @left = QualificationTree.new(qual.elements[1].elements[1])
            @right = QualificationTree.new(qual.elements[1].elements[2])
            return
          end

          if qual.elements[1].name == "relationalOperation" then
            @operation = qual.elements[1].elements[1].text
            @left = QualificationTree.new(qual.elements[1].elements[2])
            @right = QualificationTree.new(qual.elements[1].elements[3])
            return
          end

          if qual.elements[1].name == "arithmeticOperation" then
            @operation = qual.elements[1].elements[1].text
            @left = QualificationTree.new(qual.elements[1].elements[2])
            @right = QualificationTree.new(qual.elements[1].elements[3])
            return
          end

          if qual.elements[1].name == "transactionValueFieldID" then
            @valueType = "transactionValueFieldID"
            @value = qual.elements[1].text
            return
          end

          if qual.elements[1].name == "currentValueFieldID" then
            @valueType = "currentValueFieldID"
            @value = qual.elements[1].text
            return
          end

          if qual.elements[1].name == "databaseValueFieldID" then
            @valueType = "databaseValueFieldID"
            @value = qual.elements[1].text
            return
          end


          if qual.elements[1].name == "value" then
            @valueType = qual.elements[1].elements[1].name
            @value = qual.elements[1].elements[1].text
            return
          end


          puts "ERROR: QualificationTree#initialize not prepared to handle
'#{qual.elements[1].name}'"

      end

      # include the formname so we can translate the qualification to be
      # usable names vs numbers
      def to_model(formname)

        if (@valueType.nil? && @operation.nil?) then
          return "true"
        end

        # Handle the valueTypes
        if ([email protected]?) then
          return Remedy::ValueType.to_ruby(@valueType, @value, formname)
        end

        # Handle the operations
        if (@operation == "and") then
          return   ("(#{@left.to_model(formname)} &&
#{@right.to_model(formname)})")
        end

        if (@operation == "or") then
          return   ("(#{@left.to_model(formname)} or
#{@right.to_model(formname)})")
        end

        if (@operation == "equal") then
          return   ("(#{@left.to_model(formname)} ==
#{@right.to_model(formname)})")
        end

        if (@operation == "less") then
          return   ("(#{@left.to_model(formname)} !=
#{@right.to_model(formname)})")
        end

        if (@operation == "like") then
          return   ("(#{@left.to_model(formname)} like
#{@right.to_model(formname)})") # FIXME -- this is not legal ruby
        end

        if (@operation == "greater") then
          return   ("(#{@left.to_model(formname)} >
#{@right.to_model(formname)})")
        end

        if (@operation == "notEqual") then
          return   ("(#{@left.to_model(formname)} !=
#{@right.to_model(formname)})")
        end

        if (@operation == "greaterEqual") then
          return   ("(#{@left.to_model(formname)} >=
#{@right.to_model(formname)})")
        end

        if (@operation == "add") then
          return   ("(#{@left.to_model(formname)} +
#{@right.to_model(formname)})")
        end

        if (@operation == "multiply") then
          return   ("(#{@left.to_model(formname)} *
#{@right.to_model(formname)})")
        end

        # we should never get here - unless new valueTypes have been
discovered
        puts "ERROR: QualificationTree#to_model not prepared to handle
'#{@operation}'"

      end

    end

  end # Filters
end # Remedy



-John

On Thu, Jan 12, 2012 at 11:00 AM, John Baker <[email protected]
> wrote:

> Gavin: I was surprised you admitted to not being a very good developer
> given your experience with XPath, which I would argue isn't on page 1, 2, 3
> or 4 of the "How to script" guide.
>
> I return to my original argument: I don't think it's beyond the wit of the
> majority of people to fiddle with script, and if Developer Studio stored
> workflow in a file (per form), then it would take AR System to a new level.
> One can still point and click, but they could start to do far more
> interesting stuff too.
>
> Everything's a Java plugin these days, and invoking Java plugins for
> simple tasks results in a slower AR System. And let's not forget the "Run
> process" functionality, which has acted like a pseudo scripting input for
> as long as I can remember, ie if there's no workflow for it, we'll use a
> run process event. How long is the list of run process events these days?
>
> With the point and click interface being slowly overtaken by Java plugins,
> random run process events, C (eugh) plugins, etc., isn't it time everything
> was cleaned up in favour of a modern, standard, widely used scripting
> language to represent workflow? And I state very clearly, the point and
> click interface would be used to drive this workflow, removing no existing
> functionality.
>
> For those who fancy a trip back in time, I recall Mid Tier 5 and 6.0 had a
> workflow engine built into it. The workflow was sent to the browser in
> structures, and a Javascript workflow engine "ran" it. This was very, very
> slow. So in 6.3, a bright spark decided to replace it with the simple
> principal of writing out workflow as Javascript, and it got a lot faster.
> At that point, the schema tables could have begun retirement.
>
> I wonder how much money BMC has spent trying to re-invent the wheel with
> overlays, when a scripted solution would have been cheaper and brought many
> benefits - not least an end to the 30 minute start up times for ITSM 7.6.04.
>
> If BMC want to give JSS a pile of money, we'd be happy to write it for
> them :-)
>
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"
>



-- 
John David Sundberg
235 East 6th Street, Suite 400B
St. Paul, MN 55101
(651) 556-0930-work
(651) 247-6766-cell
(651) 695-8577-fax
[email protected]

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"

Reply via email to