Package com.dtrules.infrastructure

Examples of com.dtrules.infrastructure.RulesException


   * A decision table is executed by simply executing the
   * binary tree underneath the table.
   */
  public void executeTable(DTState state) throws RulesException {
        if(compiled==false){
            throw new RulesException(
                "UncompiledDecisionTable",
                "RDecisionTable.execute",
                "Attempt to execute an uncompiled decision table: "+dtname.stringValue()
            );
        }
View Full Code Here


     * @param col The zero based column number for the new column
     * @throws RulesException
   */
    public void insert(int col) throws RulesException {
        if(maxcol>=16){
            throw new RulesException("TableTooBig","insert","Attempt to insert more than 16 columns in a Decision Table");
        }
        insert(conditiontable,maxcol,col);
        insert(actiontable,maxcol,col);
    }
View Full Code Here

              array.set(j, (REntity)array.get(j+1));
              array.set(j+1, temp);
                            done = false;
            }
                        }catch(RuntimeException e){
                            throw new RulesException("undefined","sort","Field is undefined: "+rName);
                        }
          }
                    if(done)return;
        }
      }
View Full Code Here

        Iterator<RName> ie = ef.referenceEntities.keySet().iterator();
        while(ie.hasNext()){
            IREntity e  = ef.findRefEntity(ie.next());
            String   id = e.getID()+"";
            if(entityInstances.containsKey(id)){
                throw new RulesException("duplicate","new RSession()","Duplicate id "+id+" found between:\n"
                        +e.getName()+" and "+entityInstances.get(id).getName());
            }
            entityInstances.put(id,e);
        }
        try {
            dtstate.entitypush(ROperator.getPrimitives());
            dtstate.entitypush(ef.decisiontables);
        } catch (RulesException e) {
            throw new RulesException("Initialization Error",
                    "RSession",
                    "Failed to initialize dtstate in init(): "+e.toString());
        }
    }
View Full Code Here

  public void initialize(String entrypoint) throws RulesException {
        // First make sure our context is up to snuff (by checking that all of our
        // required entities are in the current context.
        List<String> entities = rs.contexts.get(entrypoint);
        if (entities == null){
            throw new RulesException("undefined","executeAt","The entry point '"
                    +entrypoint+"' is undefined");
        }
        for(String entity : entities){
            if(!dtstate.inContext(entity)){
                dtstate.entitypush(createEntity(null, entity));
View Full Code Here

      if(id==null){
          id = getUniqueID()+"";
      }
    IREntity ref = ef.findRefEntity(name);
        if(ref==null){
            throw new RulesException("undefined","session.createEntity","An attempt ws made to create the entity "+name.stringValue()+"\n" +
                    "This entity isn't defined in the EDD");
        }
  
        if(ref.isReadOnly()) return ref;
       
View Full Code Here

        public void execute(DTState state) throws RulesException {
            RName name = state.datapop().rNameValue();
            IRObject value = state.find(name);
            if(value == null){
                throw new RulesException(
                        "undefined",
                        "Lookup",
                        "Could not find a value for "+name.stringValue()+" in the current context."
                );
            }
View Full Code Here

          Class clazz = Class.forName(state.datapop().stringValue());
          Object obj = clazz.newInstance();
          if(obj instanceof Calendar){
            state.calendar=(Calendar)obj;
          } else {
            throw new RulesException("Date Time Exception","Set Calendar","Not a Calendar Object");
          }         
        } catch(Exception e){
          throw new RulesException("Date Time Exception","/","Error while creating object: "+e);
        }
      }
View Full Code Here

  /* (non-Javadoc)
     * @see com.dtrules.entity.IREntity#put(com.dtrules.interpreter.RName, com.dtrules.interpreter.IRObject)
     */
  public void put( IRSession session, RName attrib, IRObject value) throws RulesException {
    REntityEntry entry = (REntityEntry)attributes.get(attrib);
    if(entry==null)throw new RulesException("Undefined", "REntity.put()", "Undefined Attribute "+attrib+" in Entity: "+name);
    if(value.type().getId() != iNull && entry.type.getId() != value.type().getId()){
           
      int entrytype = entry.type.getId();
            if(entrytype == iInteger)       value = value.rIntegerValue();
            else if (entrytype == iDouble)       value = value.rDoubleValue();  
View Full Code Here

            for(int i=length - 1;i>=0;i--){                  // For each element in array,
                 IRObject o = (IRObject) array.get(i);
                 int      t = o.type();
                 if(t== iNull)continue;
                 if(t!=iEntity){
                    throw new RulesException("Type Check", "Forallr", "Encountered a non-Entity entry in array: "+o);
                
                 state.entitypush((IREntity) o);
                 body.execute(state);
                 state.entitypop();
            }
View Full Code Here

TOP

Related Classes of com.dtrules.infrastructure.RulesException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.