public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent || component.getResourceReferences().isEmpty() || (component.getState() != LogicalState.NEW)) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalResourceReference<?> resourceReference : component.getResourceReferences()) { AttachWireCommand attachWireCommand = new AttachWireCommand(); PhysicalWire physicalWire = wireGenerator.generateResource(resourceReference); attachWireCommand.setPhysicalWireDefinition(physicalWire); command.add(attachWireCommand); } return Optional.of(command); }
public Optional<ConnectionCommand> generate(LogicalComponent<?> component) { if (component instanceof LogicalCompositeComponent || component.getResourceReferences().isEmpty() || (component.getState() != LogicalState.NEW)) { return Optional.empty(); } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalResourceReference<?> resourceReference : component.getResourceReferences()) { AttachWireCommand attachWireCommand = new AttachWireCommand(); PhysicalWire physicalWire = wireGenerator.generateResource(resourceReference); attachWireCommand.setPhysicalWireDefinition(physicalWire); command.add(attachWireCommand); } return Optional.of(command); }
public ConnectionCommand generate(LogicalComponent<?> component, boolean incremental) throws GenerationException { if (component instanceof LogicalCompositeComponent || component.getResourceReferences().isEmpty() || (component.getState() != LogicalState.NEW && incremental)) { return null; } ConnectionCommand command = new ConnectionCommand(component.getUri()); for (LogicalResourceReference<?> resourceReference : component.getResourceReferences()) { AttachWireCommand attachWireCommand = new AttachWireCommand(); PhysicalWireDefinition pwd = wireGenerator.generateResource(resourceReference); attachWireCommand.setPhysicalWireDefinition(pwd); command.add(attachWireCommand); } return command; }