Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Firefly ECM API Reference

This directory contains comprehensive API documentation for the Firefly ECM Library, including all port interfaces, domain models, and configuration options.

Table of Contents

  1. Port Interfaces
  2. Domain Models
  3. Configuration
  4. Adapters
  5. Services

Port Interfaces

The Firefly ECM Library defines business interfaces (ports) that adapters implement:

Document Management Ports

Folder Management Ports

Security Ports

Audit Ports

eSignature Ports

Domain Models

Core business entities and value objects:

Document Domain

Folder Domain

Security Domain

eSignature Domain

Configuration

Configuration classes and properties:

Adapters

Adapter implementations and interfaces:

Services

Core service classes:

Usage Examples

Basic Document Operations

// Get document port
DocumentPort documentPort = ecmPortProvider.getPort(DocumentPort.class);

// Create document
Document document = Document.builder()
    .name("example.pdf")
    .mimeType("application/pdf")
    .size(1024L)
    .status(DocumentStatus.ACTIVE)
    .build();

Mono<Document> created = documentPort.createDocument(document, content);

// Retrieve document
Mono<Document> retrieved = documentPort.getDocument(documentId);

// Update document
Mono<Document> updated = documentPort.updateDocument(document);

// Delete document
Mono<Void> deleted = documentPort.deleteDocument(documentId);

Content Operations

// Get content port
DocumentContentPort contentPort = ecmPortProvider.getPort(DocumentContentPort.class);

// Stream content
Flux<DataBuffer> contentStream = contentPort.getContentStream(documentId);

// Get content as bytes
Mono<byte[]> content = contentPort.getContent(documentId);

// Get content range
Flux<DataBuffer> range = contentPort.getContentRange(documentId, 0, 1023);

Folder Operations

// Get folder port
FolderPort folderPort = ecmPortProvider.getPort(FolderPort.class);

// Create folder
Folder folder = Folder.builder()
    .name("Documents")
    .path("/Documents")
    .build();

Mono<Folder> created = folderPort.createFolder(folder);

// List folder contents
Flux<Document> contents = folderPort.getFolderContents(folderId);

eSignature Operations

// Get signature envelope port
SignatureEnvelopePort envelopePort = ecmPortProvider.getPort(SignatureEnvelopePort.class);

// Create signature envelope
SignatureEnvelope envelope = SignatureEnvelope.builder()
    .title("Contract Signature")
    .description("Please sign this contract")
    .documentIds(Arrays.asList(documentId))
    .signatureRequests(signatureRequests)
    .build();

Mono<SignatureEnvelope> created = envelopePort.createEnvelope(envelope);

// Send envelope for signature
Mono<SignatureEnvelope> sent = envelopePort.sendEnvelope(envelopeId, sentBy);

// Get signing URL
Mono<String> signingUrl = envelopePort.getSigningUrl(envelopeId, signerEmail);

Error Handling

All port methods return reactive types (Mono or Flux) and follow these error handling patterns:

Common Exceptions

  • DocumentNotFoundException - Document not found
  • FolderNotFoundException - Folder not found
  • PermissionDeniedException - Access denied
  • AdapterException - Adapter-specific errors
  • ConfigurationException - Configuration errors

Error Handling Example

documentPort.getDocument(documentId)
    .doOnError(DocumentNotFoundException.class, error -> 
        log.warn("Document not found: {}", documentId))
    .onErrorReturn(DocumentNotFoundException.class, null)
    .doOnError(PermissionDeniedException.class, error -> 
        log.error("Access denied for document: {}", documentId))
    .onErrorResume(PermissionDeniedException.class, error -> 
        Mono.error(new SecurityException("Access denied")))
    .subscribe();

Reactive Programming

The Firefly ECM Library uses Project Reactor for reactive programming:

Key Concepts

  • Mono<T> - Represents 0 or 1 element
  • Flux<T> - Represents 0 to N elements
  • Backpressure - Automatic flow control
  • Non-blocking - Efficient resource utilization

Best Practices

  1. Chain Operations: Use reactive operators to chain operations
  2. Error Handling: Handle errors at appropriate levels
  3. Backpressure: Let Reactor handle backpressure automatically
  4. Testing: Use StepVerifier for testing reactive streams
  5. Blocking: Avoid blocking operations in reactive chains

Versioning

The Firefly ECM Library follows semantic versioning:

  • Major Version: Breaking changes to public APIs
  • Minor Version: New features, backward compatible
  • Patch Version: Bug fixes, backward compatible

Support

For API questions and support:


Note: This API reference is based on the actual Firefly ECM Library codebase. All interfaces, methods, and examples reflect the real implementation.