-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full support of per-request overlays in updating operations #639
* introducing RequestSchema for handling overlays within a single request
- Loading branch information
Showing
5 changed files
with
17 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 2 additions & 12 deletions
14
agrest-engine/src/main/java/io/agrest/runtime/processor/delete/stage/DeleteStartStage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
package io.agrest.runtime.processor.delete.stage; | ||
|
||
import io.agrest.meta.AgSchema; | ||
import io.agrest.meta.AgEntity; | ||
import io.agrest.meta.AgEntityOverlay; | ||
import io.agrest.processor.Processor; | ||
import io.agrest.processor.ProcessorOutcome; | ||
import io.agrest.runtime.processor.delete.DeleteContext; | ||
import org.apache.cayenne.di.Inject; | ||
|
||
/** | ||
* @since 5.0 | ||
*/ | ||
public class DeleteStartStage implements Processor<DeleteContext<?>> { | ||
|
||
private final AgSchema schema; | ||
|
||
public DeleteStartStage(@Inject AgSchema schema) { | ||
this.schema = schema; | ||
} | ||
|
||
@Override | ||
public ProcessorOutcome execute(DeleteContext<?> context) { | ||
initAgEntity(context); | ||
return ProcessorOutcome.CONTINUE; | ||
} | ||
|
||
protected <T> void initAgEntity(DeleteContext<T> context) { | ||
AgEntityOverlay<T> overlay = context.getEntityOverlay(); | ||
AgEntity<T> entity = schema.getEntity(context.getType()); | ||
context.setAgEntity(entity.resolveOverlay(schema, overlay)); | ||
AgEntity<T> entity = context.getSchema().getEntity(context.getType()); | ||
context.setAgEntity(entity); | ||
} | ||
} |