use of com.qcadoo.model.api.types.JoinFieldHolder in project qcadoo by qcadoo.
the class DataAccessServiceImpl method performCascadeNullification.
private EntityOpResult performCascadeNullification(final InternalDataDefinition childDataDefinition, final Collection<Entity> children, final Entity entity, final FieldType fieldType) {
String joinFieldName = ((JoinFieldHolder) fieldType).getJoinFieldName();
for (Entity child : children) {
child.setField(joinFieldName, null);
child = save(childDataDefinition, child);
if (!child.isValid()) {
String msg = String.format("Can not nullify field '%s' in %s because of following validation errors:", joinFieldName, child);
logEntityErrors(child, msg);
EntityMessagesHolder msgHolder = new EntityMessagesHolderImpl(child);
msgHolder.addGlobalError("qcadooView.errorPage.error.dataIntegrityViolationException.objectInUse.explanation");
return EntityOpResult.failure(msgHolder);
}
}
return EntityOpResult.successfull();
}
use of com.qcadoo.model.api.types.JoinFieldHolder in project qcadoo by qcadoo.
the class LookupComponentPattern method getComponentStateInstance.
@Override
public ComponentState getComponentStateInstance() {
if (getScopeFieldDefinition() == null) {
return new LookupComponentState(null, fieldCode, expression, this);
}
String joinFieldName = null;
if (getScopeFieldDefinition().getType() instanceof JoinFieldHolder) {
joinFieldName = ((JoinFieldHolder) getScopeFieldDefinition().getType()).getJoinFieldName();
}
FieldDefinition fieldDefinition = getDataDefinition().getField(joinFieldName);
return new LookupComponentState(fieldDefinition, fieldCode, expression, this);
}
Aggregations