/** * Create an instance of {@link StorageUnitNotificationEventParamsDto } * */ public StorageUnitNotificationEventParamsDto createStorageUnitNotificationEventParamsDto() { return new StorageUnitNotificationEventParamsDto(); }
@Override public String getIdentifyingInformation(NotificationEventParamsDto notificationEventParams, BusinessObjectDataHelper businessObjectDataHelper) { if (notificationEventParams instanceof StorageUnitNotificationEventParamsDto) { StorageUnitNotificationEventParamsDto storageUnitNotificationEventParams = (StorageUnitNotificationEventParamsDto) notificationEventParams; return String.format("namespace: \"%s\", actionId: \"%s\" with " + businessObjectDataHelper.businessObjectDataKeyToString( businessObjectDataHelper.getBusinessObjectDataKey(storageUnitNotificationEventParams.getBusinessObjectData())) + ", storageName: \"%s\"", storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getNamespace().getCode(), storageUnitNotificationEventParams.getNotificationJobAction().getId(), storageUnitNotificationEventParams.getStorageName()); } else { throw new IllegalStateException( "Notification event parameters DTO passed to the method must be an instance of StorageUnitNotificationEventParamsDto."); } }
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) { final Object draftCopy = ((target == null)?createNewInstance():target); super.copyTo(locator, draftCopy, strategy); if (draftCopy instanceof StorageUnitNotificationEventParamsDto) { if (storageUnitNotificationRegistrationShouldBeCopiedAndSet == Boolean.TRUE) { StorageUnitNotificationRegistrationEntity sourceStorageUnitNotificationRegistration; sourceStorageUnitNotificationRegistration = this.getStorageUnitNotificationRegistration(); StorageUnitNotificationRegistrationEntity copyStorageUnitNotificationRegistration = ((StorageUnitNotificationRegistrationEntity) strategy.copy(LocatorUtils.property(locator, "storageUnitNotificationRegistration", sourceStorageUnitNotificationRegistration), sourceStorageUnitNotificationRegistration, (this.storageUnitNotificationRegistration!= null))); copy.setStorageUnitNotificationRegistration(copyStorageUnitNotificationRegistration); } else { if (storageUnitNotificationRegistrationShouldBeCopiedAndSet == 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) {
theStorageUnitNotificationRegistration = this.getStorageUnitNotificationRegistration(); strategy.appendField(locator, this, "storageUnitNotificationRegistration", buffer, theStorageUnitNotificationRegistration, (this.storageUnitNotificationRegistration!= 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)); theNewStorageUnitStatus = this.getNewStorageUnitStatus(); strategy.appendField(locator, this, "newStorageUnitStatus", buffer, theNewStorageUnitStatus, (this.newStorageUnitStatus!= null)); theOldStorageUnitStatus = this.getOldStorageUnitStatus(); strategy.appendField(locator, this, "oldStorageUnitStatus", buffer, theOldStorageUnitStatus, (this.oldStorageUnitStatus!= null));
StorageUnitNotificationEventParamsDto notificationEventParams = new StorageUnitNotificationEventParamsDto(); notificationEventParams.setStorageUnitNotificationRegistration(storageUnitNotificationRegistration); notificationEventParams.setNotificationJobAction(notificationJobActionEntity); notificationEventParams.setEventType(notificationEventType); notificationEventParams.setBusinessObjectData(businessObjectData); notificationEventParams.setPartitionColumnNames(partitionColumnNames); notificationEventParams.setStorageName(storageName); notificationEventParams.setPartitionValues(partitionValues); notificationEventParams.setNewStorageUnitStatus(newStorageUnitStatus); notificationEventParams.setOldStorageUnitStatus(oldStorageUnitStatus);
StorageUnitNotificationEventParamsDto storageUnitNotificationEventParamsDto = new StorageUnitNotificationEventParamsDto(); storageUnitNotificationEventParamsDto.setBusinessObjectData(businessObjectDataHelper.createBusinessObjectDataFromEntity(businessObjectDataEntity)); storageUnitNotificationEventParamsDto.setStorageUnitNotificationRegistration(storageUnitNotificationRegistrationEntity); storageUnitNotificationEventParamsDto.setEventType(NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name()); storageUnitNotificationEventParamsDto .setNotificationJobAction((NotificationJobActionEntity) storageUnitNotificationRegistrationEntity.getNotificationActions().toArray()[0]); storageUnitNotificationEventParamsDto.setStorageName(STORAGE_NAME);
JobCreateRequest request = new JobCreateRequest(); JobDefinitionEntity jobDefinitionEntity = storageUnitNotificationEventParams.getNotificationJobAction().getJobDefinition(); storageUnitNotificationEventParams.getStorageUnitNotificationRegistration(); LOGGER.info("Starting a job due to a notification. notificationRegistrationKey={} jobCreateRequest={}", jsonHelper.objectToJson(notificationRegistrationHelper.getNotificationRegistrationKey(storageUnitNotificationRegistration)),
private List<Parameter> buildJobParameters(StorageUnitNotificationEventParamsDto storageUnitNotificationEventParams) throws IOException { List<Parameter> parameters = new ArrayList<>(); BusinessObjectData businessObjectData = storageUnitNotificationEventParams.getBusinessObjectData(); NotificationJobActionEntity notificationJobActionEntity = storageUnitNotificationEventParams.getNotificationJobAction(); parameters.add(new Parameter(PARAM_NAMESPACE, storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getNamespace().getCode())); parameters.add(new Parameter(PARAM_NOTIFICATION_NAME, storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getName())); parameters.add(new Parameter(PARAM_STORAGE_UNIT_EVENT_TYPE, storageUnitNotificationEventParams.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(storageUnitNotificationEventParams.getPartitionColumnNames()))); parameters.add( new Parameter(PARAM_PARTITION_VALUES, herdStringHelper.buildStringWithDefaultDelimiter(storageUnitNotificationEventParams.getPartitionValues()))); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_VERSION, Integer.toString(businessObjectData.getVersion()))); parameters.add(new Parameter(PARAM_STORAGE_NAME, storageUnitNotificationEventParams.getStorageName())); parameters.add(new Parameter(PARAM_NEW_STORAGE_UNIT_STATUS, storageUnitNotificationEventParams.getNewStorageUnitStatus())); parameters.add(new Parameter(PARAM_OLD_STORAGE_UNIT_STATUS, storageUnitNotificationEventParams.getOldStorageUnitStatus())); return parameters; } }
StorageUnitNotificationEventParamsDto notificationEventParams = new StorageUnitNotificationEventParamsDto(); notificationEventParams.setStorageUnitNotificationRegistration(storageUnitNotificationRegistration); notificationEventParams.setNotificationJobAction(notificationJobActionEntity); notificationEventParams.setEventType(notificationEventType); notificationEventParams.setBusinessObjectData(businessObjectData); notificationEventParams.setPartitionColumnNames(partitionColumnNames); notificationEventParams.setStorageName(storageName); notificationEventParams.setPartitionValues(partitionValues); notificationEventParams.setNewStorageUnitStatus(newStorageUnitStatus); notificationEventParams.setOldStorageUnitStatus(oldStorageUnitStatus);
JobCreateRequest request = new JobCreateRequest(); JobDefinitionEntity jobDefinitionEntity = storageUnitNotificationEventParams.getNotificationJobAction().getJobDefinition(); storageUnitNotificationEventParams.getStorageUnitNotificationRegistration(); LOGGER.info("Starting a job due to a notification. notificationRegistrationKey={} jobCreateRequest={}", jsonHelper.objectToJson(notificationRegistrationHelper.getNotificationRegistrationKey(storageUnitNotificationRegistration)),
private List<Parameter> buildJobParameters(StorageUnitNotificationEventParamsDto storageUnitNotificationEventParams) throws IOException { List<Parameter> parameters = new ArrayList<>(); BusinessObjectData businessObjectData = storageUnitNotificationEventParams.getBusinessObjectData(); NotificationJobActionEntity notificationJobActionEntity = storageUnitNotificationEventParams.getNotificationJobAction(); parameters.add(new Parameter(PARAM_NAMESPACE, storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getNamespace().getCode())); parameters.add(new Parameter(PARAM_NOTIFICATION_NAME, storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getName())); parameters.add(new Parameter(PARAM_STORAGE_UNIT_EVENT_TYPE, storageUnitNotificationEventParams.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(storageUnitNotificationEventParams.getPartitionColumnNames()))); parameters.add( new Parameter(PARAM_PARTITION_VALUES, herdStringHelper.buildStringWithDefaultDelimiter(storageUnitNotificationEventParams.getPartitionValues()))); parameters.add(new Parameter(PARAM_BUSINESS_OBJECT_DATA_VERSION, Integer.toString(businessObjectData.getVersion()))); parameters.add(new Parameter(PARAM_STORAGE_NAME, storageUnitNotificationEventParams.getStorageName())); parameters.add(new Parameter(PARAM_NEW_STORAGE_UNIT_STATUS, storageUnitNotificationEventParams.getNewStorageUnitStatus())); parameters.add(new Parameter(PARAM_OLD_STORAGE_UNIT_STATUS, storageUnitNotificationEventParams.getOldStorageUnitStatus())); return parameters; } }
@Override public String getIdentifyingInformation(NotificationEventParamsDto notificationEventParams, BusinessObjectDataHelper businessObjectDataHelper) { if (notificationEventParams instanceof StorageUnitNotificationEventParamsDto) { StorageUnitNotificationEventParamsDto storageUnitNotificationEventParams = (StorageUnitNotificationEventParamsDto) notificationEventParams; return String.format("namespace: \"%s\", actionId: \"%s\" with " + businessObjectDataHelper.businessObjectDataKeyToString( businessObjectDataHelper.getBusinessObjectDataKey(storageUnitNotificationEventParams.getBusinessObjectData())) + ", storageName: \"%s\"", storageUnitNotificationEventParams.getStorageUnitNotificationRegistration().getNamespace().getCode(), storageUnitNotificationEventParams.getNotificationJobAction().getId(), storageUnitNotificationEventParams.getStorageName()); } else { throw new IllegalStateException( "Notification event parameters DTO passed to the method must be an instance of StorageUnitNotificationEventParamsDto."); } }
public Object createNewInstance() { return new StorageUnitNotificationEventParamsDto(); }
lhsStorageUnitNotificationRegistration = this.getStorageUnitNotificationRegistration(); StorageUnitNotificationRegistrationEntity rhsStorageUnitNotificationRegistration; rhsStorageUnitNotificationRegistration = that.getStorageUnitNotificationRegistration(); if (!strategy.equals(LocatorUtils.property(thisLocator, "storageUnitNotificationRegistration", lhsStorageUnitNotificationRegistration), LocatorUtils.property(thatLocator, "storageUnitNotificationRegistration", rhsStorageUnitNotificationRegistration), lhsStorageUnitNotificationRegistration, rhsStorageUnitNotificationRegistration, (this.storageUnitNotificationRegistration!= null), (that.storageUnitNotificationRegistration!= 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 StorageUnitNotificationEventParamsDto build() { if (_storedValue == null) { return this.init(new StorageUnitNotificationEventParamsDto()); } else { return ((StorageUnitNotificationEventParamsDto) _storedValue); } }
theStorageUnitNotificationRegistration = this.getStorageUnitNotificationRegistration(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "storageUnitNotificationRegistration", theStorageUnitNotificationRegistration), currentHashCode, theStorageUnitNotificationRegistration, (this.storageUnitNotificationRegistration!= 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)); theNewStorageUnitStatus = this.getNewStorageUnitStatus(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "newStorageUnitStatus", theNewStorageUnitStatus), currentHashCode, theNewStorageUnitStatus, (this.newStorageUnitStatus!= null)); theOldStorageUnitStatus = this.getOldStorageUnitStatus(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "oldStorageUnitStatus", theOldStorageUnitStatus), currentHashCode, theOldStorageUnitStatus, (this.oldStorageUnitStatus!= null));
@Test public void testGetIdentifyingInformationInvalidParamsDto() { // Get the notification action service for the business object data registration event. NotificationActionService notificationActionService = notificationActionFactory .getNotificationActionHandler(NotificationTypeEntity.NOTIFICATION_TYPE_BDATA, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_RGSTN.name()); // Try to retrieve the identifying information for the notification event using an invalid type of the parameters DTO. try { notificationActionService.getIdentifyingInformation(new StorageUnitNotificationEventParamsDto(), businessObjectDataHelper); fail(); } catch (IllegalStateException e) { assertEquals("Notification event parameters DTO passed to the method must be an instance of BusinessObjectDataNotificationEventParamsDto.", e.getMessage()); } }
@Test public void testPerformNotificationActionInvalidParamsDto() throws Exception { // Get the notification action service for the business object data registration event. NotificationActionService notificationActionService = notificationActionFactory .getNotificationActionHandler(NotificationTypeEntity.NOTIFICATION_TYPE_BDATA, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_RGSTN.name()); // Try to perform a notification action for the business object data registration event with an invalid type of the parameters DTO. try { notificationActionService.performNotificationAction(new StorageUnitNotificationEventParamsDto()); fail(); } catch (IllegalStateException e) { assertEquals("Notification event parameters DTO passed to the method must be an instance of BusinessObjectDataNotificationEventParamsDto.", e.getMessage()); } } }