Tabnine Logo
PersistentEntity.getMapping
Code IndexAdd Tabnine to your IDE (free)

How to use
getMapping
method
in
org.grails.datastore.mapping.model.PersistentEntity

Best Java code snippets using org.grails.datastore.mapping.model.PersistentEntity.getMapping (Showing top 18 results out of 315)

origin: org.grails/grails-datastore-core

public NativeEntryEntityPersister(MappingContext mappingContext, PersistentEntity entity,
     Session session, ApplicationEventPublisher publisher) {
  super(mappingContext, entity, session, publisher);
  classMapping = entity.getMapping();
}
origin: org.grails/grails-datastore-core

public ClassMapping getClassMapping() {
  return owner.getMapping();
}
public T getMappedForm() {
origin: org.grails/grails-datastore-core

public ClassMapping getClassMapping() {
  return owner.getMapping();
}
public T getMappedForm() {
origin: org.grails/grails-datastore-core

public NativeEntryEntityPersister(MappingContext mappingContext, PersistentEntity entity,
     Session session, ApplicationEventPublisher publisher, TPCacheAdapterRepository<T> cacheAdapterRepository) {
  super(mappingContext, entity, session, publisher, cacheAdapterRepository);
  classMapping = entity.getMapping();
}
origin: org.grails/grails-datastore-core

@Override
public String getIdentifierName() {
  return getIdentifierName(persistentEntity.getMapping());
}
origin: org.grails/grails-datastore-core

@Override
public void setIdentifier(Object id) {
  String idName = getIdentifierName(persistentEntity.getMapping());
  setProperty(idName, id);
}
origin: org.grails/grails-datastore-core

@Override
public void setIdentifierNoConversion(Object id) {
  String idName = getIdentifierName(persistentEntity.getMapping());
  setPropertyNoConversion(idName, id);
}
origin: org.grails/grails-datastore-core

/**
 * Obtain all of the {@link ConnectionSource} names for the given entity
 *
 * @param entity The entity
 * @return The {@link ConnectionSource} names
 */
public static List<String> getConnectionSourceNames(PersistentEntity entity) {
  final Entity mappedForm = entity.getMapping().getMappedForm();
  if(mappedForm != null)  {
    return mappedForm.getDatasources();
  }
  return DEFAULT_CONNECTION_SOURCE_NAMES;
}
origin: org.grails/grails-datastore-core

public boolean isStateless(PersistentEntity entity) {
  Entity mappedForm = entity != null ? entity.getMapping().getMappedForm() : null;
  return isStateless() || (mappedForm != null && mappedForm.isStateless());
}
origin: org.grails/grails-datastore-gorm-hibernate-core

public Mapping evaluateMapping(PersistentEntity domainClass, Closure<?> defaultMapping, boolean cache) {
  try {
    final Mapping m = (Mapping) domainClass.getMapping().getMappedForm();
    trackCustomCascadingSaves(m, domainClass.getPersistentProperties());
    if (cache) {
      MAPPING_CACHE.put(domainClass.getJavaClass(), m);
    }
    return m;
  } catch (Exception e) {
    throw new DatastoreConfigurationException("Error evaluating ORM mappings block for domain [" +
        domainClass.getName() + "]:  " + e.getMessage(), e);
  }
}
origin: org.grails/grails-datastore-core

@Override
public Object getIdentifier() {
  String idName = getIdentifierName(persistentEntity.getMapping());
  if (idName != null) {
    return getProperty(idName);
  }
  PersistentProperty identity = persistentEntity.getIdentity();
  if(identity != null) {
    return getProperty(identity.getName());
  }
  return null;
}
origin: org.grails/grails-plugin-controllers

  private static void autowire(Object instance) {
    if(!Environment.isInitializing()) {

      GrailsApplication application = Holders.findApplication();
      if(application != null) {

        try {
          PersistentEntity domainClass = application.getMappingContext().getPersistentEntity(instance.getClass().getName());
          if(domainClass != null) {

            if (domainClass.getMapping().getMappedForm().isAutowire()) {
              final ApplicationContext applicationContext = Holders.findApplicationContext();
              if (applicationContext != null) {
                applicationContext
                    .getAutowireCapableBeanFactory()
                    .autowireBeanProperties(instance, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
              }
            }
          }
        } catch (GrailsConfigurationException e) {
          // ignore, Mapping Context not initialized yet
        }

      }
    }
  }
}
origin: org.grails/grails-datastore-gorm

protected void storeDateCreatedAndLastUpdatedInfo(PersistentEntity persistentEntity) {
  if(persistentEntity.isInitialized()) {
    ClassMapping<?> classMapping = persistentEntity.getMapping();
    Entity mappedForm = classMapping.getMappedForm();
    if(mappedForm == null || mappedForm.isAutoTimestamp()) {
      storeTimestampAvailability(entitiesWithDateCreated, persistentEntity, persistentEntity.getPropertyByName(DATE_CREATED_PROPERTY));
      storeTimestampAvailability(entitiesWithLastUpdated, persistentEntity, persistentEntity.getPropertyByName(LAST_UPDATED_PROPERTY));
    }
  }
  else {
    uninitializedEntities.add(persistentEntity.getName());
  }
}
origin: org.grails/grails-datastore-gorm

public void afterLoad(final PersistentEntity entity, final EntityAccess ea, PostLoadEvent event) {
  activateDirtyChecking(ea);
  if (autowireEntities || ( entity != null &&  entity.getMapping().getMappedForm().isAutowire() )) {
    autowireBeanProperties(ea.getEntity());
  }
  invokeEvent(EVENT_AFTER_LOAD, entity, ea, event);
}
origin: org.grails/grails-datastore-core

/**
 * @see org.grails.datastore.mapping.model.MappingConfigurationStrategy#getIdentity(Class, org.grails.datastore.mapping.model.MappingContext)
 */
public PersistentProperty getIdentity(Class javaClass, MappingContext context) {
  ClassPropertyFetcher cpf = ClassPropertyFetcher.forClass(javaClass);
  PersistentEntity entity = context.getPersistentEntity(javaClass.getName());
  ClassMapping mapping = entity.getMapping();
  IdentityMapping id = mapping.getIdentifier();
  final String[] names = id.getIdentifierName();
  if (names.length == 1) {
    final PropertyDescriptor pd = cpf.getPropertyDescriptor(names[0]);
    if (pd != null) {
      return propertyFactory.createIdentity(entity, context, pd);
    }
    if (!entity.isExternal() && isAbstract(entity)) {
      throw new IllegalMappingException("Mapped identifier [" + names[0] + "] for class [" +
         javaClass.getName() + "] is not a valid property");
    }
    return null;
  }
  return null;
}
origin: org.grails/grails-datastore-core

@Override
public PersistentProperty[] getCompositeIdentity(Class javaClass, MappingContext context) {
  ClassPropertyFetcher cpf = ClassPropertyFetcher.forClass(javaClass);
  PersistentEntity entity = context.getPersistentEntity(javaClass.getName());
  ClassMapping mapping = entity.getMapping();
  IdentityMapping id = mapping.getIdentifier();
  final String[] names = id.getIdentifierName();
  PersistentProperty[] identifiers = new PersistentProperty[names.length];
  for (int i = 0; i < names.length; i++) {
    String name = names[i];
    final PersistentProperty p = entity.getPropertyByName(name);
    if(p != null) {
      identifiers[i] = p;
    }
    else {
      final PropertyDescriptor pd = cpf.getPropertyDescriptor(name);
      if (pd != null) {
        identifiers[i] = propertyFactory.createIdentity(entity, context, pd);
      }
      else {
        throw new IllegalMappingException("Invalid composite id mapping. Could not resolve property ["+name+"] for entity ["+javaClass.getName()+"]");
      }
    }
  }
  return identifiers;
}
origin: org.grails/grails-datastore-gorm-hibernate-core

  cascadeStrategy = CASCADE_ALL;
else if(isCompositeIdProperty((Mapping) domainClass.getMapping().getMappedForm(), grailsProperty)) {
  cascadeStrategy = CASCADE_ALL;
origin: org.grails/grails-datastore-core

final NativeEntryModifyingEntityAccess entityAccess = (NativeEntryModifyingEntityAccess) createEntityAccess(persistentEntity, obj, tmp);
K k = readObjectIdentifier(entityAccess, persistentEntity.getMapping());
org.grails.datastore.mapping.modelPersistentEntitygetMapping

Javadoc

Defines the mapping between this persistent entity and an external form

Popular methods of PersistentEntity

  • getJavaClass
  • getIdentity
    Returns the identity of the instance
  • getPropertyByName
    Obtains a PersistentProperty instance by name
  • getName
    The entity name including any package prefix
  • getPersistentProperties
    A list of properties to be persisted
  • getVersion
    Returns the version property.
  • isMultiTenant
  • getAssociations
    A list of the associations for this entity. This is typically a subset of the list returned by #getP
  • getCompositeIdentity
    The composite id
  • getMappingContext
    Obtains the MappingContext where this PersistentEntity is defined
  • getReflector
  • getTenantId
  • getReflector,
  • getTenantId,
  • isInitialized,
  • isOwningEntity,
  • isRoot,
  • isVersioned,
  • addOwner,
  • getDecapitalizedName,
  • getDiscriminator

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now