afv-library/skills/apex-class/templates/service.cls
Mohan Raj Rajamanickam 2320c50264
ci: publish skills as @salesforce/afv-skills npm package @W-21534193@ (#30)
* ci: update package details and add GitHub workflows for skills validation and release

* chore: update Node version, change license, and refactor skills validation script to TypeScript

* chore: remove unused deps

* fix: npm package

* fix: flatten skills to pass validation

* chore: add validation script to package.json and update GitHub workflow to use it

* chore: enhance skills validation and update workflows for npm publishing

* refactor: streamline skills validation process in workflow and script

* refactor: improve documentation and structure of skills validation script

* implement checks based on jeff's best practices doc

* chore: add pull request template for skill submissions

* chore: update pull request template with additional references and improve automated checks section

* chore: update pull request template to clarify naming convention with a warning for gerund form

* chore: update pull request template to reference skill authoring guide and enhance checklist structure

* chore: enhance GitHub workflows for skills validation and release process

* refactor: improve parsing logic for SKILL.md files and enhance error collection in validation

* chore: update validation checks to enforce character limits for skill names and descriptions

* fix: remove unnecessary whitespace in footer string in validate-skills.ts
2026-03-12 13:41:52 -07:00

70 lines
2.9 KiB
OpenEdge ABL

/**
* @description Service class for {SObject} business logic.
* Follows separation of concerns: delegates queries to {SObject}Selector
* and SObject manipulation to {SObject}Domain where applicable.
* @author Generated by Apex Class Writer Skill
*/
public with sharing class {SObject}Service {
// Constants
private static final String ERROR_NULL_INPUT = 'Input cannot be null or empty.';
// Public API
/**
* @description {Describe the primary operation}
* @param recordIds Set of {SObject} Ids to process
* @return List of processed {SObject} records
* @throws {SObject}ServiceException if processing fails
* @example
* Set<Id> ids = new Set<Id>{ '001xx000003DGbY' };
* List<{SObject}> results = {SObject}Service.process{SObject}s(ids);
*/
public static List<{SObject}> process{SObject}s(Set<Id> recordIds) {
// Guard clause
if (recordIds == null || recordIds.isEmpty()) {
throw new {SObject}ServiceException(ERROR_NULL_INPUT);
}
// Query via Selector
List<{SObject}> records = {SObject}Selector.selectByIds(recordIds);
// Apply business logic
// TODO: Implement business logic here
// DML
try {
update records;
} catch (DmlException e) {
throw new {SObject}ServiceException(
'Failed to update {SObject} records: ' + e.getMessage()
);
}
return records;
}
// Convenience Overloads
/**
* @description Single-record convenience overload
* @param recordId The {SObject} Id to process
* @return The processed {SObject} record
*/
public static {SObject} process{SObject}(Id recordId) {
List<{SObject}> results = process{SObject}s(new Set<Id>{ recordId });
return results.isEmpty() ? null : results[0];
}
// Private Helpers
// TODO: Add private helper methods as needed
// Exception
/**
* @description Custom exception for {SObject}Service errors
*/
public class {SObject}ServiceException extends Exception {}
}