Search in sources :

Example 1 with ConnectorAction

use of com.redhat.service.bridge.manager.actions.connectors.ConnectorAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsServiceImpl method createConnectorEntity.

@Override
@Transactional(Transactional.TxType.MANDATORY)
public // Connector should always be marked for creation in the same transaction as a Processor
void createConnectorEntity(BaseAction resolvedAction, Processor processor, ActionProvider actionProvider) {
    if (!actionProvider.isConnectorAction()) {
        return;
    }
    ConnectorAction connectorAction = (ConnectorAction) actionProvider;
    JsonNode connectorPayload = connectorAction.connectorPayload(resolvedAction);
    String connectorType = connectorAction.getConnectorType();
    String newConnectorName = connectorName(connectorType, processor);
    String topicName = connectorAction.topicName(resolvedAction);
    ConnectorEntity newConnectorEntity = new ConnectorEntity();
    newConnectorEntity.setName(newConnectorName);
    newConnectorEntity.setStatus(ManagedResourceStatus.ACCEPTED);
    newConnectorEntity.setSubmittedAt(ZonedDateTime.now());
    newConnectorEntity.setProcessor(processor);
    newConnectorEntity.setDefinition(connectorPayload);
    newConnectorEntity.setConnectorType(connectorType);
    newConnectorEntity.setTopicName(topicName);
    connectorsDAO.persist(newConnectorEntity);
}
Also used : ConnectorEntity(com.redhat.service.bridge.manager.models.ConnectorEntity) ConnectorAction(com.redhat.service.bridge.manager.actions.connectors.ConnectorAction) JsonNode(com.fasterxml.jackson.databind.JsonNode) Transactional(javax.transaction.Transactional)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ConnectorAction (com.redhat.service.bridge.manager.actions.connectors.ConnectorAction)1 ConnectorEntity (com.redhat.service.bridge.manager.models.ConnectorEntity)1 Transactional (javax.transaction.Transactional)1