private void mapPackageInfos( InternalCDOPackageInfo[] packageInfos, Connection connection, boolean unmap) { boolean supportingEcore = getStore().getRepository().isSupportingEcore(); for (InternalCDOPackageInfo packageInfo : packageInfos) { EPackage ePackage = packageInfo.getEPackage(); if (!CDOModelUtil.isCorePackage(ePackage) || supportingEcore) { mapClasses(connection, unmap, EMFUtil.getPersistentClasses(ePackage)); } } }
/** * This method retrieves the value from the feature at the given index. It retrieves the value * either from the views's store or the internal pre-registration Map. * * @param feature the feature to retrieve the value from * @param index the given index of the object in the feature * @return the value from the feature at the given index */ private Object getValueFromRevision(EStructuralFeature feature, int index) { InternalCDORevision revision = cdoRevision(); Object object = revision.get(feature, index); if (object == null) { return null; } if (object instanceof CDOElementProxy) { // Resolve proxy CDOElementProxy proxy = (CDOElementProxy) object; object = viewAndState .view .getSession() .resolveElementProxy(revision, feature, index, proxy.getIndex()); } if (object instanceof CDOLegacyWrapper) { return ((CDOLegacyWrapper) object).cdoInternalInstance(); } CDOType type = CDOModelUtil.getType(feature.getEType()); object = viewAndState.view.getStore().convertToEMF(instance, revision, feature, index, object); if (type == CDOType.OBJECT) { if (object instanceof CDOID) { CDOID id = (CDOID) object; if (id.isNull()) { return null; } object = getRegisteredWrapper(id); if (object != null) { return ((CDOLegacyWrapper) object).cdoInternalInstance(); } if (id.isExternal()) { object = viewAndState .view .getResourceSet() .getEObject(URI.createURI(id.toURIFragment()), true); } else { object = viewAndState.view.getObject(id); } if (object instanceof CDOObjectWrapper) { return ((CDOObjectWrapper) object).cdoInternalInstance(); } } } return object; }
private void checkReadable(EStructuralFeature feature) { if ((flags & BYPASS_PERMISSION_CHECKS_FLAG) != 0) { return; } if (CDOModelUtil.isResourcePathFeature(feature)) { return; } if ((flags & READ_PERMISSION_FLAG) == 0) { throw new NoPermissionException(this); } }
/** @since 4.0 */ public boolean adjustReferences(CDOReferenceAdjuster referenceAdjuster) { if (TRACER.isEnabled()) { TRACER.format("Adjusting references for revision {0}", this); } boolean changed = false; CDOID id1 = (CDOID) referenceAdjuster.adjustReference( resourceID, CDOContainerFeatureDelta.CONTAINER_FEATURE, CDOFeatureDelta.NO_INDEX); if (id1 != resourceID) { resourceID = id1; changed = true; } Object id2 = referenceAdjuster.adjustReference( containerID, CDOContainerFeatureDelta.CONTAINER_FEATURE, CDOFeatureDelta.NO_INDEX); if (id2 != containerID) { containerID = id2; changed = true; } EStructuralFeature[] features = getAllPersistentFeatures(); for (int i = 0; i < features.length; i++) { EStructuralFeature feature = features[i]; if (feature instanceof EReference || FeatureMapUtil.isFeatureMap(feature)) { if (feature.isMany()) { InternalCDOList list = (InternalCDOList) getValueAsList(i); if (list != null) { changed |= list.adjustReferences(referenceAdjuster, feature); } } else { CDOType type = CDOModelUtil.getType(feature); Object oldValue = getValue(i); Object newValue = type.adjustReferences(referenceAdjuster, oldValue, feature, CDOFeatureDelta.NO_INDEX); if (oldValue != newValue) // Just an optimization for NOOP adjusters { setValue(i, newValue); changed = true; } } } } return changed; }
public CDOLegacyWrapper(InternalEObject instance) { this.instance = instance; classInfo = (InternalCDOClassInfo) CDOModelUtil.getClassInfo(instance.eClass()); viewAndState = ViewAndState.TRANSIENT; }