class ServerTemplatePresenter {

    public void setup( final ServerTemplate serverTemplate,
                       final ContainerSpec firstContainerSpec ) {
        view.clear();
        this.serverTemplate = serverTemplate;
        view.setTemplate( serverTemplate.getId(), serverTemplate.getName() );

        view.setProcessCapability( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) );

        view.setRulesCapability( serverTemplate.getCapabilities().contains( Capability.RULE.toString() ) );

        view.setPlanningCapability( serverTemplate.getCapabilities().contains( Capability.PLANNING.toString() ) );

        if ( firstContainerSpec != null ) {
            addContainer( firstContainerSpec );
            for ( final ContainerSpec containerSpec : serverTemplate.getContainersSpec() ) {
                if ( !containerSpec.getId().equals( firstContainerSpec.getId() ) ) {
                    addContainer( containerSpec );
                }
            }
            containerSpecSelectedEvent.fire( new ContainerSpecSelected( firstContainerSpec ) );
        }

        for ( final ServerInstanceKey serverInstanceKey : serverTemplate.getServerInstanceKeys() ) {
            addServerInstance( serverInstanceKey );
        }
    }

    @Inject public  ServerTemplatePresenter( final Logger logger,
                                    final View view,
                                    final CopyPopupPresenter copyPresenter,
                                    final Caller<SpecManagementService> specManagementService,
                                    final Event<NotificationEvent> notification,
                                    final Event<AddNewContainer> addNewContainerEvent,
                                    final Event<ContainerSpecSelected> containerSpecSelectedEvent,
                                    final Event<ServerInstanceSelected> serverInstanceSelectedEvent,
                                    final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent );

}