@Test public void transformEntityReference() { when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(nameStrategy); when(configuration.useTransformation()).thenReturn(true); assertSame(entityReferenceTarget, scriptService.transformEntityReference(entityReferenceSource)); verify(nameStrategy, times(1)).transform(entityReferenceSource); when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(null); assertSame(entityReferenceSource, scriptService.transformEntityReference(entityReferenceSource)); verify(nameStrategy, times(1)).transform(entityReferenceSource); when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(nameStrategy); when(configuration.useTransformation()).thenReturn(false); assertSame(entityReferenceSource, scriptService.transformEntityReference(entityReferenceSource)); verify(nameStrategy, times(1)).transform(entityReferenceSource); when(nameStrategyManager.getEntityReferenceNameStrategy()).thenReturn(null); when(configuration.useTransformation()).thenReturn(false); assertSame(entityReferenceSource, scriptService.transformEntityReference(entityReferenceSource)); verify(nameStrategy, times(1)).transform(entityReferenceSource); }
public EntityReference transformEntityReference(EntityReference sourceEntity) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(sourceEntity); } else { return sourceEntity; } }
ModelValidationScriptService implements ScriptService { public EntityReference transformEntityReference(EntityReference sourceEntity) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(sourceEntity); } else { return sourceEntity; } } }
ModelValidationScriptService implements ScriptService { public EntityReference transformEntityReference(EntityReference sourceEntity) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(sourceEntity); } else { return sourceEntity; } }  }
ModelValidationScriptService implements ScriptService { public EntityReference transformEntityReference(EntityReference sourceEntity) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(sourceEntity); } else { return sourceEntity; } }  EntityNameValidationManager getManager(); EntityNameValidationConfiguration getConfiguration(); ReplaceCharacterEntityNameValidationConfiguration getReplaceCharacterEntityNameValidationConfiguration(); String transformName(String name); EntityReference transformEntityReference(EntityReference sourceEntity); String transformName(String name, String hint); EntityReference transformEntityReference(EntityReference sourceEntity, String hint); boolean isValid(String name); boolean isValid(EntityReference sourceEntity); boolean isValid(String name, String hint); boolean isValid(EntityReference sourceEntity, String hint); }
ModelValidationScriptService implements ScriptService { public EntityReference transformEntityReference(EntityReference sourceEntity) { if (this.entityNameValidationConfiguration.useTransformation() && this.entityNameValidationManager.getEntityReferenceNameStrategy() != null) { return this.entityNameValidationManager.getEntityReferenceNameStrategy().transform(sourceEntity); } else { return sourceEntity; } }  EntityNameValidationManager getManager(); EntityNameValidationConfiguration getConfiguration(); ReplaceCharacterEntityNameValidationConfiguration getReplaceCharacterEntityNameValidationConfiguration(); String transformName(String name); EntityReference transformEntityReference(EntityReference sourceEntity); String transformName(String name, String hint); EntityReference transformEntityReference(EntityReference sourceEntity, String hint); boolean isValid(String name); boolean isValid(EntityReference sourceEntity); boolean isValid(String name, String hint); boolean isValid(EntityReference sourceEntity, String hint);  }