本文整理了Java中org.nakedobjects.metamodel.adapter.oid.Oid
类的一些代码示例,展示了Oid
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Oid
类的具体详情如下:
包路径:org.nakedobjects.metamodel.adapter.oid.Oid
类名称:Oid
暂无
代码示例来源:origin: org.nakedobjects/metamodel
public boolean isTransient() {
return parentOid.isTransient();
}
代码示例来源:origin: org.nakedobjects.core/runtime
public void remapUpdated(final Oid oid) {
ensureThatArg(oid.hasPrevious(), is(true));
final Oid previousOid = oid.getPrevious();
if (LOG.isDebugEnabled()) {
LOG.debug("remapping oid: " + oid + " with previous oid of: " + previousOid);
}
final NakedObject lookedUpAdapter = oidAdapterMap.getAdapter(previousOid);
if (lookedUpAdapter == null) {
LOG.warn("could not locate previousOid: " + previousOid);
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("removing previous oid" + previousOid);
}
oidAdapterMap.remove(previousOid);
// we can't replace the Oid on the looked-up adapter, so instead we
// just make it the same value as the Oid we were originally passed in
final Oid lookedUpAdapterOid = lookedUpAdapter.getOid();
lookedUpAdapterOid.copyFrom(oid);
// finally re-map the adapter
oidAdapterMap.add(lookedUpAdapterOid, lookedUpAdapter);
}
代码示例来源:origin: org.nakedobjects/remoting
final Oid objectsOid = object.getOid();
Assert.assertNotNull(objectsOid);
if (objectsOid.hasPrevious()) {
final Version version = object.getVersion();
final String type = data.getType();
代码示例来源:origin: org.nakedobjects/xmlpersistence
OutputStream out = new ByteArrayOutputStream();
ByteEncoder encoder = new ByteEncoderBuffer(out);
nakedObject.getOid().encode(encoder);
代码示例来源:origin: org.nakedobjects.core/runtime
LOG.debug("made persistent " + rootAdapter + "; was " + oid.getPrevious());
代码示例来源:origin: org.nakedobjects.core/remoting
final Oid objectsOid = object.getOid();
Assert.assertNotNull(objectsOid);
if (objectsOid.hasPrevious()) {
final Version version = object.getVersion();
final String type = data.getType();
代码示例来源: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
内容来源于网络,如有侵权,请联系作者删除!