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);
}
Aggregations