Re: D2W to many deny delete
Re: D2W to many deny delete
- Subject: Re: D2W to many deny delete
- From: Theodore Petrosky <email@hidden>
- Date: Sat, 23 Feb 2019 17:55:30 -0500
Thank you. This will work. I will just document that if the delete button is
greyed out, then you can’t delete the person for the obvious reason.
Ted
> On Feb 21, 2019, at 8:21 AM, Fabian Peters <email@hidden> wrote:
>
> Hi Ted,
>
> There's no validation exception handling on the list pages. To work around
> this, you can implement something like this on the EO:
>
> @Override
> public boolean canDelete() {
> boolean canDelete = super.canDelete();
> if (studentCount() > 0) {
> canDelete = false;
> } else if
> (ERXEOControlUtilities.objectCountWithQualifier(editingContext(),
> Course.ENTITY_NAME, Course.PREVIOUS_COURSE.eq(this)) > 0) {
> canDelete = false;
> }
> return canDelete;
> }
>
> If the method returns false, the button will be deactivated. Still, the user
> has no way of knowing why the object cannot be deleted…
>
> Fabian
>
>
>> Am 15.02.2019 um 18:43 schrieb Theodore Petrosky <email@hidden>:
>>
>> I have a small d2w project.
>>
>> Person has a to-many relationship to DocuentScan. In my Person entity I see
>> the documentScans relation. I set the Delete Rule to deny. So if I try to
>> delete a person, and there are Document Scans attached, the transaction will
>> be aborted and there will be an error message.
>>
>> OK, so user ‘Ted' has some documentScans attached. I click to delete the
>> user and I get the normal confirmation box. I click the delete to confirm
>> and instead of returning me to the previous screen with a warning, I get an
>> error in Eclipse. here is the top few lines:
>>
>> WARN NSLog - <er.ajax.AjaxRequestHandler>: Exception occurred while
>> handling request:
>> <er.extensions.validation.ERXValidationException object:
>> <com.as.Model.Person pk:"1">; propertyKey: documentScans; type:
>> ObjectsRemovalException; additionalExceptions: ()>
>> [2019-2-15 12:21:5 EST] <WorkerThread7>
>> <er.extensions.validation.ERXValidationException object:
>> <com.as.Model.Person pk:"1">; propertyKey: documentScans; type:
>> ObjectsRemovalException; additionalExceptions: ()>
>> at
>> com.webobjects.eoaccess.EOEntity.validateObjectForDelete(EOEntity.java:4190)
>> at
>> com.webobjects.eoaccess.EOEntityClassDescription.validateObjectForDelete(EOEntityClassDescription.java:521)
>> at
>> er.extensions.eof.ERXEntityClassDescription.validateObjectForDelete(ERXEntityClassDescription.java:700)
>> at
>> com.webobjects.eocontrol.EOCustomObject.validateForDelete(EOCustomObject.java:1419)
>> at
>> com.webobjects.eocontrol.EOEditingContext.validateTable(EOEditingContext.java:2274)
>>
>> and this is the top of my browswer:
>>
>> Application: AS_Document_Safe
>> Error: <er.extensions.validation.ERXValidationException object:
>> <com.as.Model.Person pk:"1">; propertyKey: documentScans; type:
>> ObjectsRemovalException; additionalExceptions: ()>
>> Reason: Cannot delete this <b>Person</b>. You should first delete the
>> items in its <b>Document Scans</b>.
>> OK, Am I missing some rule somewhere?
>>
>> Since I was looking at a ListPerson page, I expected the ‘Reason’ to be at
>> the top of the table.
>>
>> Anyone have any solution here?
>>
>> Ted
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden