org.nakedobjects.metamodel.adapter.oid.Oid.isTransient()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.nakedobjects.metamodel.adapter.oid.Oid.isTransient()方法的一些代码示例,展示了Oid.isTransient()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Oid.isTransient()方法的具体详情如下:
包路径:org.nakedobjects.metamodel.adapter.oid.Oid
类名称:Oid
方法名:isTransient

Oid.isTransient介绍

[英]Flags whether this OID is temporary, and is for a transient object..
[中]标记此OID是否为临时对象,以及是否为临时对象。。

代码示例

代码示例来源:origin: org.nakedobjects/metamodel

public boolean isTransient() {
  return parentOid.isTransient();
}

代码示例来源:origin: org.nakedobjects.core/metamodel

public boolean isTransient() {
  return parentOid.isTransient();
}

代码示例来源:origin: org.nakedobjects.core/runtime

/**
 * For testing purposes only.
 */
public NakedObject testCreateTransient(final Object pojo, final Oid oid) {
  if (!oid.isTransient()) {
    throw new IllegalArgumentException(
        "Oid should be transient; use standard API to recreate adapters for persistent Oids");
  }
  return map(createOrRecreateRootAdapter(pojo, oid));
}

代码示例来源:origin: org.nakedobjects/xmlpersistence

public void addAssociation(final NakedObject fieldContent, final String fieldId, final boolean ensurePersistent) {
  final boolean notAlreadyPersistent = fieldContent != null && fieldContent.getOid().isTransient();
  if (ensurePersistent && notAlreadyPersistent) {
    throw new IllegalStateException("Cannot save an object that is not persistent: " + fieldContent);
  }
  // LOG.debug("adding reference field " + fieldId +" " + fieldContent);
  set(fieldId, fieldContent == null ? null : fieldContent.getOid());
}

代码示例来源:origin: org.nakedobjects.core/runtime

private NakedObject createOrRecreateAdapter(final Object pojo, final Oid oid) {
  NakedObject adapter = getAdapterFactory().createAdapter(pojo, oid);
  if (oid == null) {
    adapter.changeState(ResolveState.VALUE);
  } else {
    adapter.changeState(oid.isTransient() ? ResolveState.TRANSIENT : ResolveState.GHOST);
  }
  return adapter;
}

代码示例来源:origin: org.nakedobjects.plugins/html-viewer

public TransientObjectMapping(final NakedObject adapter) {
  oid = adapter.getOid();
  Assert.assertTrue("OID is for persistent", oid.isTransient());
  Assert.assertTrue("adapter is for persistent", adapter.isTransient());
  memento = new Memento(adapter);
}

代码示例来源:origin: org.nakedobjects.plugins/htmlviewer-viewer

public TransientObjectMapping(final NakedObject adapter) {
  oid = adapter.getOid();
  Assert.assertTrue("OID is for persistent", oid.isTransient());
  Assert.assertTrue("adapter is for persistent", adapter.isTransient());
  memento = new Memento(adapter);
}

代码示例来源:origin: org.nakedobjects.core/runtime

private Data createReferenceData(final NakedObject ref) {
  if (ref == null) {
    return null;
  }
  
  Oid refOid = ref.getOid();
  if (refOid == null) {
    return createStandaloneData(ref);
  }
  
  if (refOid.isTransient() && !transientObjects.contains(refOid)) {
    transientObjects.add(refOid);
    return createObjectData(ref);
  }
  
  final String resolvedState = ref.getResolveState().name();
  final String specification = ref.getSpecification().getFullName();
  return new Data(refOid, resolvedState, specification);
  
}

代码示例来源:origin: org.nakedobjects.plugins/htmlviewer-viewer

public PersistentObjectMapping(final NakedObject adapter) {
  oid = adapter.getOid();
  Assert.assertFalse("OID is for transient", oid.isTransient());
  Assert.assertFalse("adapter is for transient", adapter.isTransient());
  specification = adapter.getSpecification();
  version = adapter.getVersion();
}

代码示例来源:origin: org.nakedobjects.plugins/html-viewer

public PersistentObjectMapping(final NakedObject adapter) {
  oid = adapter.getOid();
  Assert.assertFalse("OID is for transient", oid.isTransient());
  Assert.assertFalse("adapter is for transient", adapter.isTransient());
  specification = adapter.getSpecification();
  version = adapter.getVersion();
}

代码示例来源:origin: org.nakedobjects/remoting

private NakedObject deserializeObjectFromObjectData(final ObjectData data, final KnownObjectsRequest knownObjects) {
  if (knownObjects.containsKey(data)) {
    return knownObjects.get(data);
  }
  final Oid oid = data.getOid();
  /*
   * either create a new transient object, get an existing object and update it if data is for resolved
   * object, or create new object and set it
   */
  NakedObject adapter = getAdapterManager().getAdapterFor(oid);
  if (adapter != null) {
    updateLoadedObject(adapter, data, knownObjects);
  } else if (oid.isTransient()) {
    adapter = deserializeTransient(data, knownObjects);
  } else {
    adapter = deserializePersistentObject(data, oid, knownObjects);
  }
  return adapter;
}

代码示例来源:origin: org.nakedobjects.core/remoting

private NakedObject deserializeObjectFromObjectData(final ObjectData data, final KnownObjectsRequest knownObjects) {
  if (knownObjects.containsKey(data)) {
    return knownObjects.get(data);
  }
  final Oid oid = data.getOid();
  /*
   * either create a new transient object, get an existing object and update it if data is for resolved
   * object, or create new object and set it
   */
  NakedObject adapter = getAdapterManager().getAdapterFor(oid);
  if (adapter != null) {
    updateLoadedObject(adapter, data, knownObjects);
  } else if (oid.isTransient()) {
    adapter = deserializeTransient(data, knownObjects);
  } else {
    adapter = deserializePersistentObject(data, oid, knownObjects);
  }
  return adapter;
}

代码示例来源:origin: org.nakedobjects.core/runtime

public NakedObject recreateObject() {
  if (state == null) {
    return null;
  } else {
    final NakedObjectSpecification spec = getSpecificationLoader().loadSpecification(state.getClassName());
    NakedObject object;
    ResolveState targetState;
    if (getOid().isTransient()) {
      object = getHydrator().recreateAdapter(getOid(), spec);
      targetState = ResolveState.SERIALIZING_TRANSIENT;
    } else {
      object = getHydrator().recreateAdapter(getOid(), spec);
      targetState = ResolveState.UPDATING;
    }
    if (object.getSpecification().isCollection()) {
      populateCollection(object, (CollectionData) state, targetState);
    } else {
      updateObject(object, state, targetState);
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("recreated object " + object.getOid());
    }
    return object;
  }
}

代码示例来源:origin: org.nakedobjects/remoting

object = encoderDecoder.decode(data[i], knownObjects);
persistedObjects[i] = object;
if (object.getOid().isTransient()) { // confirm that the graph has not been made

代码示例来源:origin: org.nakedobjects.core/remoting

object = encoderDecoder.decode(data[i], knownObjects);
persistedObjects[i] = object;
if (object.getOid().isTransient()) { // confirm that the graph has not been made

代码示例来源:origin: org.nakedobjects.plugins/dndviewer

public static void addObjectMenuOptions(final NakedObject object, final UserActionSet options) {
  if (object != null) {
    final NakedObjectAction[] actions1 = object.getSpecification().getObjectActions(NakedObjectActionConstants.USER);
    final NakedObjectAction[] actions2 = object.getSpecification().getObjectActions(
        NakedObjectActionConstants.EXPLORATION);
    final NakedObjectAction[] actions3 = object.getSpecification().getObjectActions(NakedObjectActionConstants.DEBUG);
    final NakedObjectAction[] actions = ArrayUtils.combine(actions1, actions2, actions3);
    menuOptions(actions, object, options);
    final Oid oid = object.getOid();
    final boolean isPersistent = oid != null && !oid.isTransient();
    if (!(object.getSpecification().isService()) && !(object.getObject() instanceof NakedObjectList)
        && isPersistent) {
      options.add(new DisposeObjectOption());
    }
  }
}

代码示例来源:origin: org.nakedobjects.core/runtime

if (oid.isTransient()) {
  ref = getHydrator().recreateAdapter(oid, spec);
  resolveState = ResolveState.getResolveState(data.getResolveState());

代码示例来源:origin: org.nakedobjects.core/runtime

if (adapter.getOid().isTransient()) {
  adapterManager.remapAsPersistent(adapter);

相关文章