Examples of IREntity


Examples of com.dtrules.entity.IREntity

        RName entityname = name.getEntityName();
       
       
        for(int i=entitystkptr-1;i>=0;i--){
           IREntity e = entitystk[i];
           if(!e.isReadOnly() && (entityname == null || e.getName().equals(entityname) )){
               REntityEntry entry = e.getEntry(name);
               if(entry!=null &&(!protect || entry.writable)){
                   if(testState(TRACE)){
                       out.printdata("def",
                               "entity",e.postFix(),
                               "name",name.stringValue(),
                               value.postFix());
                   }

                   e.put(null, name, value);
                   return true;
               }
           }
       }
       return false;
View Full Code Here

Examples of com.dtrules.entity.IREntity

    static class  Createentity   extends ROperator {
        Createentity(){super("createentity");}
       
        public void execute(DTState state) throws RulesException {
            RName    ename  = state.datapop().rNameValue();
            IREntity entity = ((RSession) state.getSession()).createEntity(null, ename);
            state.datapush(entity);
        }
View Full Code Here

Examples of com.dtrules.entity.IREntity

     */
    static class Entityforall extends ROperator {
        Entityforall(){super("entityforall");}

        public void execute(DTState state) throws RulesException {
            IREntity entity  = state.datapop().rEntityValue()// Get the entity
            IRObject body = state.datapop();                    // Get the body
            Iterator keys = entity.getAttributeIterator();      // Get the Attribute Iterator
            while(keys.hasNext()){                         // For each attribute
                RName     n = (RName) keys.next();
                IRObject  v = entity.get(n);
                if(v!=null){
                    state.datapush(n);
                    state.datapush(v);
                    body.execute(state);
                }   
View Full Code Here

Examples of com.dtrules.entity.IREntity

            RArray   array = state.datapop().rArrayValue();
            IRObject test  = state.datapop();
            IRObject body2 = state.datapop();
            IRObject body1 = state.datapop();
            for(IRObject obj : array) {
                IREntity e = obj.rEntityValue();
                state.entitypush(e);
                test.execute(state);
                if(state.datapop().booleanValue()){
                    body1.execute(state);
                    state.entitypop();
View Full Code Here

Examples of com.dtrules.entity.IREntity

                throw new RulesException("undefined", "PerformCatchError",
                        "The table '"+table.stringValue()+"' is undefined");
            }catch(RulesException e){
                IRSession     session       = state.getSession();
                EntityFactory ef            = session.getEntityFactory();  
                IREntity      errorEntity   = ef.findRefEntity(error).clone(session).rEntityValue();
                state.entitypush(errorEntity);
               
                // If any of the following puts fail (because the given entity doesn't define them), then
                // simply carry on your merry way.  The user can define these fields if they need them,
                // and they don't need to define them if they don't need them.
               
                try { errorEntity.put(null, n("errortype"),     p(e.getErrortype()));                         }catch(RulesException ex){}
                try { errorEntity.put(null, n("location"),      p(e.getLocation()));                          }catch(RulesException ex){}
                try { errorEntity.put(null, n("message"),       p(e.getMessage()));                           }catch(RulesException ex){}
                try { errorEntity.put(null, n("decisionTable"), p(e.getDecisionTable()));                     }catch(RulesException ex){}
                try { errorEntity.put(null, n("formal"),        p(e.getErrortype()));                         }catch(RulesException ex){}
                try { errorEntity.put(null, n("postfix"),       p(e.getPostfix()));                           }catch(RulesException ex){}
                try { errorEntity.put(null, n("filename"),      p(e.getFilename()));                          }catch(RulesException ex){}
                try { errorEntity.put(null, n("section"),       p(e.getSection()));                           }catch(RulesException ex){}
                try { errorEntity.put(null, n("number"),        RInteger.getRIntegerValue(e.getNumber()));    }catch(RulesException ex){}
               
            }
        }
View Full Code Here

Examples of com.dtrules.entity.IREntity

    static class InContext extends ROperator {
            InContext(){super("InContext");}

            public void execute(DTState state) throws RulesException {
                RName       entityName  = state.datapop().rNameValue();
                IREntity    entity      = state.findEntity(entityName);
                state.datapush(entity);
            }
View Full Code Here

Examples of com.dtrules.entity.IREntity

     * @return true if the attribute was successfully added.
   */
  public boolean createAttribute(final String rulesetname, final REntityEntry attribute) {
        try {
            RuleSet  rs     = getRuleset(rulesetname);
            IREntity entity = rs.getEntityFactory(session).findRefEntity(attribute.attribute);
            entity.addAttribute(attribute);
            return true;
        } catch (RulesException e) {
            return false;
        }
   
View Full Code Here

Examples of com.dtrules.entity.IREntity

     * @return              The list of Entity Entries that define the attributes of the Entity
     */
    public List<REntityEntry> getEntityEntries(String rulesetname, String entityname){
        ArrayList<REntityEntry> entries = new ArrayList<REntityEntry>();
        RuleSet                 rs      = getRuleset(rulesetname);
        IREntity entity;
        try {
            entity = rs.getEntityFactory(session).findRefEntity(RName.getRName(entityname));
            Iterator<RName>         attribs = entity.getAttributeIterator();
           
            while(attribs.hasNext()){
                entries.add(entity.getEntry(attribs.next()));
            }
        } catch (RulesException e) { }
       
        return entries;
    }
View Full Code Here

Examples of com.dtrules.entity.IREntity

     * @param rulesetname The name of the RuleSet in which to create this entity
     * @param EntityName  The name of the new Entity
   */
  public IREntity createEntity(String rulesetname, boolean readonly, String entityName) {
        RName    name = RName.getRName(entityName);
    IREntity e    = session.getEntityFactory().findRefEntity(name);
    if(e!=null)return null;
        try {
            return session.getEntityFactory().findcreateRefEntity(readonly, name);
        } catch (RulesException e1) {
            return null;
View Full Code Here

Examples of com.dtrules.entity.IREntity

    static class EntityName extends ROperator {
        EntityName() {
            super("entityname");
        }
        public void execute(DTState state) throws RulesException {
            IREntity entity = state.datapop().rEntityValue();
            state.datapush(entity.getName());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.