src/app/shared/flo/support/utils.ts
Utilities for Flo based graph editors.
Properties |
|
Methods |
|
Static decodeTextFromDSL | ||||||||
decodeTextFromDSL(dsl: string)
|
||||||||
Defined in src/app/shared/flo/support/utils.ts:38
|
||||||||
Parameters :
Returns :
string
|
Static encodeTextToDSL | ||||||||
encodeTextToDSL(text: string)
|
||||||||
Defined in src/app/shared/flo/support/utils.ts:34
|
||||||||
Parameters :
Returns :
string
|
Static isCodeTypeProperty | ||||||||||||
isCodeTypeProperty(metadata: Flo.ElementMetadata, property: string)
|
||||||||||||
Defined in src/app/shared/flo/support/utils.ts:45
|
||||||||||||
Parameters :
Returns :
boolean
|
Static isUnresolved | ||||||||
isUnresolved(element: dia.Cell)
|
||||||||
Defined in src/app/shared/flo/support/utils.ts:53
|
||||||||
Parameters :
Returns :
boolean
|
Static RX_JAVA_PROCESSOR_NAME |
RX_JAVA_PROCESSOR_NAME:
|
Default value : rx-java-processor
|
Defined in src/app/shared/flo/support/utils.ts:31
|
Static RX_JAVA_PROCESSOR_SOURCE_TYPE |
RX_JAVA_PROCESSOR_SOURCE_TYPE:
|
Default value : org.springframework.cloud.stream.app.transform.ProgrammableRxJavaProcessorProperties
|
Defined in src/app/shared/flo/support/utils.ts:27
|
Static SCRIPTABLE_TRANSFORM_NAME |
SCRIPTABLE_TRANSFORM_NAME:
|
Default value : scriptable-transform
|
Defined in src/app/shared/flo/support/utils.ts:32
|
Static SCRIPTABLE_TRANSFORM_SOURCE_TYPE |
SCRIPTABLE_TRANSFORM_SOURCE_TYPE:
|
Default value : org.springframework.cloud.stream.app.scriptable.transform.processor.ScriptableTransformProcessorProperties
|
Defined in src/app/shared/flo/support/utils.ts:28
|
import { Flo } from 'spring-flo';
import { dia } from 'jointjs';
/**
* Utilities for Flo based graph editors.
*
* @author Alex Boyko
*/
export class Utils {
static RX_JAVA_PROCESSOR_SOURCE_TYPE = 'org.springframework.cloud.stream.app.transform.ProgrammableRxJavaProcessorProperties';
static SCRIPTABLE_TRANSFORM_SOURCE_TYPE =
'org.springframework.cloud.stream.app.scriptable.transform.processor.ScriptableTransformProcessorProperties';
static RX_JAVA_PROCESSOR_NAME = 'rx-java-processor';
static SCRIPTABLE_TRANSFORM_NAME = 'scriptable-transform';
static encodeTextToDSL(text: string): string {
return '\"' + text.replace(/(?:\r\n|\r|\n)/g, '\\n').replace(/"/g, '""') + '\"';
}
static decodeTextFromDSL(dsl: string): string {
if (dsl.charAt(0) === '\"' && dsl.charAt(dsl.length - 1) === '\"') {
dsl = dsl.substr(1, dsl.length - 2);
}
return dsl.replace(/\\n/g, '\n').replace(/\"\"/g, '"');
}
static isCodeTypeProperty(metadata: Flo.ElementMetadata, property: string): boolean {
const propertyLowerCase = property.toLowerCase();
return (metadata.name === Utils.RX_JAVA_PROCESSOR_NAME
&& (propertyLowerCase === 'code' || propertyLowerCase === 'rxjava-processor.code'))
|| (metadata.name === Utils.SCRIPTABLE_TRANSFORM_NAME
&& (propertyLowerCase === 'script' || propertyLowerCase === 'scriptable-transformer.script'));
}
static isUnresolved(element: dia.Cell): boolean {
return element.attr('metadata/metadata/unresolved');
}
}