Search in sources :

Example 1 with Param

use of org.jaffa.soa.services.configdomain.Param in project jaffa-framework by jaffa-projects.

the class SOAEventParam method validate.

// .//GEN-END:performPreDeleteReferentialIntegrity_1_be
// .//GEN-BEGIN:3_be
/**
 * @clientCardinality 0..*
 * @supplierCardinality 1
 * @clientQualifier eventId
 * @supplierQualifier eventId
 * @link association
 */
/*#SOAEvent lnkSOAEvent;*/
// .//GEN-END:3_be
// All the custom code goes here//GEN-FIRST:custom
/**
 * {@inheritDoc}
 */
@Override
public void validate() throws ApplicationExceptions, FrameworkException {
    // Ensure that the eventId is specified
    if (getEventId() == null)
        throw new ApplicationExceptions(new MandatoryFieldException(SOAEventParamMeta.META_EVENT_ID.getLabelToken()));
    // Log a WARNing message if the paramter is not documented in soa-events.xml
    if (getName() != null && isModified(SOAEventParamMeta.NAME)) {
        try {
            SOAEvent soaEvent = getSOAEventObject();
            SoaEventInfo soaEventInfo = ConfigurationService.getInstance().getSoaEventInfo(soaEvent.getEventName());
            if (soaEventInfo != null) {
                boolean foundParam = false;
                for (Param param : soaEventInfo.getParam()) {
                    if (getName().equals(param.getName())) {
                        foundParam = true;
                        break;
                    }
                }
                if (!foundParam)
                    log.warn("SOA Event Parameter'" + soaEvent.getEventName() + ": " + getName() + "' should be documented in soa-events.xml");
            }
        } catch (ValidationException e) {
            throw new ApplicationExceptions(e);
        }
    }
    super.validate();
}
Also used : SoaEventInfo(org.jaffa.soa.services.configdomain.SoaEventInfo) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) MandatoryFieldException(org.jaffa.datatypes.exceptions.MandatoryFieldException) Param(org.jaffa.soa.services.configdomain.Param) SOAEvent(org.jaffa.soa.domain.SOAEvent)

Example 2 with Param

use of org.jaffa.soa.services.configdomain.Param in project jaffa-framework by jaffa-projects.

the class SOAEventMetaDataService method getParams.

private String getParams(SoaEventInfo soaEvent) {
    List<Param> params = soaEvent.getParam();
    if (log.isDebugEnabled()) {
        log.debug("params size:" + params);
    }
    JSON json = JSONSerializer.toJSON(params);
    if (log.isDebugEnabled()) {
        log.debug("json:" + json.toString());
    }
    return json.toString();
}
Also used : Param(org.jaffa.soa.services.configdomain.Param) JSON(net.sf.json.JSON)

Aggregations

Param (org.jaffa.soa.services.configdomain.Param)2 JSON (net.sf.json.JSON)1 MandatoryFieldException (org.jaffa.datatypes.exceptions.MandatoryFieldException)1 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)1 SOAEvent (org.jaffa.soa.domain.SOAEvent)1 SoaEventInfo (org.jaffa.soa.services.configdomain.SoaEventInfo)1