Package com.dtrules.entity

Examples of com.dtrules.entity.REntity


    public void endTag(String[] tagstk, int tagstkptr, String tag, String body,
            HashMap attribs) throws Exception, IOException
    {
      String  attr;
    REntity entity = null;
   
    if(attribs.containsKey("create entity")){                // For create Entity Tags, we pop the Entity from the Entity Stack on the End Tag.
      entity = (REntity) state.entitypop();
      Iterator pairs  = map.attribute2listPairs.iterator();
      body = "";                                                      // Don't care about the Body if we created an Entity.
      while(pairs.hasNext()){
        Object [] pair =  (Object []) pairs.next();
          if(entity.containsAttribute(RName.getRName((String)pair[0]))){
            RName.getRName((String) pair[1],true).execute(state);
            state.entitypush(entity);
            RName.getRName("addto",true).execute(state);
           
          }
View Full Code Here


              errorMsgs += "Bad Default Value '"+defaultv+"' encountered on entity: '"+entityname+"' attribute: '"+attribute+"' \n";
              succeeded = false;
          }
      RName  entityRName = RName.getRName(entityname.trim(),false);
      RName  attributeRName = RName.getRName(attribute.trim(),false);
      REntity entity = ef.findcreateRefEntity(false,entityRName);
          int    intType = -1;
          try {
      intType = RSession.typeStr2Int(type,entityname,attribute);
      } catch (RulesException e) {
      errorMsgs += "Bad Type: '"+type+"' encountered on entity: '"+entityname+"' attribute: '"+attribute+"' \n";
      succeeded = false;
      }
     
      String errstr  = entity.addAttribute(attributeRName,
                                           defaultv,
                                           defaultO,
                                           writeable,
                                           readable,
                                           intType,
View Full Code Here

               
        IRObject defaultO = EntityFactory.computeDefaultValue(session, ef, default_value, itype) ;
       
        RName  entityRName = RName.getRName(entityname.trim(),false);
        RName  attributeRName = RName.getRName(attrib_name.trim(),false);
        REntity entity = ef.findcreateRefEntity(false,entityRName);
        int    intType = -1;

        try {
          intType = RSession.typeStr2Int(type,entityname,attrib_name);
        } catch (RulesException e) {
          errorMsgs += "Bad Type: '"+type+"' encountered on entity: '"+entityname+"' attribute: '"+attrib_name+"' \n";
          succeeded = false;
        }
        String errstr  = entity.addAttribute(attributeRName,
                                             default_value,
                                             defaultO,
                                             writeable,
                                             readable,
                                             intType,
View Full Code Here

     */
  public IREntity createEntity(Object id, RName name) throws RulesException{
      if(id==null){
          id = getUniqueID()+"";
      }
    REntity 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()){
            REntity e = (REntity) ref.clone(this);
            entityInstances.put(id,e);
            return e;
        }
    return ref;
  }
View Full Code Here

    public void endTag(String[] tagstk, int tagstkptr, String tag, Object body,
            HashMap attribs) throws Exception, IOException
    {
      String  attr;
    REntity entity = null;
   
    if(attribs.containsKey("create entity")){                // For create Entity Tags, we pop the Entity from the Entity Stack on the End Tag.
          attribs.remove("create entity");
        entity = (REntity) state.entitypop();
      Iterator pairs  = map.attribute2listPairs.iterator();
      body = "";                                                      // Don't care about the Body if creating an Entity, but it can't be null either.
      while(pairs.hasNext()){
        Object [] pair =  (Object []) pairs.next();
          if(entity.containsAttribute(RName.getRName((String)pair[0]))){
            RName.getRName((String) pair[1],true).execute(state);
            state.entitypush(entity);
            RName.getRName("addto",true).execute(state);
           
          }
View Full Code Here

    public void endTag(String[] tagstk, int tagstkptr, String tag, String body,
            HashMap attribs) throws Exception, IOException
    {
      String  attr;
    REntity entity = null;
   
    if(attribs.containsKey("create entity")){                // For create Entity Tags, we pop the Entity from the Entity Stack on the End Tag.
      entity = (REntity) state.entitypop();
      Iterator pairs  = map.attribute2listPairs.iterator();
      body = "";                                                      // Don't care about the Body if we created an Entity.
      while(pairs.hasNext()){
        Object [] pair =  (Object []) pairs.next();
          if(entity.containsAttribute(RName.getRName((String)pair[0]))){
            RName.getRName((String) pair[1],true).execute(state);
            state.entitypush(entity);
            RName.getRName("addto",true).execute(state);
           
          }
View Full Code Here

   *
   * @param name
   */
  public REntity findcreateRefEntity(boolean readonly, RName name)throws RulesException {
    if(!referenceEntities.containsKey(name)){
      IREntity entity = new REntity(getUniqueID(), readonly, name);
      referenceEntities.put(name,entity);
    }
    return (REntity) referenceEntities.get(name);
  }
View Full Code Here

                         "length",   array.size()+"",
                         "by",       rname.stringValue(),
                         "arrayID",  rarray.getID()+"",
                         asc ? "true" : "false");
              }
        REntity temp = null;
        int size = array.size();
                int greaterthan = asc ? 1 : -1;
        for(int i=0; i<size; i++){
                    boolean done = true;
          for(int j=0; j<size-1-i; j++){
View Full Code Here

              entityInstances.put(id,e);
            }
            return e;
      }else{
        REntity e = (REntity) ref.clone(this);
        return e;
      }
  
  }
View Full Code Here

       
        types = new HashMap<RName, RType>();
        Iterator<RName> entities = ef.getEntityRNameIterator();
        while(entities.hasNext()){
            RName    name    = entities.next();
            REntity  entity  = ef.findRefEntity(name);
            Iterator<RName> attribs = entity.getAttributeIterator();
            addType(entity,entity.getName(),IRObject.iEntity);
            while(attribs.hasNext()){
                RName        attribname = attribs.next();
                REntityEntry entry      = entity.getEntry(attribname);
                addType(entity,attribname,entry.type);
            }
        }
       
        Iterator<RName> tables = ef.getDecisionTableRNameIterator();
View Full Code Here

TOP

Related Classes of com.dtrules.entity.REntity

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.