Im trying to re-create a class with new namespaces and a new name to the class. In the process i'm getting the save error "New protected methods cannot be defined in non-virtual classes" please find the below method. What's the fix for this ?
protected virtual List<grc__Risk__c> getRisks()
{
String queryString = '';
Set<Id> selectedBUs = selectedBusinessUnits();
Set<String> riskStatus = new Set<String>{'Active','Emerging'};
queryString += 'SELECT Id, Name, Owner.Name, grc__Description__c, Risk_Template__r.Name, Control_Effectiveness__c, Control_Effectiveness_Rating__c, grc__Business_Unit__c, grc__Business_Unit__r.Name, ' +
'grc__Category__c, grc__Impact__c, Inherent_Rating_Lookup__r.Colour__c, Residual_Rating_Lookup__r.Colour__c, grc__Risk_No_Value__c, ' +
'grc__Risk_Owner__r.Name, grc__Next_Review_Date__c, grc__Ranking__c, grc__Risk_Appetite_Statement__c, ' +
'Inherent_Score__c, Inherent_Impact_Text__c, Inherent_Likelihood_Text__c, Inherent_Rating__c, ' +
'Residual_Score__c, Residual_Impact_Text__c, Residual_Likelihood_Text__c, Residual_Rating__c, ' +
'Target_Score__c, Target_Impact_Text__c, Target_Likelihood_Text__c, Target_Rating__c, grc__Risk_Name__c, ' +
'(SELECT Name FROM Actions__r order by Name), ' +
'(SELECT Title, Body FROM Notes WHERE IsPrivate = false), ' +
'(SELECT Cause__r.Name FROM Cause_Risk_Lookup__r order by Cause__r.Name), ' +
'(SELECT Control__r.Name, Control__r.grc__Description__c, Is_Key_Control__c FROM Risk_Control_Lookup__r WHERE Is_Key_Control__c = true order by Control__r.Name) ' +
'FROM grc__Risk__c ' +
'WHERE grc__Business_Unit__c IN :selectedBUs ' +
'AND grc__Status__c IN :riskStatus ' +
'AND grc__Category__c IN :categories ';
if(filterKeyRisks == true)
{
queryString += 'AND grc__Key_Risk__c =:filterKeyRisks ';
}
if(rankRisks == true)
{
queryString += 'AND grc__Ranking__c != 0 and grc__Ranking__c != null ';
}
queryString += 'order by ';
if(rankRisks == true)
{
queryString += 'grc__Ranking__c, ';
}
queryString += 'grc__Business_Unit__r.Name, grc__Category__c';
return new List<grc__Risk__c>((List<grc__Risk__c>)Database.query(queryString));
}