import PT_RCF:ServiceInterface;
import SV_EVENT_MAPPING_PKG:Utils:PSQueryAsFavorites;

class AddMyFavQueries implements PT_RCF:ServiceInterface
   method execute();
end-class;

Declare Function PortalOpen PeopleCode FUNCLIB_PORTAL.PORTAL_GEN_FUNC FieldFormula;
Declare Function AppendContentArea PeopleCode SV_NUI_NB_REC.PTNUI_NB_ACTION FieldFormula;

method execute
   /+ Extends/implements PT_RCF:ServiceInterface.execute +/
   
   Local string &qryFavExists = "";
   SQLExec("select 'X' from %table(:1) where oprid = :2", Record.PSQRYFAVORITES, %OperatorId, &qryFavExists);
   
   If All(&qryFavExists) Then
      
      Local SV_EVENT_MAPPING_PKG:Utils:PSQueryAsFavorites &nbcc = create SV_EVENT_MAPPING_PKG:Utils:PSQueryAsFavorites();
      Local ApiObject &portal = PortalOpen();
      
      AppendContentArea(&portal, &nbcc);
      
   End-If;
   
end-method;