Package it.eng.qbe.model.structure

Examples of it.eng.qbe.model.structure.IModelEntity


  }
 
 
  public String parseInLinecalculatedField(String expr, Query query, Map entityAliasesMaps){
    List allSelectFields;
    IModelEntity rootEntity;
    IModelField datamartField;
    String queryName;
    String rootEntityAlias;
    Map entityAliases = (Map)entityAliasesMaps.get(query.getId());
    List<String> aliasEntityMapping = new  ArrayList<String>();
    List<String> aliases = new  ArrayList<String>();
   
    StringTokenizer stk = new StringTokenizer(expr, "+-|*/()");
    while(stk.hasMoreTokens()){
      String alias = stk.nextToken().trim();
      // alias can contain "DISTINCT" HQL/SQL key: we have to remove it
      if (alias.toUpperCase().startsWith("DISTINCT ")) {
        alias = alias.substring("DISTINCT ".length());
      }
      String uniqueName;
      allSelectFields = query.getSelectFields(false);
      for(int i=0; i<allSelectFields.size(); i++){
        if(allSelectFields.get(i).getClass().equals(DataMartSelectField.class) && ((DataMartSelectField)allSelectFields.get(i)).getAlias().equals(alias)){
          uniqueName=((DataMartSelectField)allSelectFields.get(i)).getUniqueName();
          datamartField = getDataSource().getModelStructure().getField(uniqueName)
          queryName =  (String)datamartField.getQueryName().getFirst();
          rootEntity = datamartField.getParent().getRoot();
          rootEntityAlias = (String)entityAliases.get(rootEntity.getUniqueName());
          queryName = ((DataMartSelectField)allSelectFields.get(i)).getFunction().apply(rootEntityAlias+"."+queryName);
          aliasEntityMapping.add(queryName);
          aliases.add(alias);
          break;
        }
View Full Code Here


     */
    void addEntities(Set entities) {
      if (entities != null && entities.size() > 0) {
        Iterator it = entities.iterator();
        while (it.hasNext()) {
          IModelEntity relation = (IModelEntity) it.next();
          addEntity(relation);
        }
      }
    }
View Full Code Here

     */
    void addEntities(List relations) {
      if (relations != null && relations.size() > 0) {
        Iterator it = relations.iterator();
        while (it.hasNext()) {
          IModelEntity entity = (IModelEntity) it.next();
          addEntity(entity);
        }
      }
    }
View Full Code Here

      assertEquals(1, views.size());
      assertNotNull(views.get(0));
      assertTrue("Views conf cannot be an insatnce of [" + views.get(0).getClass().getName()  +"]", views.get(0) instanceof IModelViewEntityDescriptor);
     
      IModelStructure modelStructure = dataSource.getModelStructure();
      IModelEntity entity = modelStructure.getRootEntity(modelName, "it.eng.spagobi.meta.EmployeeClosure::EmployeeClosure");
      if(entity == null) dumpRootEntities(modelStructure);
      assertNotNull(entity);
      assertTrue(entity instanceof ModelViewEntity);
      List<IModelField> fields = entity.getAllFields();
      List<IModelField> keyFields = entity.getKeyFields();
      List<IModelField> normalFields = entity.getNormalFields();
      assertEquals(fields.size(), keyFields.size() + normalFields.size());
    } catch(Throwable t) {
      t.printStackTrace();
      fail();
    }
View Full Code Here

    this.setBlackList( blackList );
  }
 
  public List filter(IDataSource dataSource, List entities) {
    List list = null;
    IModelEntity entity;

    list = new ArrayList();
    for(int i = 0; i < entities.size(); i++) {
      entity = (IModelEntity)entities.get(i);
      if(!getBlackList().contains(entity)) {
View Full Code Here

 
  public List filter(IDataSource dataSource, List fields) {
   
    Collections.sort(fields, new Comparator() {
        public int compare(Object o1, Object o2) {
          IModelEntity f1, f2;
          String p1, p2;
          int i1, i2;
         
          f1 = (IModelEntity)o1;
          f2 = (IModelEntity)o2;
          /*
          p1 = properties.getProperty(f1, "position");
          p2 = properties.getProperty(f2, "position");
         
          try {
            i1 = Integer.parseInt(p1);
          } catch(Throwable t) {
            i1 = Integer.MAX_VALUE;
          }
         
          try {
            i2 = Integer.parseInt(p2);
          } catch(Throwable t) {
            i2 = Integer.MAX_VALUE;
          }
          */
          //Assert.assertTrue(i1 == f1.getPropertyAsInt("position"), "Position attribute of entity [" + f1.getName() + "]");
          //Assert.assertTrue(i2 == f2.getPropertyAsInt("position"), "Position attribute of entity [" + f2.getName() + "]");
         
          i1 = f1.getPropertyAsInt("position");
          i2 = f2.getPropertyAsInt("position");
           
          return (i1 < i2 ? -1 :
                    (i1 == i2 ? 0 : 1));
        }
View Full Code Here

    this.setWhiteList( whiteList );
  }
 
  public List filter(IDataSource dataSource, List entities) {
    List list = null;
    IModelEntity entity;

    list = new ArrayList();
    for(int i = 0; i < entities.size(); i++) {
      entity = (IModelEntity)entities.get(i);
      if(entity.getParent() == null) {
        if(getWhiteList().contains(entity)) {
          list.add(entity);
        }
      } else {
        list.add(entity);
View Full Code Here

    super(parentFilter);
  }
 
  public List filter(IDataSource dataSource, List entities) {
    List list = null;
    IModelEntity entity;
   
    list = new ArrayList();
   
    for(int i = 0; i < entities.size(); i++) {
      entity = (IModelEntity)entities.get(i);
View Full Code Here

        IModelViewEntityDescriptor viewDescriptor = list.get(i);
        List<IModelViewRelationshipDescriptor> viewRelationshipsDescriptors = viewDescriptor.getRelationshipDescriptors();
        for (IModelViewRelationshipDescriptor  viewRelationshipDescriptor : viewRelationshipsDescriptors){
          if (!viewRelationshipDescriptor.isOutbound()){
            String sourceEntityUniqueName = viewRelationshipDescriptor.getSourceEntityUniqueName();
            IModelEntity entity = modelStructure.getEntity(sourceEntityUniqueName)
            logger.debug("Source Entity Unique name: "+entity.getUniqueName());
           
            //Add node for first level entities (using UniqueName)
            ModelViewEntity viewEntity = new ModelViewEntity(viewDescriptor, modelName, modelStructure, entity);
            propertiesInitializer.addProperties(viewEntity);
            entity.addSubEntity(viewEntity);
           
            //Add node for subentities (using Entity Type matching)
            for(IModelEntity modelEntity : allEntities){
              logger.debug("Searched Entity type: "+entity.getType());
              logger.debug("Current Entity type: "+modelEntity.getType());
              if (modelEntity.getType().equals(entity.getType())){
                ModelViewEntity viewEntitySub = new ModelViewEntity(viewDescriptor, modelName, modelStructure, modelEntity);
                propertiesInitializer.addProperties(viewEntitySub);
                logger.debug(" ** Found matching for: "+modelEntity.getType()+" with "+entity.getType());
                modelEntity.addSubEntity(viewEntitySub);
                addedViewsEntities.add(viewEntitySub);
              }
            } 
          }
View Full Code Here

 
 
  private void addEntity (IModelStructure modelStructure, String modelName, String entityType){

    String entityName = getEntityNameFromEntityType(entityType);   
    IModelEntity dataMartEntity = modelStructure.addRootEntity(modelName, entityName, null, null, entityType);
    propertiesInitializer.addProperties(dataMartEntity);
   
    //addKeyFields(dataMartEntity);   
    List subEntities = addNormalFields(dataMartEntity);
    addCalculatedFields(dataMartEntity);
View Full Code Here

TOP

Related Classes of it.eng.qbe.model.structure.IModelEntity

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.