/** * Validates the business object data notification actions. This method also trims the notification action parameters. * * @param jobActions the list of notification job actions */ private void validateNotificationActions(List<JobAction> jobActions) { Assert.notEmpty(jobActions, "At least one notification action must be specified."); // Ensure job action isn't a duplicate by using a hash set with lowercase job definition key values for case insensitivity. Set<JobAction> validatedJobActionsSet = new LinkedHashSet<>(); for (JobAction jobAction : jobActions) { Assert.hasText(jobAction.getNamespace(), "A job action namespace must be specified."); jobAction.setNamespace(jobAction.getNamespace().trim()); Assert.hasText(jobAction.getJobName(), "A job action job name must be specified."); jobAction.setJobName(jobAction.getJobName().trim()); // Create a special version of the job action with the relative job definition key values in lowercase. JobAction lowercaseJobDefinitionKey = new JobAction(); lowercaseJobDefinitionKey.setNamespace(jobAction.getNamespace().toLowerCase()); lowercaseJobDefinitionKey.setJobName(jobAction.getJobName().toLowerCase()); if (validatedJobActionsSet.contains(lowercaseJobDefinitionKey)) { throw new IllegalArgumentException( String.format("Duplicate job action {namespace: \"%s\", jobName: \"%s\"} found.", jobAction.getNamespace(), jobAction.getJobName())); } validatedJobActionsSet.add(lowercaseJobDefinitionKey); } }
/** * Validates the storage unit notification actions. This method also trims the notification action parameters. * * @param jobActions the list of notification job actions */ private void validateNotificationActions(List<JobAction> jobActions) { Assert.notEmpty(jobActions, "At least one notification action must be specified."); // Ensure job action isn't a duplicate by using a hash set with lowercase job definition key values for case insensitivity. Set<JobAction> validatedJobActionsSet = new LinkedHashSet<>(); for (JobAction jobAction : jobActions) { Assert.hasText(jobAction.getNamespace(), "A job action namespace must be specified."); jobAction.setNamespace(jobAction.getNamespace().trim()); Assert.hasText(jobAction.getJobName(), "A job action job name must be specified."); jobAction.setJobName(jobAction.getJobName().trim()); // Create a special version of the job action with the relative job definition key values in lowercase. JobAction lowercaseJobDefinitionKey = new JobAction(); lowercaseJobDefinitionKey.setNamespace(jobAction.getNamespace().toLowerCase()); lowercaseJobDefinitionKey.setJobName(jobAction.getJobName().toLowerCase()); if (validatedJobActionsSet.contains(lowercaseJobDefinitionKey)) { throw new IllegalArgumentException( String.format("Duplicate job action {namespace: \"%s\", jobName: \"%s\"} found.", jobAction.getNamespace(), jobAction.getJobName())); } validatedJobActionsSet.add(lowercaseJobDefinitionKey); } }
/** * Validates the storage unit notification actions. This method also trims the notification action parameters. * * @param jobActions the list of notification job actions */ private void validateNotificationActions(List<JobAction> jobActions) { Assert.notEmpty(jobActions, "At least one notification action must be specified."); // Ensure job action isn't a duplicate by using a hash set with lowercase job definition key values for case insensitivity. Set<JobAction> validatedJobActionsSet = new LinkedHashSet<>(); for (JobAction jobAction : jobActions) { Assert.hasText(jobAction.getNamespace(), "A job action namespace must be specified."); jobAction.setNamespace(jobAction.getNamespace().trim()); Assert.hasText(jobAction.getJobName(), "A job action job name must be specified."); jobAction.setJobName(jobAction.getJobName().trim()); // Create a special version of the job action with the relative job definition key values in lowercase. JobAction lowercaseJobDefinitionKey = new JobAction(); lowercaseJobDefinitionKey.setNamespace(jobAction.getNamespace().toLowerCase()); lowercaseJobDefinitionKey.setJobName(jobAction.getJobName().toLowerCase()); if (validatedJobActionsSet.contains(lowercaseJobDefinitionKey)) { throw new IllegalArgumentException( String.format("Duplicate job action {namespace: \"%s\", jobName: \"%s\"} found.", jobAction.getNamespace(), jobAction.getJobName())); } validatedJobActionsSet.add(lowercaseJobDefinitionKey); } }
/** * Validates the business object data notification actions. This method also trims the notification action parameters. * * @param jobActions the list of notification job actions */ private void validateNotificationActions(List<JobAction> jobActions) { Assert.notEmpty(jobActions, "At least one notification action must be specified."); // Ensure job action isn't a duplicate by using a hash set with lowercase job definition key values for case insensitivity. Set<JobAction> validatedJobActionsSet = new LinkedHashSet<>(); for (JobAction jobAction : jobActions) { Assert.hasText(jobAction.getNamespace(), "A job action namespace must be specified."); jobAction.setNamespace(jobAction.getNamespace().trim()); Assert.hasText(jobAction.getJobName(), "A job action job name must be specified."); jobAction.setJobName(jobAction.getJobName().trim()); // Create a special version of the job action with the relative job definition key values in lowercase. JobAction lowercaseJobDefinitionKey = new JobAction(); lowercaseJobDefinitionKey.setNamespace(jobAction.getNamespace().toLowerCase()); lowercaseJobDefinitionKey.setJobName(jobAction.getJobName().toLowerCase()); if (validatedJobActionsSet.contains(lowercaseJobDefinitionKey)) { throw new IllegalArgumentException( String.format("Duplicate job action {namespace: \"%s\", jobName: \"%s\"} found.", jobAction.getNamespace(), jobAction.getJobName())); } validatedJobActionsSet.add(lowercaseJobDefinitionKey); } }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theNamespace; theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); } { String theJobName; theJobName = this.getJobName(); strategy.appendField(locator, this, "jobName", buffer, theJobName, (this.jobName!= null)); } { String theCorrelationData; theCorrelationData = this.getCorrelationData(); strategy.appendField(locator, this, "correlationData", buffer, theCorrelationData, (this.correlationData!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theNamespace; theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); } { String theJobName; theJobName = this.getJobName(); strategy.appendField(locator, this, "jobName", buffer, theJobName, (this.jobName!= null)); } { String theCorrelationData; theCorrelationData = this.getCorrelationData(); strategy.appendField(locator, this, "correlationData", buffer, theCorrelationData, (this.correlationData!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theNamespace; theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); } { String theJobName; theJobName = this.getJobName(); strategy.appendField(locator, this, "jobName", buffer, theJobName, (this.jobName!= null)); } { String theCorrelationData; theCorrelationData = this.getCorrelationData(); strategy.appendField(locator, this, "correlationData", buffer, theCorrelationData, (this.correlationData!= null)); } return buffer; }
lhsNamespace = this.getNamespace(); String rhsNamespace; rhsNamespace = that.getNamespace(); if (!strategy.equals(LocatorUtils.property(thisLocator, "namespace", lhsNamespace), LocatorUtils.property(thatLocator, "namespace", rhsNamespace), lhsNamespace, rhsNamespace, (this.namespace!= null), (that.namespace!= null))) { return false;
lhsNamespace = this.getNamespace(); String rhsNamespace; rhsNamespace = that.getNamespace(); if (!strategy.equals(LocatorUtils.property(thisLocator, "namespace", lhsNamespace), LocatorUtils.property(thatLocator, "namespace", rhsNamespace), lhsNamespace, rhsNamespace, (this.namespace!= null), (that.namespace!= null))) { return false;
lhsNamespace = this.getNamespace(); String rhsNamespace; rhsNamespace = that.getNamespace(); if (!strategy.equals(LocatorUtils.property(thisLocator, "namespace", lhsNamespace), LocatorUtils.property(thatLocator, "namespace", rhsNamespace), lhsNamespace, rhsNamespace, (this.namespace!= null), (that.namespace!= null))) { return false;
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theNamespace; theNamespace = this.getNamespace(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "namespace", theNamespace), currentHashCode, theNamespace, (this.namespace!= null)); } { String theJobName; theJobName = this.getJobName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "jobName", theJobName), currentHashCode, theJobName, (this.jobName!= null)); } { String theCorrelationData; theCorrelationData = this.getCorrelationData(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "correlationData", theCorrelationData), currentHashCode, theCorrelationData, (this.correlationData!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theNamespace; theNamespace = this.getNamespace(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "namespace", theNamespace), currentHashCode, theNamespace, (this.namespace!= null)); } { String theJobName; theJobName = this.getJobName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "jobName", theJobName), currentHashCode, theJobName, (this.jobName!= null)); } { String theCorrelationData; theCorrelationData = this.getCorrelationData(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "correlationData", theCorrelationData), currentHashCode, theCorrelationData, (this.correlationData!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theNamespace; theNamespace = this.getNamespace(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "namespace", theNamespace), currentHashCode, theNamespace, (this.namespace!= null)); } { String theJobName; theJobName = this.getJobName(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "jobName", theJobName), currentHashCode, theJobName, (this.jobName!= null)); } { String theCorrelationData; theCorrelationData = this.getCorrelationData(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "correlationData", theCorrelationData), currentHashCode, theCorrelationData, (this.correlationData!= null)); } return currentHashCode; }
@Test public void testCreateStorageUnitNotificationRegistrationDuplicateJobActions() { // Create and persist the relative database entities. notificationRegistrationServiceTestHelper.createDatabaseEntitiesForStorageUnitNotificationRegistrationTesting(); // Try to create a storage unit notification with duplicate job actions. StorageUnitNotificationRegistrationCreateRequest request = new StorageUnitNotificationRegistrationCreateRequest(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME), NotificationEventTypeEntity.EventTypesStorageUnit.STRGE_UNIT_STTS_CHG.name(), new StorageUnitNotificationFilter(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, STORAGE_UNIT_STATUS, STORAGE_UNIT_STATUS_2), Arrays.asList(new JobAction(NAMESPACE.toLowerCase(), JOB_NAME.toLowerCase(), CORRELATION_DATA), new JobAction(NAMESPACE.toUpperCase(), JOB_NAME.toUpperCase(), CORRELATION_DATA)), NotificationRegistrationStatusEntity.ENABLED); try { storageUnitNotificationRegistrationService.createStorageUnitNotificationRegistration(request); fail("Should throw an IllegalArgumentException when create request contains duplicate job actions."); } catch (IllegalArgumentException e) { assertEquals(String.format("Duplicate job action {namespace: \"%s\", jobName: \"%s\"} found.", request.getJobActions().get(1).getNamespace(), request.getJobActions().get(1).getJobName()), e.getMessage()); } }
@Test public void testCreateBusinessObjectDataNotificationRegistrationDuplicateJobActions() { // Create and persist the relative database entities. notificationRegistrationServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataNotificationRegistrationTesting(); // Try to create a business object data notification with duplicate job actions. BusinessObjectDataNotificationRegistrationCreateRequest request = new BusinessObjectDataNotificationRegistrationCreateRequest(new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME), NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), new BusinessObjectDataNotificationFilter(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS_2), Arrays.asList(new JobAction(NAMESPACE.toLowerCase(), JOB_NAME.toLowerCase(), CORRELATION_DATA), new JobAction(NAMESPACE.toUpperCase(), JOB_NAME.toUpperCase(), CORRELATION_DATA)), NotificationRegistrationStatusEntity.ENABLED); try { businessObjectDataNotificationRegistrationService.createBusinessObjectDataNotificationRegistration(request); fail("Should throw an IllegalArgumentException when create request contains duplicate job actions."); } catch (IllegalArgumentException e) { assertEquals(String.format("Duplicate job action {namespace: \"%s\", jobName: \"%s\"} found.", request.getJobActions().get(1).getNamespace(), request.getJobActions().get(1).getJobName()), e.getMessage()); } }
JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(jobAction.getNamespace(), jobAction.getJobName());
JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(jobAction.getNamespace(), jobAction.getJobName());
JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(jobAction.getNamespace(), jobAction.getJobName());
JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(jobAction.getNamespace(), jobAction.getJobName());
if (namespaceShouldBeCopiedAndSet == Boolean.TRUE) { String sourceNamespace; sourceNamespace = this.getNamespace(); String copyNamespace = ((String) strategy.copy(LocatorUtils.property(locator, "namespace", sourceNamespace), sourceNamespace, (this.namespace!= null))); copy.setNamespace(copyNamespace);