com.sap.cds.services.draft.DraftEditEventContext Maven / Gradle / Ivy
/**************************************************************************
* (C) 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
**************************************************************************/
package com.sap.cds.services.draft;
import java.util.Map;
import com.sap.cds.Result;
import com.sap.cds.ql.CdsName;
import com.sap.cds.ql.cqn.CqnSelect;
import com.sap.cds.services.EventContext;
import com.sap.cds.services.EventName;
/**
* The {@link EventContext} for the {@link DraftService#EVENT_DRAFT_EDIT} event.
*/
@EventName(DraftService.EVENT_DRAFT_EDIT)
public interface DraftEditEventContext extends EventContext {
public static final String PRESERVE_CHANGES = "PreserveChanges";
/**
* Creates an {@link EventContext} already overlayed with this interface. The event is set to be {@link DraftService#EVENT_DRAFT_EDIT}
* @param entityName the name of the entity
* @return the {@link DraftEditEventContext}
*/
static DraftEditEventContext create(String entityName) {
return EventContext.create(DraftEditEventContext.class, entityName);
}
@Override
DraftService getService();
// IN
/**
* @return the {@link CqnSelect} statement
*/
CqnSelect getCqn();
/**
* Sets the {@link CqnSelect} statement
* @param cqn the {@link CqnSelect} statement
*/
void setCqn(CqnSelect cqn);
/**
* Sets whether to preserve changes or not
* @param preserveChanges if {@code true} changes will be preserved
*/
@CdsName(PRESERVE_CHANGES)
void setPreserveChanges(boolean preserveChanges);
/**
* @return {@code true} if changes should be preserved, {@code false} otherwise
*/
@CdsName(PRESERVE_CHANGES)
Boolean getPreserveChanges();
/**
* The CQN named values, for parameterized {@link CqnSelect} statements
* @return the CQN named values
*/
Map getCqnNamedValues();
/**
* Sets the CQN named values, for parameterized {@link CqnSelect} statements
* @param namedValues the CQN named values
*/
void setCqnNamedValues(Map namedValues);
// OUT
/**
* @return the {@link Result} of the {@link DraftService#EVENT_DRAFT_EDIT} event
*/
Result getResult();
/**
* Sets the result of the {@link DraftService#EVENT_DRAFT_EDIT} event
* @param result a {@link Result} or a list of Maps, which will be transformed into a {@link Result}
*/
void setResult(Iterable extends Map> result);
}