org.apache.isis.core.metamodel.adapter.oid.Oid类的使用及代码示例

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

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

Oid介绍

暂无

代码示例

代码示例来源:origin: org.apache.isis.viewer/wicket-model

@Override
public boolean matchesSafely(final Oid item) {
  return item.isTransient();
}

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-wicket-impl

/**
 * Converts {@link ObjectAdapter} to string representation of {@link Oid}.
 */
@Override
public String convertToString(final ObjectAdapter adapter, final Locale locale) {
  final Oid oid = adapter.getOid();
  if (oid == null) {
    // values don't have an Oid
    return null;
  }
  return oid.enString();
}

代码示例来源:origin: org.apache.isis.core/isis-core-viewer-restfulobjects-rendering

public static String getOidStr(final ObjectAdapter objectAdapter) {
  final Oid oid = objectAdapter.getOid();
  if (!(oid instanceof RootOid)) {
    throw new IllegalArgumentException("objectAdapter must be a root adapter");
  }
  return oid.enStringNoVersion();
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

private String aggregateResolveStateCode() {
  // this is an approximate re-implementation...
  final Oid oid = getOid();
  if(oid != null) {
    if(oid.isPersistent()) return "P";
    if(oid.isTransient()) return "T";
    if(oid.isViewModel()) return "V";
  }
  return "S"; // standalone adapter (value)
}
//endregion

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

@Override
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 ObjectAdapter 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.apache.isis.runtimes.dflt/runtime

@Override
public void remapUpdated(final Oid oid) {
  identities.remove(oid);
  final Oid previousOid = oid.getPrevious();
  final ObjectAdapter object = identities.get(previousOid);
  if (object == null) {
    return;
  }
  identities.remove(previousOid);
  final Oid oidFromObject = object.getOid();
  oidFromObject.copyFrom(oid);
  identities.put(oidFromObject, object);
}

代码示例来源:origin: org.apache.isis.core/isis-core-viewer-wicket-model

/**
 * Factory method for creating {@link PageParameters}.
 * 
 * see {@link #ActionModel(PageParameters, SpecificationLoader)}
 */
public static PageParameters createPageParameters(
    final ObjectAdapter adapter, final ObjectAction objectAction, final ConcurrencyChecking concurrencyChecking) {
  
  final PageParameters pageParameters = PageParametersUtils.newPageParameters();
  final String oidStr = concurrencyChecking == ConcurrencyChecking.CHECK?
      adapter.getOid().enString():
      adapter.getOid().enStringNoVersion();
  PageParameterNames.OBJECT_OID.addStringTo(pageParameters, oidStr);
  
  final ActionType actionType = objectAction.getType();
  PageParameterNames.ACTION_TYPE.addEnumTo(pageParameters, actionType);
  
  final ObjectSpecification actionOnTypeSpec = objectAction.getOnType();
  if (actionOnTypeSpec != null) {
    PageParameterNames.ACTION_OWNING_SPEC.addStringTo(pageParameters, actionOnTypeSpec.getFullIdentifier());
  }
  
  final String actionId = determineActionId(objectAction);
  PageParameterNames.ACTION_ID.addStringTo(pageParameters, actionId);
  
  return pageParameters;
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

private void updateFieldsAndResolveState(final ObjectAdapter objectAdapter, final Data data) {
  
  boolean dataIsTransient = data.getOid().isTransient();
  
  if (!dataIsTransient) {
    updateFields(objectAdapter, data);
    objectAdapter.getOid().setVersion(data.getOid().getVersion());
  } else if (objectAdapter.isTransient() && dataIsTransient) {
    updateFields(objectAdapter, data);
    
  } else if (objectAdapter.isParentedCollection()) {
    // this branch is kind-a wierd, I think it's to handle aggregated adapters.
    updateFields(objectAdapter, data);
    
  } else {
    final ObjectData od = (ObjectData) data;
    if (od.containsField()) {
      throw new IsisException("Resolve state (for " + objectAdapter + ") inconsistent with fact that data exists for fields");
    }
  }
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

@Test
public void whenValidPersistentWithTransientPreviousThenPreviousDoesNotItselfHaveAPrevious() {
  final SerialOid oid = SerialOid.deString("OID:12ABF3~TOID:12");
  final Oid previousOid = oid.getPrevious();
  assertThat(previousOid.hasPrevious(), is(false));
}

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

@Test
public void testOidHasNoPrevious() throws Exception {
  assertNull(oid.getPrevious());
}

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-wicket-model

/**
 * Factory method for creating {@link PageParameters}.
 * 
 * see {@link #ActionModel(PageParameters, SpecificationLoader)}
 */
public static PageParameters createPageParameters(
    final ObjectAdapter adapter, final ObjectAction objectAction, final ConcurrencyChecking concurrencyChecking) {
  
  final PageParameters pageParameters = PageParametersUtils.newPageParameters();
  final String oidStr = concurrencyChecking == ConcurrencyChecking.CHECK?
      adapter.getOid().enString():
      adapter.getOid().enStringNoVersion();
  PageParameterNames.OBJECT_OID.addStringTo(pageParameters, oidStr);
  
  final ActionType actionType = objectAction.getType();
  PageParameterNames.ACTION_TYPE.addEnumTo(pageParameters, actionType);
  
  final ObjectSpecification actionOnTypeSpec = objectAction.getOnType();
  if (actionOnTypeSpec != null) {
    PageParameterNames.ACTION_OWNING_SPEC.addStringTo(pageParameters, actionOnTypeSpec.getFullIdentifier());
  }
  
  final String actionId = determineActionId(objectAction);
  PageParameterNames.ACTION_ID.addStringTo(pageParameters, actionId);
  
  return pageParameters;
}

代码示例来源:origin: org.apache.isis.runtimes.dflt.remoting/common

final Oid objectsOid = object.getOid();
Assert.assertNotNull(objectsOid);
if (objectsOid.hasPrevious()) {
  final Version version = object.getVersion();
  final String type = data.getType();

代码示例来源:origin: org.apache.isis.runtimes.dflt/runtime

LOG.debug("made persistent " + rootAdapter + "; was " + oid.getPrevious());

代码示例来源:origin: org.apache.isis.viewer/wicket-model

@Override
public boolean matchesSafely(final Oid item) {
  return !item.isTransient();
}

代码示例来源:origin: org.apache.isis.core/isis-core-runtime

private static <T extends Oid> T clone(final T oid) {
  if(oid == null) { return null; }
  final String oidStr = oid.enString();
  return (T) OID_MARSHALLER.unmarshal(oidStr, oid.getClass());
}

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-rendering

public static String getOidStr(final RendererContext renderContext, final ObjectAdapter objectAdapter) {
  final Oid oid = objectAdapter.getOid();
  if (!(oid instanceof RootOid)) {
    throw new IllegalArgumentException("objectAdapter must be a root adapter");
  }
  return oid != null ? oid.enStringNoVersion(getOidMarshaller()) : null;
}

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

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

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-restfulobjects-impl

/**
 * hook method
 */
protected String linkRef() {
  if (resourceContext == null) {
    throw new IllegalStateException("resourceContext not provided");
  }
  if (objectAdapter == null) {
    throw new IllegalStateException("objectAdapter not provided");
  }
  final StringBuilder buf = new StringBuilder("objects/");
  buf.append(objectAdapter.getOid().enString(getOidMarshaller()));
  return buf.toString();
}

代码示例来源:origin: org.apache.isis.viewer/isis-viewer-wicket-model

/**
 * Factory method for creating {@link PageParameters} to represent an
 * entity.
 */
public static PageParameters createPageParameters(final ObjectAdapter adapter) {
  final PageParameters pageParameters = PageParametersUtils.newPageParameters();
  final Boolean persistent = adapter != null && adapter.representsPersistent();
  if (persistent) {
    final String oidStr = adapter.getOid().enStringNoVersion();
    PageParameterNames.OBJECT_OID.addStringTo(pageParameters, oidStr);
  } else {
    // don't do anything; instead the page should be redirected back to
    // an EntityPage so that the underlying EntityModel that contains
    // the memento for the transient ObjectAdapter can be accessed.
  }
  return pageParameters;
}

代码示例来源:origin: org.apache.isis.viewer/scimpi-dispatcher

@Override
public void clear() {
  requestTransients.clear();
  final List<String> remove = new ArrayList<String>();
  for (final String id : sessionTransients.keySet()) {
    if (!sessionTransients.get(id).getOid().isTransient()) {
      remove.add(id);
      sessionTransients.put(id, null);
    }
  }
  for (final String id : remove) {
    sessionTransients.remove(id);
  }
}

相关文章