All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.stapi.graphsystem.structuredefinition.command.importStructureDefinitionFromSource.ImportStructureDefinition Maven / Gradle / Ivy

package ai.stapi.graphsystem.structuredefinition.command.importStructureDefinitionFromSource;

import ai.stapi.graphsystem.messaging.command.AbstractCommand;
import ai.stapi.schema.structuredefinition.RawStructureDefinitionData;
import ai.stapi.schema.structuredefinition.StructureDefinitionId;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;

public class ImportStructureDefinition extends AbstractCommand {

  public static final String SERIALIZATION_TYPE = "ImportStructureDefinition";

  private Map structureDefinitionSource;

  protected ImportStructureDefinition() {
  }

  public ImportStructureDefinition(
      StructureDefinitionId targetIdentifier,
      Map structureDefinitionSource
  ) {
    super(targetIdentifier, ImportStructureDefinition.SERIALIZATION_TYPE);
    this.structureDefinitionSource = structureDefinitionSource;
  }

  public ImportStructureDefinition(
      StructureDefinitionId targetIdentifier,
      RawStructureDefinitionData structureDefinitionSource
  ) {
    super(targetIdentifier, ImportStructureDefinition.SERIALIZATION_TYPE);
    this.structureDefinitionSource = new ObjectMapper().convertValue(
        structureDefinitionSource,
        new TypeReference<>() {
        }
    );
  }

  public Map getStructureDefinitionSource() {
    return structureDefinitionSource;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy