import org.argeo.api.acr.Content;
import org.argeo.api.acr.ContentName;
+import org.argeo.api.acr.CrAttributeType;
import org.argeo.api.acr.CrName;
import org.argeo.api.acr.spi.ProvidedContent;
import org.argeo.api.acr.spi.ProvidedSession;
if (isLocalRoot()) {// root
String mountPath = provider.getMountPath();
if (mountPath != null) {
- if (ContentUtils.ROOT_SLASH.equals(mountPath)) {
+ if (Content.ROOT_PATH.equals(mountPath)) {
return CrName.root.qName();
}
Content mountPoint = getSession().getMountPoint(mountPath);
return result;
}
- @SuppressWarnings("unchecked")
+// @SuppressWarnings("unchecked")
@Override
public <A> Optional<A> get(QName key, Class<A> clss) {
String namespaceUriOrNull = XMLConstants.NULL_NS_URI.equals(key.getNamespaceURI()) ? null
: key.getNamespaceURI();
if (element.hasAttributeNS(namespaceUriOrNull, key.getLocalPart())) {
String value = element.getAttributeNS(namespaceUriOrNull, key.getLocalPart());
- if (clss.isAssignableFrom(String.class))
- return Optional.of((A) value);
- else
- return Optional.empty();
+// if (isDefaultAttrTypeRequested(clss))
+// return Optional.of((A) CrAttributeType.parse(value));
+ return CrAttributeType.cast(clss, value);
} else
return Optional.empty();
}
String mountPath = provider.getMountPath();
if (mountPath == null)
return null;
- if (ContentUtils.ROOT_SLASH.equals(mountPath)) {
+ if (Content.ROOT_PATH.equals(mountPath)) {
return null;
}
String[] parent = ContentUtils.getParentPath(mountPath);
List<QName> res = new ArrayList<>();
if (isLocalRoot()) {
String mountPath = provider.getMountPath();
- if (ContentUtils.SLASH_STRING.equals(mountPath)) {// repository root
+ if (Content.ROOT_PATH.equals(mountPath)) {// repository root
res.add(CrName.root.qName());
} else {
Content mountPoint = getSession().getMountPoint(mountPath);
public void addContentClasses(QName... contentClass) {
if (isLocalRoot()) {
String mountPath = provider.getMountPath();
- if (ContentUtils.SLASH_STRING.equals(mountPath)) {// repository root
+ if (Content.ROOT_PATH.equals(mountPath)) {// repository root
throw new IllegalArgumentException("Cannot add content classes to repository root");
} else {
Content mountPoint = getSession().getMountPoint(mountPath);