protected static void clearDirtyFlags(Property property) { if (property.isContainer()) { for (Property p : property) { clearDirtyFlags(p); } } property.clearDirtyFlags(); }
protected Blob getValueBlob(T state) throws PropertyException { BlobInfo blobInfo = getBlobInfo(state); DocumentBlobManager blobManager = Framework.getService(DocumentBlobManager.class); try { return blobManager.readBlob(blobInfo, getRepositoryName()); } catch (IOException e) { throw new BlobNotFoundException("Unable to find blob with key: " + blobInfo.key, e); } }
@Override public Lock getLock() { try { return getSession().getLockManager().getLock(getUUID()); } catch (DocumentNotFoundException e) { return getDocumentLock(); } }
/** * Visits all the blobs of this document and calls the passed blob visitor on each one. */ protected void visitBlobs(T state, Consumer<BlobAccessor> blobVisitor, Runnable markDirty) throws PropertyException { Visit visit = new Visit(blobVisitor, markDirty); // structural type visit.visitBlobsComplex(state, getType()); // dynamic facets SchemaManager schemaManager = Framework.getService(SchemaManager.class); for (String facet : getFacets()) { CompositeType facetType = schemaManager.getFacet(facet); if (facetType != null) { // if not obsolete facet visit.visitBlobsComplex(state, facetType); } } // proxy schemas if (getProxySchemas() != null) { for (Schema schema : getProxySchemas()) { visit.visitBlobsComplex(state, schema); } } }
xpath = canonicalXPath(xpath); String[] segments = xpath.split("/"); ComplexType parentType = getType(); for (int i = 0; i < segments.length; i++) { String segment = segments[i]; for (String facet : getFacets()) { CompositeType facetType = schemaManager.getFacet(facet); field = facetType.getField(segment); if (field == null && i == 0 && getProxySchemas() != null) { for (Schema schema : getProxySchemas()) { field = schema.getField(segment); if (field != null) { List<T> list = state == null ? Collections.emptyList() : getChildAsList(state, name); if (index >= list.size()) { throw new PropertyNotFoundException(xpath, "Index out of bounds: " + index); return getValueComplex(state, parentType); } else { return state == null ? null : getValueField(state, field); } else { state = state == null ? null : getChild(state, name, type);
xpath = canonicalXPath(xpath); String[] segments = xpath.split("/"); ComplexType parentType = getType(); for (int i = 0; i < segments.length; i++) { String segment = segments[i]; for (String facet : getFacets()) { CompositeType facetType = schemaManager.getFacet(facet); field = facetType.getField(segment); if (field == null && i == 0 && getProxySchemas() != null) { for (Schema schema : getProxySchemas()) { field = schema.getField(segment); if (field != null) { List<T> list = getChildAsList(state, name); if (index >= list.size()) { throw new PropertyNotFoundException(xpath, "Index out of bounds: " + index); setValueComplex(state, field, xpath, value); } else { setValueField(state, field, xpath, value); } else { state = getChildForWrite(state, name, type); parentType = (ComplexType) type;
Blob blob = getValueBlob(state); complexProperty.init((Serializable) blob); return; name = internalName(name); Type type = property.getType(); if (type.isSimpleType()) { } else if (type.isComplexType()) { T childState = getChild(state, name, type); readComplexProperty(childState, (ComplexProperty) property); ((ComplexProperty) property).removePhantomFlag(); } else { array = typedArray(listType.getFieldType(), array); property.init(array); } else { List<T> childStates = getChildAsList(state, name); ComplexProperty p = (ComplexProperty) complexProperty.getRoot().createProperty(property, listField, 0); readComplexProperty(childState, p); list.add(p.getValue());
name = internalName(name); if (checkReadOnlyIgnoredWrite(property, state)) { continue; } else if (type.isComplexType()) { T childState = getChildForWrite(state, name, type); writeComplexProperty(childState, (ComplexProperty) property, xp, writeAll, writeContext); } else { ListType listType = (ListType) type; List<T> childStates = updateList(state, name, property); String xpi = xp + '/' + i; boolean moved = childProperty.isMoved(); boolean c = writeComplexProperty(childState, (ComplexProperty) childProperty, xpi, writeAll || moved, writeContext); if (c) {
protected Object getValueField(T state, Field field) throws PropertyException { Type type = field.getType(); String name = field.getName().getPrefixedName(); name = internalName(name); if (type.isSimpleType()) { } else if (type.isComplexType()) { T childState = getChild(state, name, type); if (childState == null) { return null; return getValueComplex(childState, (ComplexType) type); } else { } else { List<T> childStates = getChildAsList(state, name); List<Object> list = new ArrayList<>(childStates.size()); for (T childState : childStates) { Object value = getValueComplex(childState, (ComplexType) fieldType); list.add(value);
protected void setValueField(T state, Field field, String xpath, Object value) throws PropertyException { Type type = field.getType(); name = internalName(name); } else if (type.isComplexType()) { T childState = getChildForWrite(state, name, type); setValueComplex(childState, field, xpath, value); } else { updateList(state, name, listType.getField(), xpath, values);