/** * Nulls the relationship or attribute and checks update permissions. * Invokes the set[fieldName] method on the target object OR set the field with the corresponding name. * @param fieldName the field name to set or invoke equivalent set method * @param oldValue the old value */ protected void nullValue(String fieldName, PersistentResource oldValue) { if (oldValue == null) { return; } String inverseField = getInverseRelationField(fieldName); if (!inverseField.isEmpty()) { oldValue.checkFieldAwareDeferPermissions(UpdatePermission.class, inverseField, null, getObject()); } this.setValueChecked(fieldName, null); }
/** * Nulls the relationship or attribute and checks update permissions. * Invokes the set[fieldName] method on the target object OR set the field with the corresponding name. * @param fieldName the field name to set or invoke equivalent set method * @param oldValue the old value */ protected void nullValue(String fieldName, PersistentResource oldValue) { if (oldValue == null) { return; } String inverseField = getInverseRelationField(fieldName); if (!inverseField.isEmpty()) { oldValue.checkFieldAwareDeferPermissions(UpdatePermission.class, inverseField, null, getObject()); } this.setValueChecked(fieldName, null); }
inverseResource.addToCollection((Collection) inverseRelation, inverseName, this); } else { inverseResource.setValueChecked(inverseName, Collections.singleton(this.getObject())); inverseResource.setValueChecked(inverseName, this.getObject()); } else { throw new InternalServerErrorException("Relationship type mismatch");
inverseResource.addToCollection((Collection) inverseRelation, inverseName, this); } else { inverseResource.setValueChecked(inverseName, Collections.singleton(this.getObject())); inverseResource.setValueChecked(inverseName, this.getObject()); } else { throw new InternalServerErrorException("Relationship type mismatch");
this.setValueChecked(fieldName, newValue);
Object value = getValueUnchecked(collectionName); if (!Objects.equals(value, toAdd.getObject())) { this.setValueChecked(collectionName, collection); return true;
/** * Update attribute in existing resource. * * @param fieldName the field name * @param newVal the new val * @return true if object updated, false otherwise */ public boolean updateAttribute(String fieldName, Object newVal) { Class<?> fieldClass = dictionary.getType(getResourceClass(), fieldName); newVal = coerce(newVal, fieldName, fieldClass); Object val = getValueUnchecked(fieldName); checkFieldAwareDeferPermissions(UpdatePermission.class, fieldName, newVal, val); if (!Objects.equals(val, newVal)) { this.setValueChecked(fieldName, newVal); this.markDirty(); //Hooks for customize logic for setAttribute/Relation if (dictionary.isAttribute(obj.getClass(), fieldName)) { transaction.setAttribute(obj, fieldName, newVal, requestScope); } return true; } return false; }
/** * Update attribute in existing resource. * * @param fieldName the field name * @param newVal the new val * @return true if object updated, false otherwise */ public boolean updateAttribute(String fieldName, Object newVal) { Class<?> fieldClass = dictionary.getType(getResourceClass(), fieldName); newVal = coerce(newVal, fieldName, fieldClass); Object val = getValueUnchecked(fieldName); checkFieldAwareDeferPermissions(UpdatePermission.class, fieldName, newVal, val); if (!Objects.equals(val, newVal)) { this.setValueChecked(fieldName, newVal); this.markDirty(); //Hooks for customize logic for setAttribute/Relation if (dictionary.isAttribute(obj.getClass(), fieldName)) { transaction.setAttribute(obj, fieldName, newVal, requestScope); } return true; } return false; }
Object value = getValueUnchecked(collectionName); if (!Objects.equals(value, toAdd.getObject())) { this.setValueChecked(collectionName, collection); return true;
this.setValueChecked(fieldName, newValue);