protected boolean attrModifyPermitted(MetaClass metaClass, String property) { return attrPermitted(metaClass, property, EntityAttrAccess.MODIFY); }
@Override public String process(Entity entity, MetaClass metaclass, View view) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { Element root = newDocument(ROOT_ELEMENT_INSTANCE); encodeEntityInstance(new HashSet<Entity>(), entity, root, false, metaclass, view); Document doc = root.getOwnerDocument(); return documentToString(doc); }
protected boolean readPermitted(MetaClass metaClass) { return entityOpPermitted(metaClass, EntityOp.READ); }
for (int i = 0; i < fields.getLength(); i++) { Node fieldNode = fields.item(i); String fieldName = getFieldName(fieldNode); MetaProperty property = metaClass.getProperty(fieldName); if (!attrModifyPermitted(metaClass, property.getName())) continue; if (isNullValue(fieldNode)) { setNullField(bean, fieldName); continue; setField(bean, fieldName, value); break; case ENUM: value = property.getRange().asEnumeration().parse(xmlValue); setField(bean, fieldName, value); break; case COMPOSITION: case ASSOCIATION: { if ("null".equals(xmlValue)) { setField(bean, fieldName, null); break; MetaClass propertyMetaClass = propertyMetaClass(property); if (!updatePermitted(propertyMetaClass) && !readPermitted(propertyMetaClass)) break;
boolean isRef, MetaClass metaClass, View view) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { if (!readPermitted(metaClass)) return null; return encodeRef(parent, entity); return encodeRef(parent, entity); root.setAttribute(ATTR_ID, ior(entity)); if (!attrViewPermitted(metaClass, property.getName())) continue; if (!isPropertyIncluded(view, property, metadataTools)){ continue; child.setAttribute(ATTR_NAME, property.getName()); if (value == null) { encodeNull(child); } else { String str = property.getRange().asDatatype().format(value); encodeBasic(child, str, property.getJavaType()); child.setAttribute(ATTR_NAME, property.getName()); if (value == null) { encodeNull(child); } else {
@Override public String process(Set<Entity> entities) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { Element root = newDocument(MAPPING_ROOT_ELEMENT_INSTANCE); Document doc = root.getOwnerDocument(); for (Entity entity : entities) { Element pair = doc.createElement(PAIR_ELEMENT); root.appendChild(pair); encodeEntityInstance(new HashSet<Entity>(), entity, pair, false, getMetaClass(entity), null); encodeEntityInstance(new HashSet<Entity>(), entity, pair, false, getMetaClass(entity), null); } return documentToString(doc); }
private String getIdAttribute(Node node) { return getAttributeValue(node, ATTR_ID); }
private String getFieldName(Node fieldNode) { return getAttributeValue(fieldNode, ATTR_NAME); }
@Override public String process(List<Entity> entities, MetaClass metaClass, View view) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { Element root = newDocument(ROOT_ELEMENT_INSTANCE); for (Entity entity : entities) { encodeEntityInstance(new HashSet<Entity>(), entity, root, false, metaClass, view); } Document doc = root.getOwnerDocument(); return documentToString(doc); }
protected boolean attrViewPermitted(MetaClass metaClass, String property) { return attrPermitted(metaClass, property, EntityAttrAccess.VIEW); }
protected boolean updatePermitted(MetaClass metaClass) { return entityOpPermitted(metaClass, EntityOp.UPDATE); }