/** * Reverse engineers a {@link StreamDefinition} into a semantically equivalent DSL text representation. * @param streamDefinition stream to be converted into DSL * @return the textual DSL representation of the stream */ public String toDsl(StreamDefinition streamDefinition) { return toDsl(streamDefinition.getAppDefinitions()); }
/** * Return a new instance of {@link StreamAppDefinition}. * * @param streamName the name of the stream * @return new instance of {@code StreamAppDefinition} */ public StreamAppDefinition build(String streamName) { if (this.label == null) { this.setLabel(this.registeredAppName); } return new StreamAppDefinition(this.registeredAppName, this.label, this.applicationType, streamName, this.properties); } }
@Override public AuditOperationType convertToEntityAttribute(Long value) { if (value == null) { return null; } return AuditOperationType.fromId(value); } }
@Override public String toString() { return "AppRegistration{" + "name='" + this.getName() + '\'' + ", type='" + this.getType() + '\'' + ", version='" + this.getVersion() + '\'' + ", uri=" + this.getUri() + ", metadataUri=" + this.getMetadataUri() + '}'; }
/** * Create a new builder that is initialized with properties of the given * definition. Useful for "mutating" a definition by building a slightly different * copy. * * @param definition the StreamAppDefinition to create a new Builder instance with * stream name, registeredAppName, label, and properties populated * @return a StreamAppDefinition builder */ public static Builder from(StreamAppDefinition definition) { Builder builder = new Builder(); builder.setStreamName(definition.getStreamName()).setRegisteredAppName(definition.getRegisteredAppName()) .setApplicationType(definition.getApplicationType()) .setLabel(definition.getName()).addProperties(definition.getProperties()); return builder; }
@Override public int compareTo(AppRegistration that) { int i = this.getType().compareTo(that.getType()); if (i == 0) { i = this.getName().compareTo(that.getName()); } if (i == 0) { i = this.getVersion().compareTo(that.getVersion()); } return i; } }
/** * Redacts sensitive property values in a task. * * @param taskDefinition the task definition to sanitize * @return Task definition text that has sensitive data redacted. */ public String sanitizeTaskDsl(TaskDefinition taskDefinition) { TaskDefinition sanitizedTaskDefinition = TaskDefinition.TaskDefinitionBuilder.from(taskDefinition) .setProperties(this.sanitizeProperties(taskDefinition.getProperties())) .build(); return this.taskDslConverter.toDsl(sanitizedTaskDefinition); }
@Override public AuditRecordResource instantiateResource(AuditRecord auditRecord) { final AuditRecordResource resource = new AuditRecordResource(); resource.setAuditRecordId(auditRecord.getId()); resource.setAuditAction(auditRecord.getAuditAction() != null ? auditRecord.getAuditAction().name() : null); resource.setAuditData(auditRecord.getAuditData()); resource.setAuditOperation(auditRecord.getAuditOperation() != null ? auditRecord.getAuditOperation().name() : null); resource.setCorrelationId(auditRecord.getCorrelationId()); resource.setCreatedBy(auditRecord.getCreatedBy()); resource.setCreatedOn(auditRecord.getCreatedOn()); return resource; }
private String getRegisteredName(StreamDefinition streamDefinition, String adrAppName) { for (StreamAppDefinition appDefinition : streamDefinition.getAppDefinitions()) { if (appDefinition.getName().equals(adrAppName)) { return appDefinition.getRegisteredAppName(); } } return adrAppName; }
/** * Create a new builder that is initialized with properties of the given * definition. Useful for "mutating" a definition by building a slightly different * copy. * * @param definition the DataFlowAppDefinition to use when creating the builder * @return a task definition builder */ public static TaskDefinitionBuilder from(DataFlowAppDefinition definition) { TaskDefinitionBuilder builder = new TaskDefinitionBuilder(); builder.setRegisteredAppName(definition.getRegisteredAppName()).setLabel(definition.getName()) .addProperties(definition.getProperties()); return builder; }
/** * Return an iterator that indicates the order of application deployments for this * stream. The application definitions are returned in reverse order; i.e. the sink is * returned first followed by the processors in reverse order followed by the source. * * @return iterator that iterates over the application definitions in deployment order */ public Iterator<StreamAppDefinition> getDeploymentOrderIterator() { return new ReadOnlyIterator<>(getAppDefinitions().descendingIterator()); }
public LauncherResource(Launcher launcher) { this.name = launcher.getName(); this.type = launcher.getType(); this.description = launcher.getDescription(); }
/** * Return a new instance of {@link TaskDefinition}. * * @return new instance of {@code TaskDefinition} */ public TaskDefinition build() { if (this.label == null) { this.label = this.registeredAppName; } return new TaskDefinition(this.registeredAppName, this.label, this.properties); } }
public String getKey() { return name(); }
@Override public AuditActionType convertToEntityAttribute(Long value) { if (value == null) { return null; } return AuditActionType.fromId(value); } }
@Override public Long convertToDatabaseColumn(AuditActionType value) { if (value == null) { return null; } return value.getId(); }
@Override public Long convertToDatabaseColumn(AuditOperationType value) { if (value == null) { return null; } return value.getId(); }
/** * Redacts sensitive property values in a task. * * @param taskDefinition the task definition to sanitize * @return Task definition text that has sensitive data redacted. */ public String sanitizeTaskDsl(TaskDefinition taskDefinition) { TaskDefinition sanitizedTaskDefinition = TaskDefinition.TaskDefinitionBuilder.from(taskDefinition) .setProperties(this.sanitizeProperties(taskDefinition.getProperties())) .build(); return this.taskDslConverter.toDsl(sanitizedTaskDefinition); }
private String getRegisteredName(StreamDefinition streamDefinition, String adrAppName) { for (StreamAppDefinition appDefinition: streamDefinition.getAppDefinitions()) { if (appDefinition.getName().equals(adrAppName)) { return appDefinition.getRegisteredAppName(); } } return adrAppName; }