Package it.eng.qbe.model.structure

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


        if(a.getPersistentAttributeType().equals(PersistentAttributeType.MANY_TO_ONE)){
          Class c = a.getJavaType();
          String entityType = c.getName();
          String columnName = a.getName();
          String entityName =  a.getName(); //getEntityNameFromEntityType(entityType);
           IModelEntity subentity = new ModelEntity(entityName, null, columnName, entityType, dataMartEntity.getStructure());   
           subEntities.add(subentity);   
      }else//composite key
        if(a.getPersistentAttributeType().equals(PersistentAttributeType.EMBEDDED)){
        Set<Attribute> keyAttre = ((EmbeddableType)((SingularAttribute)a).getType()).getAttributes();
        Iterator<Attribute> keyIter = keyAttre.iterator();
View Full Code Here


  // TODO: controllare correttezza per jpa...se va bene generalizzare metodo sia per jpa che hibernate!
  private void addSubEntities(IModelEntity dataMartEntity, List subEntities, int recursionLevel) {
   
    Iterator it = subEntities.iterator();
    while (it.hasNext()) {
      IModelEntity subentity = (IModelEntity)it.next();
      if (subentity.getType().equalsIgnoreCase(dataMartEntity.getType())){
        // ciclo di periodo 0!
      } else if(recursionLevel > 10) {
        // prune recursion tree
      } else {
        addSubEntity(dataMartEntity, subentity, recursionLevel+1);
View Full Code Here

  }

  // TODO: controllare correttezza per jpa...se va bene generalizzare metodo sia per jpa che hibernate! 
  private void addSubEntity (IModelEntity parentEntity, IModelEntity subEntity, int recursionLevel){
    logger.debug("Adding the sub entity field "+subEntity.getName()+" child of "+parentEntity.getName());
    IModelEntity dataMartEntity;       
   
    //String entityName = getEntityNameFromEntityType(entityType);   
    dataMartEntity = parentEntity.addSubEntity(subEntity.getName(), subEntity.getRole(), subEntity.getType());
    propertiesInitializer.addProperties(dataMartEntity);
   
View Full Code Here

   * @param entityAliases
   * @param query the query
   */
  private void addRelationForTheView(IModelEntity parent, ModelViewEntity view, IModelEntity child, Set<ViewRalationClause> viewRelations, Map entityAliases, Query query){
    List<ViewRelationship> relations = view.getRelationships();
    IModelEntity inEntity,outEntity;
    ViewRelationship relation;
    for(int i=0; i<relations.size(); i++){
      relation = relations.get(i);
      outEntity = relation.getSourceEntity();
      inEntity = relation.getDestinationEntity();
      if( (view.getInnerEntities().contains(inEntity) && parent!=null && outEntity.getType().equals(parent.getType())) || //income relation
        (view.getInnerEntities().contains(outEntity) && child!=null && inEntity.getType().equals(child.getType()))){    //outcome relation
        //build the relation constraints
        viewRelations.addAll(buildRelationConditionString(relation.getSourceFileds(), relation.getDestinationFileds(), entityAliases, query));
      }
    }
  }
View Full Code Here

   * @return
   */
  private String getFieldString(IModelField datamartField, Map entityAliasesMaps, Query query){
    String queryName;
   
    IModelEntity rootEntity;
   
    Couple queryNameAndRoot = datamartField.getQueryName();
   
    queryName = (String) queryNameAndRoot.getFirst();
   
    if(queryNameAndRoot.getSecond()!=null){
      rootEntity = (IModelEntity)queryNameAndRoot.getSecond();  
    }else{
      rootEntity = datamartField.getParent().getRoot();  
    }
   
   
//    if(datamartField.getPathParent() instanceof ModelViewEntity){
//      rootEntity = (datamartField.getParent()).getRoot();
//    }else{
//      rootEntity = datamartField.getParent().getRoot();
//    }
 
    Map entityAliases = (Map)entityAliasesMaps.get(query.getId());
    String rootEntityAlias = (String)entityAliases.get(rootEntity.getUniqueName());
       
    if(rootEntityAlias == null) {
      rootEntityAlias = statement.getNextAlias(entityAliasesMaps);
      entityAliases.put(rootEntity.getUniqueName(), rootEntityAlias);
    }
       
    return rootEntityAlias + "." + queryName.substring(0,1).toLowerCase()+queryName.substring(1);
  }
View Full Code Here

 
  // TODO create method getRootItem in IDataMartItem interface and move some code there
  protected String getInheritedProperty(IModelEntity item, String propertyName) {
    Assert.assertUnreachable("Property [" + propertyName + "] of entity [" + item.getName()+ "] cannot be inehritated");
    String propertyValue;
    IModelEntity rootEntity = item.getStructure().getRootEntity(item);
    Assert.assertNotNull(rootEntity, "Impossible to find root entity of entity [" + item.getName() + "]");
    propertyValue = modelProperties.getProperty(rootEntity, propertyName);
   
    return propertyValue;
  }
View Full Code Here

 
  // TODO create method getRootItem in IDataMartItem interface and move some code there
  protected String getInheritedProperty(IModelField item, String propertyName) {
    String propertyValue;
    IModelField rootField = null;
    IModelEntity rootEntity = item.getStructure().getRootEntity(item.getParent());
    if(rootEntity == null) {
      rootEntity = item.getStructure().getRootEntity(item.getParent());
      Assert.assertUnreachable("rootEntity for field [" + item.getName() + "] cannot be null");
    }
   
    List fields = null;
    if(item instanceof ModelCalculatedField) {
      fields = rootEntity.getCalculatedFields();
    } else {
      fields = rootEntity.getAllFields();
    }
    Iterator<IModelField> it = fields.iterator();
    while (it.hasNext()) {
      IModelField field = it.next();
      if (field.getName().equals(item.getName())) {
View Full Code Here

  }

  public void doTestLabelLocalization() {
    IModelProperties properties;
    String label;
    IModelEntity entity = dataSource.getModelStructure().getEntity(testEntityUniqueName);
   
    properties = dataSource.getModelI18NProperties(Locale.ITALIAN);
    label = properties.getProperty(entity, "label");
    assertTrue("[" + label + "] is not equal to [" + "Customer Italiano" + "]", "Customer Italiano".equals(label));
   
View Full Code Here

  }
 
  public void doTestTooltipLocalization() {
    IModelProperties properties;
    String tooltip;
    IModelEntity entity = dataSource.getModelStructure().getEntity(testEntityUniqueName);
   
    properties = dataSource.getModelI18NProperties(Locale.ITALIAN);
    tooltip = properties.getProperty(entity, "tooltip");
    assertTrue("[" + tooltip + "] is not equal to [" + "Customer Italiano" + "]", "Customer Italiano".equals(tooltip));
   
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

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.