Package com.dooapp.gaedo.utils

Examples of com.dooapp.gaedo.utils.UnableToCreateObject


        throw new UnableToCreateObjectDueToBadKey(input, containedClass);
      }
      try {
        entity = datastore.get(current);
      } catch (EntityNotFoundException e) {
        throw new UnableToCreateObject(e, containedClass);
      }
    }
    // Load object from source entity
    try {
      if (logger.isLoggable(Level.FINER)) {
        logger.finer("getting object associated to  " + entity);
      }
      // Do some entity check to see if a migration is required
      if(migrator!=null) {
        String storedVersionField = entity.getProperty(migrator.getPersistedVersionFieldName()).toString();
        Object storedVersion = entity.getProperty(storedVersionField);
        Object liveVersion = migrator.getCurrentVersion();
        if(!storedVersion.equals(liveVersion)) {
          entity = migrator.migrate(this, entity, storedVersion, liveVersion);
        }
      }
      DataType returned;
      try {
        String dynamicClass = (String) entity
            .getProperty(CLASS_PROPERTY);
        if (logger.isLoggable(Level.FINER)) {
          logger.finer("object should be a " + dynamicClass);
        }
        Class<?> instanciated = Class.forName(dynamicClass);
        returned = (DataType) instanciated.newInstance();
        objectsBeingAccessed.put(entity.getKey(),
            new WeakReference<DataType>(returned));
      } catch (Exception e) {
        throw new UnableToCreateObject(e, containedClass);
      }
      if (logger.isLoggable(Level.FINER)) {
        logger.finer("mapping fields");
      }
      // Set all fields values
View Full Code Here

TOP

Related Classes of com.dooapp.gaedo.utils.UnableToCreateObject

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.