Package com.tll.common.model

Examples of com.tll.common.model.IEntityType


          final RelationInfo ri = schemaInfo.getRelationInfo(entityClass, pname);
          final boolean reference = ri.isReference();
          if(shouldMarshalRelation(reference, depth, options)) {
            final IEntity e = (IEntity) obj;
            final Model m = e == null ? null : marshalEntity(e, options, visited, depth + 1);
            final IEntityType etype =
              ri.getRelatedType() == null ? null : etResolver.resolveEntityType(e == null ? ri.getRelatedType() : e
                  .entityClass());
            prop = new RelatedOneProperty(etype, m, pname, reference);
          }
        }
View Full Code Here


        val = ((Double) pval).floatValue();
        break;

      case RELATED_ONE: {
        final Model rltdOne = (Model) pval;
        final IEntityType rltdEntityType =
          rltdOne == null ? ((RelatedOneProperty) mprop).getRelatedType() : rltdOne.getEntityType();
          assert rltdEntityType != null;
          IEntity toOne;
          if(rltdOne == null || rltdOne.isMarkedDeleted()) {
            toOne = null;
          }
          else {
            final Class<? extends IEntity> rltdEntityClass =
              (Class<? extends IEntity>) etResolver.resolveEntityClass(rltdEntityType);
            try {
              toOne = (IEntity) bw.getPropertyValue(propName);
              if(toOne == null) toOne = instantiateEntity(rltdEntityClass);
            }
            catch(final RuntimeException re) {
              log.warn("Unable to get related one entity ref", re);
              toOne = null;
            }
            log.debug("About to marshal related one [model: " + rltdOne + "] [entity: " + toOne + "]");
            marshalModel(rltdOne, toOne, visited, depth + 1);
          }
          val = toOne;
      }
      break;

      case NESTED:
        // no-op since these are expressed as "{parent}_{nestedA}"
        break;

      case RELATED_MANY: {
        if(pval != null) { // should always be non-null (see RelatedManyProperty)
          final List<Model> rmModelList = (List<Model>) pval;
          Set<IEntity> rmEntitySet = null;
          //try {
          rmEntitySet = (Set<IEntity>) bw.getPropertyValue(propName);
          final LinkedHashSet<IEntity> newRmEntitySet = new LinkedHashSet<IEntity>(rmModelList.size());
          if(rmEntitySet != null) {
            newRmEntitySet.addAll(rmEntitySet); // fail fast so don't trap exception here
          }
          //if(rmEntitySet != null) {
          // re-build the rm entity set
          for(final Model indexedModel : rmModelList) {
            assert indexedModel != null;
            final IEntityType indexedEntityType = indexedModel.getEntityType();
            final Class<IEntity> indexedEntityClass = (Class<IEntity>) etResolver.resolveEntityClass(indexedEntityType);
            final PrimaryKey<IEntity> imodelPk = new PrimaryKey<IEntity>(indexedEntityClass, indexedModel.getId());

            IEntity indexedEntity = null;
View Full Code Here

      return refDataMaps == null ? false : refDataMaps.containsKey(obj);
    case ENTITY:
      return entityMap == null ? false : entityMap.containsKey(obj);
    case ENTITY_PROTOTYPE: {
      if(entityPrototypes != null) {
        final IEntityType et = (IEntityType) obj;
        for(final Model p : entityPrototypes) {
          if(et.equals(p.getEntityType())) return true;
        }
      }
      return false;
    }
    default:
View Full Code Here

TOP

Related Classes of com.tll.common.model.IEntityType

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.