Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Defaults DefaultCounter = 1 // DefaultCounter is the default counter DefaultFilenamePrefix = "diagram" // DefaultFilenamePrefix is the default filename prefix DefaultPathBPMN = "files/bpmn" // DefaultPathBPMN is the default path to the bpmn files DefaultPathJSON = "files/json" // DefaultPathJSON is the default path to the json files DefaultPathXML = "files/xml" // DefaultPathXML is the default path to the xml files // Errors ErrPathNotFound = errors.New("path not found") // ErrPathNotFound is the error for the path not found ErrEmptyFilePathBPMN = errors.New("empty file path for bpmn") // ErrEmptyFilePathBPMN is the error for the empty file path for bpmn ErrUnsupportedFileType = errors.New("unsupported file type") // ErrUnsupportedFileType is the error for the unsupported file type ErrInvalidDefinitions = errors.New("invalid DefinitionsRepository: repository is nil") // ErrInvalidDefinitions is the error for the invalid definitions )
Functions ¶
func ToPlainXML ¶
Types ¶
type BPMNParser ¶
type BPMNParser struct {
Counter int // Counter is the number of created files
FilenamePrefix string // FilenamePrefix is a part of the name of the current file
FilePathBPMN string // FilePathBPMN is the path to the bpmn files
FilePathJSON string // FilePathJSON is the path to the json files
FilePathXML string // FilePathXML is the path to the xml files
Def *foundation.Definitions // Def is the pointer definition of the model
Repo foundation.DefinitionsRepository // Repo is the repository of the model
}
BPMNParser ...
func (BPMNParser) GetFilename ¶
func (parser BPMNParser) GetFilename() string
GetFilename returns the current bpmn filename It is a helper method to get the current bpmn filename, which relies on the same instance
func (BPMNParser) Marshal ¶
func (parser BPMNParser) Marshal() error
Marshal builds the bpmn, json and xml files and returns an error, if an error occurs during the process. The method calls the MarshalBPMN and MarshalJSON methods. NOTE: Actually no option pattern is used here. Should be done later.
func (*BPMNParser) MarshalJson ¶
func (parser *BPMNParser) MarshalJson() ([]byte, error)
MarshalJSON marshals the repository data to JSON and saves it as a file.
func (*BPMNParser) MarshalXml ¶
func (parser *BPMNParser) MarshalXml() ([]byte, error)
MarshalXML marshals the repository data to xml and saves it as a file.
func (BPMNParser) Validate ¶
func (parser BPMNParser) Validate() error
Validate checks, if all incoming, outgoing, sourceRef and targetRef values are valid.
type BPMNParserRepository ¶
BPMNParserRepository ...
func NewBPMNParser ¶
func NewBPMNParser(opts ...Option) (BPMNParserRepository, error)
NewBPMNParser initializes the parser with the given options and returns the bpmn parser repository. The method sets the default values and applies the options to the parser.
type Element ¶
type Option ¶
type Option = func(parser *BPMNParser) error
Option is a functional option type for the Parser
func WithCounter ¶
func WithCounter() Option
WithCounter counts .bpmn files in the provided path and updates the Counter
func WithDefinitions ¶
func WithDefinitions(repo foundation.DefinitionsRepository) Option
WithDefinitions assigns a DefinitionsRepository to the parser.
func WithFilenamePrefix ¶
WithFilenamePrefix sets the filename prefix for the parser