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

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

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

origin: org.grails/grails-datastore-gorm

protected void setVersion(final EntityAccess ea) {
  final Class versionType = ea.getPersistentEntity().getVersion().getType();
  if (Number.class.isAssignableFrom(versionType)) {
    ea.setProperty(GormProperties.VERSION, 0);
  }
  else if (Timestamp.class.isAssignableFrom(versionType)) {
    ea.setProperty(GormProperties.VERSION, new Timestamp(System.currentTimeMillis()));
  }
  else if (Date.class.isAssignableFrom(versionType)) {
    ea.setProperty(GormProperties.VERSION, new Date());
  }
}
origin: org.grails/grails-datastore-gorm-validation

protected boolean canApplyNullableConstraint(String propertyName, PersistentProperty property, Constrained constrained) {
  if (property == null || property.getType() == null) return false;
  final PersistentEntity domainClass = property.getOwner();
  // only apply default nullable to Groovy entities not legacy Java ones
  if (!GroovyObject.class.isAssignableFrom(domainClass.getJavaClass())) return false;
  final PersistentProperty versionProperty = domainClass.getVersion();
  final boolean isVersion = versionProperty != null && versionProperty.equals(property);
  return !constrained.hasAppliedConstraint(ConstrainedProperty.NULLABLE_CONSTRAINT) &&
      isConstrainableProperty(property, propertyName) && !isVersion;
}
origin: org.grails/grails-datastore-core

protected void setDateVersion(final EntityAccess ea) {
  setDateVersionInternal(ea.getPersistentEntity().getVersion().getName(), ea);
}
origin: org.grails/grails-datastore-core

public static void incrementEntityVersion(EntityAccess ea) {
  final String versionName = ea.getPersistentEntity().getVersion().getName();
  if (Number.class.isAssignableFrom(ea.getPropertyType(versionName))) {
    Number currentVersion = (Number) ea.getProperty(versionName);
    if (currentVersion == null) {
      currentVersion = 0L;
    }
    ea.setProperty(versionName, currentVersion.longValue() + 1);
  }
  else {
    setDateVersionInternal(versionName, ea);
  }
}
origin: org.grails/grails-datastore-core

protected void setVersion(final EntityAccess ea) {
  final String versionName = ea.getPersistentEntity().getVersion().getName();
  if (Number.class.isAssignableFrom(ea.getPropertyType(versionName))) {
    ea.setProperty(versionName, 0);
  }
  else {
    setDateVersion(ea);
  }
}
origin: org.grails/grails-datastore-gorm-validation

PersistentProperty version = entity.getVersion();
if (canPropertyBeConstrained(p) && !p.equals(version)) {
  if (mappedForm.isDerived()) {
org.grails.datastore.mapping.modelPersistentEntitygetVersion

Javadoc

Returns the version property.

Popular methods of PersistentEntity

  • getJavaClass
  • getIdentity
    Returns the identity of the instance
  • getMapping
    Defines the mapping between this persistent entity and an external form
  • getPropertyByName
    Obtains a PersistentProperty instance by name
  • getName
    The entity name including any package prefix
  • getPersistentProperties
    A list of properties to be persisted
  • 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

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • setRequestProperty (URLConnection)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Top plugins for WebStorm
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