Package com.dtrules.infrastructure

Examples of com.dtrules.infrastructure.RulesException


     * @return
     */
    public static RTime getRDate(IRSession session, String s) throws RulesException {
        Date d = session.getDateParser().getDate(s);
        if(d==null){
            throw new RulesException("Bad Date Format","getRDate","Could not parse: '"+s+"' as a Date or Time value");
        }
        return new RTime(d);
    }
View Full Code Here


        return time.toString();
    }

    public int getYear(DTState state) throws RulesException{
        if(time==null){
            throw new RulesException("Undefined", "getYear()", "No valid date available");
        }
        state.calendar.setTime(time);
        return state.calendar.get(Calendar.YEAR);
    }
View Full Code Here

    }
   
    public void mapDO(DataMap datamap, Object idataObj)throws RulesException {
        if(loaded==false){
            String err = init(datamap);
            if(err!=null)throw new RulesException("Undefined","DataObjectMap",err);
        }
        Class params[]     = {};
        Object paramsObj[] = {};
       
        try {
            boolean needToClose = OpenEntityTag(datamap, idataObj);
            for(String getter : tagMap.keySet()){
                String tag = tagMap.get(getter);
                Method getV = dataObj.getMethod(getter, params);
                Object v    = getV.invoke(idataObj, paramsObj);
                datamap.printdata(tag, v);
            }
            if(needToClose){
                datamap.closetag();
            }
        } catch (SecurityException e) {
           throw new RulesException("invalidAccess","DataObjectMap",e.toString());
        } catch (IllegalArgumentException e) {
            throw new RulesException("invalidAccess","DataObjectMap",e.toString());
        } catch (NoSuchMethodException e) {
            throw new RulesException("undefined","DataObjectMap",e.toString());
        } catch (IllegalAccessException e) {
            throw new RulesException("invalidAccess","DataObjectMap",e.toString());
        } catch (InvocationTargetException e) {
            throw new RulesException("unknown","DataObjectMap",e.toString());
        }
    }
View Full Code Here

                 v.equalsIgnoreCase("n")     ||
                 v.equalsIgnoreCase("f")     ||
                 v.equalsIgnoreCase("no")){
            return false;
        }
        throw new RulesException("typecheck","String Conversion to Boolean","No boolean value for this string: "+value);
    }
View Full Code Here

      if(e==null) {
              e = ((RSession)session).createEntity(null,entity);
          }
      if(code!=null) entities.put(key,e);
     }
       if(e==null)throw new RulesException("undefined","LoadXMLData.findEntity()","Failed to create the entity "+entity);
       UpdateReferences(e,info);
       return e;
 
View Full Code Here

                            value = RBoolean.getRBoolean(body.length()==0? "false" : body);
                        } else if (type == IRObject.iTime){
                            if(body.trim().length()>0){
                              value = RTime.getRDate(session,body);
                              if(value == null){
                                throw new RulesException("MappingError","LoadXMLData","Bad Date... Could not parse '"+body+"'");
                              }
                            }else{
                              value = RNull.getRNull();
                            }
                        } else if (type == IRObject.iEntity){
                            if(entity!=null){
                               value = entity;
                            }else{
                                throw new RulesException("MappingError","LoadXMLData","Entity Tags have to create some Entity Reference");
                            }   
                        }else {
                value = RString.newRString(body);
              }
              //   conversion in the Rules Engine to do the proper thing.
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

     * @return filename
     * @throws RulesException
     */
  public String getDT_XMLName() throws RulesException{
         if(dt_names.size()!=1){
             throw new RulesException("UnsupportedConfiguration","RuleSet","We can only have one DecisionTable XML file");
         }
         return dt_names.get(0);
    }
View Full Code Here

     * @return filename
     * @throws RulesException
     */
    public String getEDD_XMLName() throws RulesException{
        if(edd_names.size()!=1){
            throw new RulesException("UnsupportedConfiguration","RuleSet","We can only have one EDD XML file");
        }
        return edd_names.get(0);
   }
View Full Code Here

     */
    public void setValues(RArray values) throws RulesException{
        for(IRObject irpair : values){
            RArray pair = irpair.rArrayValue();
            if(pair.size()!=2){
                throw new RulesException(
                        "Invalid_Table_Value",
                        "RTable.setValues",
                        "setValues expected an array of arrays giving pairs of values to assert into the Table");
            }
            IRObject key   = pair.get(0);
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.