/** * Create an instance of {@link BusinessObjectDataNotificationEventParamsDto } * */ public BusinessObjectDataNotificationEventParamsDto createBusinessObjectDataNotificationEventParamsDto() { return new BusinessObjectDataNotificationEventParamsDto(); }
@Override public String getIdentifyingInformation(NotificationEventParamsDto notificationEventParams, BusinessObjectDataHelper businessObjectDataHelper) { if (notificationEventParams instanceof BusinessObjectDataNotificationEventParamsDto) { BusinessObjectDataNotificationEventParamsDto businessObjectDataNotificationEventParams = (BusinessObjectDataNotificationEventParamsDto) notificationEventParams; return String.format("namespace: \"%s\", actionId: \"%s\" with " + businessObjectDataHelper.businessObjectDataKeyToString( businessObjectDataHelper.getBusinessObjectDataKey(businessObjectDataNotificationEventParams.getBusinessObjectData())) + ", storageName: \"%s\"", businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getNamespace().getCode(), businessObjectDataNotificationEventParams.getNotificationJobAction().getId(), businessObjectDataNotificationEventParams.getStorageName()); } else { throw new IllegalStateException( "Notification event parameters DTO passed to the method must be an instance of BusinessObjectDataNotificationEventParamsDto."); } }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); super.copyTo(locator, draftCopy, strategy); if (draftCopy instanceof BusinessObjectDataNotificationEventParamsDto) { if (businessObjectDataNotificationRegistrationShouldBeCopiedAndSet == Boolean.TRUE) { BusinessObjectDataNotificationRegistrationEntity sourceBusinessObjectDataNotificationRegistration; sourceBusinessObjectDataNotificationRegistration = this.getBusinessObjectDataNotificationRegistration(); BusinessObjectDataNotificationRegistrationEntity copyBusinessObjectDataNotificationRegistration = ((BusinessObjectDataNotificationRegistrationEntity) strategy.copy(LocatorUtils.property(locator, "businessObjectDataNotificationRegistration", sourceBusinessObjectDataNotificationRegistration), sourceBusinessObjectDataNotificationRegistration, (this.businessObjectDataNotificationRegistration!= null))); copy.setBusinessObjectDataNotificationRegistration(copyBusinessObjectDataNotificationRegistration); } else { if (businessObjectDataNotificationRegistrationShouldBeCopiedAndSet == Boolean.FALSE) { if (notificationJobActionShouldBeCopiedAndSet == Boolean.TRUE) { NotificationJobActionEntity sourceNotificationJobAction; sourceNotificationJobAction = this.getNotificationJobAction(); NotificationJobActionEntity copyNotificationJobAction = ((NotificationJobActionEntity) strategy.copy(LocatorUtils.property(locator, "notificationJobAction", sourceNotificationJobAction), sourceNotificationJobAction, (this.notificationJobAction!= null))); copy.setNotificationJobAction(copyNotificationJobAction); } else { if (notificationJobActionShouldBeCopiedAndSet == Boolean.FALSE) { if (eventTypeShouldBeCopiedAndSet == Boolean.TRUE) { String sourceEventType; sourceEventType = this.getEventType(); String copyEventType = ((String) strategy.copy(LocatorUtils.property(locator, "eventType", sourceEventType), sourceEventType, (this.eventType!= null))); copy.setEventType(copyEventType); } else { if (eventTypeShouldBeCopiedAndSet == Boolean.FALSE) { if (businessObjectDataShouldBeCopiedAndSet == Boolean.TRUE) {
theBusinessObjectDataNotificationRegistration = this.getBusinessObjectDataNotificationRegistration(); strategy.appendField(locator, this, "businessObjectDataNotificationRegistration", buffer, theBusinessObjectDataNotificationRegistration, (this.businessObjectDataNotificationRegistration!= null)); theNotificationJobAction = this.getNotificationJobAction(); strategy.appendField(locator, this, "notificationJobAction", buffer, theNotificationJobAction, (this.notificationJobAction!= null)); theEventType = this.getEventType(); strategy.appendField(locator, this, "eventType", buffer, theEventType, (this.eventType!= null)); theBusinessObjectData = this.getBusinessObjectData(); strategy.appendField(locator, this, "businessObjectData", buffer, theBusinessObjectData, (this.businessObjectData!= null)); thePartitionColumnNames = (((this.partitionColumnNames!= null)&&(!this.partitionColumnNames.isEmpty()))?this.getPartitionColumnNames():null); strategy.appendField(locator, this, "partitionColumnNames", buffer, thePartitionColumnNames, ((this.partitionColumnNames!= null)&&(!this.partitionColumnNames.isEmpty()))); thePartitionValues = (((this.partitionValues!= null)&&(!this.partitionValues.isEmpty()))?this.getPartitionValues():null); strategy.appendField(locator, this, "partitionValues", buffer, thePartitionValues, ((this.partitionValues!= null)&&(!this.partitionValues.isEmpty()))); theStorageName = this.getStorageName(); strategy.appendField(locator, this, "storageName", buffer, theStorageName, (this.storageName!= null)); theNewBusinessObjectDataStatus = this.getNewBusinessObjectDataStatus(); strategy.appendField(locator, this, "newBusinessObjectDataStatus", buffer, theNewBusinessObjectDataStatus, (this.newBusinessObjectDataStatus!= null)); theOldBusinessObjectDataStatus = this.getOldBusinessObjectDataStatus(); strategy.appendField(locator, this, "oldBusinessObjectDataStatus", buffer, theOldBusinessObjectDataStatus, (this.oldBusinessObjectDataStatus!= null));
BusinessObjectDataNotificationEventParamsDto notificationEventParams = new BusinessObjectDataNotificationEventParamsDto(); notificationEventParams.setBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistration); notificationEventParams.setNotificationJobAction(notificationJobActionEntity); notificationEventParams.setEventType(notificationEventType); notificationEventParams.setBusinessObjectData(businessObjectData); notificationEventParams.setPartitionColumnNames(partitionColumnNames); notificationEventParams.setStorageName(businessObjectDataNotificationRegistration.getStorage() == null ? null : businessObjectDataNotificationRegistration.getStorage().getName()); notificationEventParams.setPartitionValues(partitionValues); notificationEventParams.setNewBusinessObjectDataStatus(newBusinessObjectDataStatus); notificationEventParams.setOldBusinessObjectDataStatus(oldBusinessObjectDataStatus);
BusinessObjectDataNotificationEventParamsDto businessObjectDataNotificationEventParams = new BusinessObjectDataNotificationEventParamsDto(); businessObjectDataNotificationEventParams.setBusinessObjectData(businessObjectDataHelper.createBusinessObjectDataFromEntity(businessObjectDataEntity)); businessObjectDataNotificationEventParams.setBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistrationEntity); businessObjectDataNotificationEventParams.setEventType(NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_RGSTN.name()); businessObjectDataNotificationEventParams .setNotificationJobAction((NotificationJobActionEntity) businessObjectDataNotificationRegistrationEntity.getNotificationActions().toArray()[0]); businessObjectDataNotificationEventParams.setStorageName(STORAGE_NAME);
JobCreateRequest request = new JobCreateRequest(); JobDefinitionEntity jobDefinitionEntity = businessObjectDataNotificationEventParams.getNotificationJobAction().getJobDefinition(); businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration(); LOGGER.info("Starting a job due to a notification. notificationRegistrationKey={} jobCreateRequest={}", jsonHelper.objectToJson(notificationRegistrationHelper.getNotificationRegistrationKey(businessObjectDataNotificationRegistration)),
private List<Parameter> buildJobParameters(BusinessObjectDataNotificationEventParamsDto businessObjectDataNotificationEventParams) throws IOException { List<Parameter> parameters = new ArrayList<>(); BusinessObjectData businessObjectData = businessObjectDataNotificationEventParams.getBusinessObjectData(); NotificationJobActionEntity notificationJobActionEntity = businessObjectDataNotificationEventParams.getNotificationJobAction(); parameters.add( new Parameter(PARAM_NAMESPACE, businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getNamespace().getCode())); parameters .add(new Parameter(PARAM_NOTIFICATION_NAME, businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getName())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_EVENT_TYPE, businessObjectDataNotificationEventParams.getEventType())); parameters.add(new Parameter(PARAM_CORRELATION_DATA, notificationJobActionEntity.getCorrelationData())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA, jsonHelper.objectToJson(businessObjectData))); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAMESPACE, businessObjectData.getNamespace())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAME, businessObjectData.getBusinessObjectDefinitionName())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_USAGE, businessObjectData.getBusinessObjectFormatUsage())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_FILE_TYPE, businessObjectData.getBusinessObjectFormatFileType())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_VERSION, Integer.toString(businessObjectData.getBusinessObjectFormatVersion()))); parameters.add(new Parameter(PARAM_PARTITION_COLUMN_NAMES, herdStringHelper.buildStringWithDefaultDelimiter(businessObjectDataNotificationEventParams.getPartitionColumnNames()))); parameters.add(new Parameter(PARAM_PARTITION_VALUES, herdStringHelper.buildStringWithDefaultDelimiter(businessObjectDataNotificationEventParams.getPartitionValues()))); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_VERSION, Integer.toString(businessObjectData.getVersion()))); parameters.add(new Parameter(PARAM_NEW_BUSINESS_OBJECT_DATA_STATUS, businessObjectDataNotificationEventParams.getNewBusinessObjectDataStatus())); parameters.add(new Parameter(PARAM_OLD_BUSINESS_OBJECT_DATA_STATUS, businessObjectDataNotificationEventParams.getOldBusinessObjectDataStatus())); return parameters; } }
BusinessObjectDataNotificationEventParamsDto notificationEventParams = new BusinessObjectDataNotificationEventParamsDto(); notificationEventParams.setBusinessObjectDataNotificationRegistration(businessObjectDataNotificationRegistration); notificationEventParams.setNotificationJobAction(notificationJobActionEntity); notificationEventParams.setEventType(notificationEventType); notificationEventParams.setBusinessObjectData(businessObjectData); notificationEventParams.setPartitionColumnNames(partitionColumnNames); notificationEventParams.setStorageName(businessObjectDataNotificationRegistration.getStorage() == null ? null : businessObjectDataNotificationRegistration.getStorage().getName()); notificationEventParams.setPartitionValues(partitionValues); notificationEventParams.setNewBusinessObjectDataStatus(newBusinessObjectDataStatus); notificationEventParams.setOldBusinessObjectDataStatus(oldBusinessObjectDataStatus);
JobCreateRequest request = new JobCreateRequest(); JobDefinitionEntity jobDefinitionEntity = businessObjectDataNotificationEventParams.getNotificationJobAction().getJobDefinition(); businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration(); LOGGER.info("Starting a job due to a notification. notificationRegistrationKey={} jobCreateRequest={}", jsonHelper.objectToJson(notificationRegistrationHelper.getNotificationRegistrationKey(businessObjectDataNotificationRegistration)),
private List<Parameter> buildJobParameters(BusinessObjectDataNotificationEventParamsDto businessObjectDataNotificationEventParams) throws IOException { List<Parameter> parameters = new ArrayList<>(); BusinessObjectData businessObjectData = businessObjectDataNotificationEventParams.getBusinessObjectData(); NotificationJobActionEntity notificationJobActionEntity = businessObjectDataNotificationEventParams.getNotificationJobAction(); parameters.add( new Parameter(PARAM_NAMESPACE, businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getNamespace().getCode())); parameters .add(new Parameter(PARAM_NOTIFICATION_NAME, businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getName())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_EVENT_TYPE, businessObjectDataNotificationEventParams.getEventType())); parameters.add(new Parameter(PARAM_CORRELATION_DATA, notificationJobActionEntity.getCorrelationData())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA, jsonHelper.objectToJson(businessObjectData))); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAMESPACE, businessObjectData.getNamespace())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DEFINITION_NAME, businessObjectData.getBusinessObjectDefinitionName())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_USAGE, businessObjectData.getBusinessObjectFormatUsage())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_FILE_TYPE, businessObjectData.getBusinessObjectFormatFileType())); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_FORMAT_VERSION, Integer.toString(businessObjectData.getBusinessObjectFormatVersion()))); parameters.add(new Parameter(PARAM_PARTITION_COLUMN_NAMES, herdStringHelper.buildStringWithDefaultDelimiter(businessObjectDataNotificationEventParams.getPartitionColumnNames()))); parameters.add(new Parameter(PARAM_PARTITION_VALUES, herdStringHelper.buildStringWithDefaultDelimiter(businessObjectDataNotificationEventParams.getPartitionValues()))); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_VERSION, Integer.toString(businessObjectData.getVersion()))); parameters.add(new Parameter(PARAM_NEW_BUSINESS_OBJECT_DATA_STATUS, businessObjectDataNotificationEventParams.getNewBusinessObjectDataStatus())); parameters.add(new Parameter(PARAM_OLD_BUSINESS_OBJECT_DATA_STATUS, businessObjectDataNotificationEventParams.getOldBusinessObjectDataStatus())); return parameters; } }
@Override public String getIdentifyingInformation(NotificationEventParamsDto notificationEventParams, BusinessObjectDataHelper businessObjectDataHelper) { if (notificationEventParams instanceof BusinessObjectDataNotificationEventParamsDto) { BusinessObjectDataNotificationEventParamsDto businessObjectDataNotificationEventParams = (BusinessObjectDataNotificationEventParamsDto) notificationEventParams; return String.format("namespace: \"%s\", actionId: \"%s\" with " + businessObjectDataHelper.businessObjectDataKeyToString( businessObjectDataHelper.getBusinessObjectDataKey(businessObjectDataNotificationEventParams.getBusinessObjectData())) + ", storageName: \"%s\"", businessObjectDataNotificationEventParams.getBusinessObjectDataNotificationRegistration().getNamespace().getCode(), businessObjectDataNotificationEventParams.getNotificationJobAction().getId(), businessObjectDataNotificationEventParams.getStorageName()); } else { throw new IllegalStateException( "Notification event parameters DTO passed to the method must be an instance of BusinessObjectDataNotificationEventParamsDto."); } }
public Object createNewInstance() { return new BusinessObjectDataNotificationEventParamsDto(); }
lhsBusinessObjectDataNotificationRegistration = this.getBusinessObjectDataNotificationRegistration(); BusinessObjectDataNotificationRegistrationEntity rhsBusinessObjectDataNotificationRegistration; rhsBusinessObjectDataNotificationRegistration = that.getBusinessObjectDataNotificationRegistration(); if (!strategy.equals(LocatorUtils.property(thisLocator, "businessObjectDataNotificationRegistration", lhsBusinessObjectDataNotificationRegistration), LocatorUtils.property(thatLocator, "businessObjectDataNotificationRegistration", rhsBusinessObjectDataNotificationRegistration), lhsBusinessObjectDataNotificationRegistration, rhsBusinessObjectDataNotificationRegistration, (this.businessObjectDataNotificationRegistration!= null), (that.businessObjectDataNotificationRegistration!= null))) { return false; lhsNotificationJobAction = this.getNotificationJobAction(); NotificationJobActionEntity rhsNotificationJobAction; rhsNotificationJobAction = that.getNotificationJobAction(); if (!strategy.equals(LocatorUtils.property(thisLocator, "notificationJobAction", lhsNotificationJobAction), LocatorUtils.property(thatLocator, "notificationJobAction", rhsNotificationJobAction), lhsNotificationJobAction, rhsNotificationJobAction, (this.notificationJobAction!= null), (that.notificationJobAction!= null))) { return false; lhsEventType = this.getEventType(); String rhsEventType; rhsEventType = that.getEventType(); if (!strategy.equals(LocatorUtils.property(thisLocator, "eventType", lhsEventType), LocatorUtils.property(thatLocator, "eventType", rhsEventType), lhsEventType, rhsEventType, (this.eventType!= null), (that.eventType!= null))) { return false; lhsBusinessObjectData = this.getBusinessObjectData(); BusinessObjectData rhsBusinessObjectData; rhsBusinessObjectData = that.getBusinessObjectData(); if (!strategy.equals(LocatorUtils.property(thisLocator, "businessObjectData", lhsBusinessObjectData), LocatorUtils.property(thatLocator, "businessObjectData", rhsBusinessObjectData), lhsBusinessObjectData, rhsBusinessObjectData, (this.businessObjectData!= null), (that.businessObjectData!= null))) { return false; lhsPartitionColumnNames = (((this.partitionColumnNames!= null)&&(!this.partitionColumnNames.isEmpty()))?this.getPartitionColumnNames():null); List<String> rhsPartitionColumnNames; rhsPartitionColumnNames = (((that.partitionColumnNames!= null)&&(!that.partitionColumnNames.isEmpty()))?that.getPartitionColumnNames():null); if (!strategy.equals(LocatorUtils.property(thisLocator, "partitionColumnNames", lhsPartitionColumnNames), LocatorUtils.property(thatLocator, "partitionColumnNames", rhsPartitionColumnNames), lhsPartitionColumnNames, rhsPartitionColumnNames, ((this.partitionColumnNames!= null)&&(!this.partitionColumnNames.isEmpty())), ((that.partitionColumnNames!= null)&&(!that.partitionColumnNames.isEmpty())))) { return false;
@Override public BusinessObjectDataNotificationEventParamsDto build() { if (_storedValue == null) { return this.init(new BusinessObjectDataNotificationEventParamsDto()); } else { return ((BusinessObjectDataNotificationEventParamsDto) _storedValue); } }
theBusinessObjectDataNotificationRegistration = this.getBusinessObjectDataNotificationRegistration(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "businessObjectDataNotificationRegistration", theBusinessObjectDataNotificationRegistration), currentHashCode, theBusinessObjectDataNotificationRegistration, (this.businessObjectDataNotificationRegistration!= null)); theNotificationJobAction = this.getNotificationJobAction(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "notificationJobAction", theNotificationJobAction), currentHashCode, theNotificationJobAction, (this.notificationJobAction!= null)); theEventType = this.getEventType(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "eventType", theEventType), currentHashCode, theEventType, (this.eventType!= null)); theBusinessObjectData = this.getBusinessObjectData(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "businessObjectData", theBusinessObjectData), currentHashCode, theBusinessObjectData, (this.businessObjectData!= null)); thePartitionColumnNames = (((this.partitionColumnNames!= null)&&(!this.partitionColumnNames.isEmpty()))?this.getPartitionColumnNames():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "partitionColumnNames", thePartitionColumnNames), currentHashCode, thePartitionColumnNames, ((this.partitionColumnNames!= null)&&(!this.partitionColumnNames.isEmpty()))); thePartitionValues = (((this.partitionValues!= null)&&(!this.partitionValues.isEmpty()))?this.getPartitionValues():null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "partitionValues", thePartitionValues), currentHashCode, thePartitionValues, ((this.partitionValues!= null)&&(!this.partitionValues.isEmpty()))); theStorageName = this.getStorageName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "storageName", theStorageName), currentHashCode, theStorageName, (this.storageName!= null)); theNewBusinessObjectDataStatus = this.getNewBusinessObjectDataStatus(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "newBusinessObjectDataStatus", theNewBusinessObjectDataStatus), currentHashCode, theNewBusinessObjectDataStatus, (this.newBusinessObjectDataStatus!= null)); theOldBusinessObjectDataStatus = this.getOldBusinessObjectDataStatus(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "oldBusinessObjectDataStatus", theOldBusinessObjectDataStatus), currentHashCode, theOldBusinessObjectDataStatus, (this.oldBusinessObjectDataStatus!= null));
@Test public void testPerformNotificationActionInvalidParamsDto() throws Exception { // Get the notification action service for the storage unit status change event. NotificationActionService notificationActionService = notificationActionFactory .getNotificationActionHandler(NotificationTypeEntity.NOTIFICATION_TYPE_STORAGE_UNIT, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()); // Try to perform a notification action for the storage unit status change event with an invalid type of the parameters DTO. try { notificationActionService.performNotificationAction(new BusinessObjectDataNotificationEventParamsDto()); fail(); } catch (IllegalStateException e) { assertEquals("Notification event parameters DTO passed to the method must be an instance of StorageUnitNotificationEventParamsDto.", e.getMessage()); } } }
@Test public void testGetIdentifyingInformationInvalidParamsDto() { // Get the notification action service for the storage unit status change event. NotificationActionService notificationActionService = notificationActionFactory .getNotificationActionHandler(NotificationTypeEntity.NOTIFICATION_TYPE_STORAGE_UNIT, NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()); // Try to retrieve the identifying information for the notification event using an invalid type of the parameters DTO. try { notificationActionService.getIdentifyingInformation(new BusinessObjectDataNotificationEventParamsDto(), businessObjectDataHelper); fail(); } catch (IllegalStateException e) { assertEquals("Notification event parameters DTO passed to the method must be an instance of StorageUnitNotificationEventParamsDto.", e.getMessage()); } }