Codota Logo
Change
Code IndexAdd Codota to your IDE (free)

How to use
Change
in
org.granite.tide.data

Best Java code snippets using org.granite.tide.data.Change (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: org.graniteds/granite-client-java-advanced

public ChangeEntity(Change change, ClientAliasRegistry aliasRegistry) {
  super(getTypeForAlias(aliasRegistry, change), change.getId(), change.getVersion(), change.getUid());
  getChanges().putAll(change.getChanges());
}
 
origin: org.graniteds/granite-client-java

  @Override
  public int compareTo(Change o) {
    if (!className.equals(o.getClassName()))
      return className.compareTo(o.getClassName());
    if (!uid.equals(o.getUid()))
      return uid.compareTo(o.getUid());
    if (version == null)
      return o.getVersion() == null ? 0 : -1;
    else if (version.equals(o.getVersion()))
      return 0;
    else if (o.getVersion() == null)
      return 1;
    return version.longValue() > o.getVersion().longValue() ? 1 : -1;
  }
}
origin: org.graniteds/granite-client-java-advanced

private boolean isForEntity(Change change, Object entity) {
  return entity.getClass().getName().equals(getType(change.getClassName())) && change.getUid().equals(dataManager.getUid(entity));
}
 
origin: org.graniteds/granite-server-hibernate4

private static Object getChange(EntityPersister persister, Session session, String entityName, Serializable id, Object entity) {
  Number version = (Number)persister.getVersion(entity);
  String uid = getUid(persister, entity);
  if (uid == null)
    return null;
  
  Object change = null;
  for (EntityUpdate du : DataContext.get().getDataUpdates()) {
    if (du.entity instanceof Change) {
      if (du.type == EntityUpdateType.UPDATE
          && ((Change)du.entity).getClassName().equals(entityName)
          && ((Change)du.entity).getId().equals(id)) {
        change = du.entity;
        break;
      }
    }
    else if (du.entity.getClass().getName().equals(entityName)
        && id.equals(persister.getIdentifier(entity, (SessionImplementor)session))) {
      change = du.entity;
      break;
    }
  }
  if (change == null) {
    change = new Change(entityName, id, version, uid);
    DataContext.addUpdate(EntityUpdateType.UPDATE, change, entity, 1);
  }
  else if (change instanceof Change)
    ((Change)change).updateVersion(version);
  return change;
}
origin: org.graniteds/granite-client-java-advanced

  private static String getTypeForAlias(ClientAliasRegistry aliasRegistry, Change change) {
    if (aliasRegistry.getTypeForAlias(change.getClassName()) != null)
      return aliasRegistry.getTypeForAlias(change.getClassName());
    return change.getClassName();
  }
}
origin: org.graniteds/granite-client-java-advanced

  continue;
change = new Change(getAlias(entity.getClass().getName()),
    dataManager.hasIdProperty(entity) ? (Serializable)dataManager.getId(entity) : null,
    (Number)dataManager.getVersion(entity), dataManager.getUid(entity),
change = new Change(getAlias(entity.getClass().getName()), null, null, dataManager.getUid(entity), local);
    List<?> collSnapshot = (List<?>)save.get(p);
    CollectionChanges collChanges = new CollectionChanges();
    change.getChanges().put(p, collChanges);
    change.getChanges().put(p, buildRef(v));
  change.getChanges().put(p, v);
  changeMap.put(v, false);
origin: org.graniteds/granite-server-hibernate4

public void onPostUpdate(PostUpdateEvent event) {
  if (DataPublishListener.handleExclude(event.getEntity()))
    return;
  
  if (event.getDirtyProperties() != null && event.getDirtyProperties().length > 0) {
    Object change = getChange(event.getPersister(), event.getSession(), event.getPersister().getEntityName(), event.getId(), event.getEntity());
    if (change instanceof Change) {
      for (int i = 0; i < event.getDirtyProperties().length; i++) {
        int pidx = event.getDirtyProperties()[i];
        String pname = event.getPersister().getPropertyNames()[pidx];
        if (AnnotationUtils.isAnnotatedWith(event.getEntity(), pname, ExcludeFromDataPublish.class))
          continue;
        
        ((Change)change).getChanges().put(pname, event.getState()[pidx]);
      }
    }
    else if (change == null)
      DataContext.addUpdate(EntityUpdateType.UPDATE, event.getEntity(), event.getEntity());
  }
}
origin: org.graniteds/granite-client-java-advanced

private boolean isForEntity(MergeContext mergeContext, Change change, Object entity) {
  String className = mergeContext.getServerSession().getAliasRegistry().getTypeForAlias(change.getClassName());
  return entity.getClass().getName().equals(className) && change.getUid().equals(mergeContext.getDataManager().getUid(entity));
}
private boolean isForEntity(MergeContext mergeContext, ChangeRef changeRef, Object entity) {
origin: org.graniteds/granite-server

  public Object invoke(Object object, Method method, Method method1, Object[] args) throws Exception {
    String name = method.getName();
    if ("toString".equals(name)) {
      return changeSet.getChanges()[0].getClassName() + "@" + System.identityHashCode(object);
    }
    else if ("equals".equals(name)) {
      return proxyObject == object;
    }
    else if ("hashCode".equals(name)) {
      return System.identityHashCode(object);
    }
    else if ("getChangeSetProxyData".equals(name) && method.getParameterTypes().length == 0) {
      return changeSet;
    }
    return null;
  }
}
origin: org.graniteds/granite-server

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  if (getClassName().indexOf(".") > 0)
    sb.append(getClassName().substring(getClassName().lastIndexOf(".")+1));
  else
    sb.append(getClassName());
  sb.append(':').append(getUid()).append(":").append(getId()).append(':').append(getVersion()).append("={");
  boolean first = true;
  for (Entry<String, Object> change : getChanges().entrySet()) {
    if (first)
      first = false;
    else
      sb.append(", ");
    sb.append(change.getKey()).append(": ").append(change.getValue());
  }
  sb.append("}");
  return sb.toString();
}
 
origin: org.graniteds/granite-client-javafx

  @Override
  public int compareTo(Change o) {
    if (!className.equals(o.getClassName()))
      return className.compareTo(o.getClassName());
    if (!uid.equals(o.getUid()))
      return uid.compareTo(o.getUid());
    if (version == null)
      return o.getVersion() == null ? 0 : -1;
    else if (version.equals(o.getVersion()))
      return 0;
    else if (o.getVersion() == null)
      return 1;
    return version.longValue() > o.getVersion().longValue() ? 1 : -1;
  }
}
origin: org.graniteds/granite-client-java-advanced

public ChangeEntityRef(Object change, ClientAliasRegistry aliasRegistry) {
  if (change instanceof Change) {
    className = ((Change)change).getClassName();
    uid = ((Change)change).getUid();
  }
  else if (change instanceof ChangeRef) {
    className = ((ChangeRef)change).getClassName();
    uid = ((ChangeRef)change).getUid();
  }
  if (aliasRegistry.getTypeForAlias(className) != null)
    className = aliasRegistry.getTypeForAlias(className);
}
 
origin: org.graniteds/granite-server

@Override
protected boolean internalCanConvert(Object value, Type targetType) {
  if (value instanceof ChangeSet && targetType instanceof Class<?>) {
    if (((ChangeSet)value).getChanges() == null || ((ChangeSet)value).getChanges().length == 0)
      throw new IllegalArgumentException("Incoming ChangeSet objects must contain at least one Change");
    
    String className = ((ChangeSet)value).getChanges()[0].getClassName();
    try {
      Class<?> clazz = TypeUtil.forName(className);
      return ((Class<?>)targetType).isAssignableFrom(clazz);
    } 
    catch (ClassNotFoundException e) {
      throw new RuntimeException("Cannot find class for ChangeSet argument " + className);
    }
  }
  return false;
}
origin: org.graniteds/granite-client-java

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  if (getClassName().indexOf(".") > 0)
    sb.append(getClassName().substring(getClassName().lastIndexOf(".")+1));
  else
    sb.append(getClassName());
  sb.append(':').append(getUid()).append(":").append(getId()).append(':').append(getVersion()).append("={");
  boolean first = true;
  for (Entry<String, Object> change : getChanges().entrySet()) {
    if (first)
      first = false;
    else
      sb.append(", ");
    sb.append(change.getKey()).append(": ").append(change.getValue());
  }
  sb.append("}");
  return sb.toString();
}
 
origin: org.graniteds/granite-server

  @Override
  public int compareTo(Change o) {
    if (!className.equals(o.getClassName()))
      return className.compareTo(o.getClassName());
    if (!uid.equals(o.getUid()))
      return uid.compareTo(o.getUid());
    if (version == null)
      return o.getVersion() == null ? 0 : -1;
    else if (version.equals(o.getVersion()))
      return 0;
    else if (o.getVersion() == null)
      return 1;
    return version.longValue() > o.getVersion().longValue() ? 1 : -1;
  }
}
origin: org.graniteds/granite-server

@Override
protected Object internalConvert(Object value, Type targetType) {
  ChangeSet changeSet = (ChangeSet)value;
  String className = changeSet.getChanges()[0].getClassName();
  try {
    Class<?> clazz = TypeUtil.forName(className);
    Class<?> proxyClass = proxyClasses.get(clazz);
    if (proxyClass == null) {
      ProxyFactory proxyFactory = new ProxyFactory();
      proxyFactory.setFilter(FINALIZE_FILTER);
      proxyFactory.setSuperclass(clazz);
      proxyFactory.setInterfaces(new Class<?>[] { ChangeSetProxy.class });
      proxyClass = proxyFactory.createClass();
      proxyClasses.put(clazz, proxyClass);
    }
      
    ProxyObject proxyObject = (ProxyObject)proxyClass.newInstance();
    proxyObject.setHandler(new ChangeSetProxyHandler(proxyObject, changeSet));
    return proxyObject;
  }
  catch (Exception e) {
    throw new RuntimeException("Cannot build proxy for Change argument " + className);
  }
}
origin: org.graniteds/granite-client-javafx

@Override
public String toString() {
  StringBuilder sb = new StringBuilder();
  if (getClassName().indexOf(".") > 0)
    sb.append(getClassName().substring(getClassName().lastIndexOf(".")+1));
  else
    sb.append(getClassName());
  sb.append(':').append(getUid()).append(":").append(getId()).append(':').append(getVersion()).append("={");
  boolean first = true;
  for (Entry<String, Object> change : getChanges().entrySet()) {
    if (first)
      first = false;
    else
      sb.append(", ");
    sb.append(change.getKey()).append(": ").append(change.getValue());
  }
  sb.append("}");
  return sb.toString();
}
 
origin: org.graniteds/granite-server

Class<?> entityClass = TypeUtil.forName(change.getClassName());
if (change.getId() != null) {
  Entity e = new Entity(entityClass);
  Type identifierType = e.getIdentifierType();
  Object entity = persistenceAdapter.find(entityClass, (Serializable)converters.convert(change.getId(), identifierType));
  if (entity == null) {
    log.debug("Entity not found, maybe has already been deleted by cascading");
  if ((change.getVersion() != null && change.getVersion().longValue() < version) || (change.getVersion() == null && version != null))
    persistenceAdapter.throwOptimisticLockException(entity);
  for (Entry<String, Object> me : change.getChanges().entrySet()) {
    try {
      PropertyDescriptor[] propertyDescriptors = Introspector.getPropertyDescriptors(entityClass);
        log.warn("Could not find property " + me.getKey() + " on class " + change.getClassName());
            log.warn("Property " + me.getKey() + " on class " + change.getClassName() + " is not writeable");
throw new ServiceException("Could not find class " + change.getClassName(), cnfe);
origin: org.graniteds/granite-client-java-advanced

boolean local = changeSet instanceof ChangeSet ? ((ChangeSet)changeSet).isLocal() : ((Change)changeSet).isLocal();
  if (change.isLocal() && next == null) {
    log.warn("Incoming change received for unknown entity %s: %s", change.getClassName(), change.getUid());
    continue;
      for (Map.Entry<String, Object> me : change.getChanges().entrySet()) {
        String p = me.getKey();
        Object val = me.getValue();
    Object incomingEntity = lookupEntity(mergeContext, change.getChanges(), dest, null);
    for (Map.Entry<String, Object> me : change.getChanges().entrySet()) {
      String p = me.getKey();
      Object val = me.getValue();
          log.debug("Incoming change for uninitialized collection %s:%s.%s", change.getClassName(), change.getUid(), p);
          continue;
          log.warn("Incoming change skipped %s:%s.%s, already processed", change.getClassName(), change.getUid(), p);
          continue;
    Number version = change.getVersion();
        change.getUid(), mergeContext.getDataManager().getIdPropertyName(changeClass),
        change.getId(), mergeContext.getDataManager().getVersionPropertyName(changeClass), version, mergedChanges, templateObject);
org.granite.tide.dataChange

Most used methods

  • getChanges
  • getClassName
  • getId
  • getUid
  • getVersion
  • <init>
  • addCollectionChanges
  • isLocal
  • updateVersion

Popular in Java

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • runOnUiThread (Activity)
  • getSystemService (Context)
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Notification (javax.management)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now