Search in sources :

Example 6 with Scenario

use of org.asqatasun.webapp.entity.scenario.Scenario in project Asqatasun by Asqatasun.

the class AuditScenarioController method displayScenarioSetUp.

@RequestMapping(value = TgolKeyStore.AUDIT_SCENARIO_SET_UP_CONTRACT_URL, method = RequestMethod.GET)
@Secured({ TgolKeyStore.ROLE_USER_KEY, TgolKeyStore.ROLE_ADMIN_KEY })
public String displayScenarioSetUp(@RequestParam(TgolKeyStore.CONTRACT_ID_KEY) String contractId, @RequestParam(TgolKeyStore.SCENARIO_ID_KEY) String scenarioId, HttpServletRequest request, HttpServletResponse response, Model model) {
    Scenario scenario = scenarioDataService.read(Long.valueOf(scenarioId));
    model.addAttribute(TgolKeyStore.SCENARIO_KEY, scenario);
    return displayAuditSetUpView(TgolKeyStore.AUDIT_SCENARIO_SET_UP_VIEW_NAME, contractId, scenarioId, getScenarioOptionFormFieldBuilderMap(), ScopeEnum.SCENARIO, model);
}
Also used : Scenario(org.asqatasun.webapp.entity.scenario.Scenario) Secured(org.springframework.security.access.annotation.Secured) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with Scenario

use of org.asqatasun.webapp.entity.scenario.Scenario in project Asqatasun by Asqatasun.

the class AsqatasunOrchestratorImpl method auditScenario.

@Override
public void auditScenario(Contract contract, Long idScenario, String clientIp, Set<Parameter> parameterSet, Locale locale) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Scenarion audit on scenario with id" + idScenario);
        for (Parameter param : parameterSet) {
            LOGGER.debug("param " + param.getValue() + " " + param.getParameterElement().getParameterElementCode());
        }
    }
    Act act = createAct(contract, ScopeEnum.SCENARIO, clientIp);
    Scenario scenario = scenarioDataService.read(idScenario);
    AuditThread auditScenarioThread = new AuditScenarioThread(scenario.getLabel(), scenario.getContent(), auditService, act, parameterSet, locale);
    threadPoolTaskExecutor.submit(auditScenarioThread);
}
Also used : Parameter(org.asqatasun.entity.parameterization.Parameter) Scenario(org.asqatasun.webapp.entity.scenario.Scenario)

Example 8 with Scenario

use of org.asqatasun.webapp.entity.scenario.Scenario in project Asqatasun by Asqatasun.

the class ContractDAOImplTest method testSaveOrUpdate.

/**
     * Test of saveOrUpdate method, of class ContractDAOImpl.
     */
public void testSaveOrUpdate() {
    System.out.println("saveOrUpdate");
    Date beginDate = new Date();
    Date endDate = new Date();
    Date renewalDate = new Date();
    int nbOfContract = contractDAO.findAll().size();
    Set<Functionality> functionalitySet = new HashSet<Functionality>();
    Set<OptionElement> optionElementSet = new HashSet<OptionElement>();
    Set<Referential> referenceSet = new HashSet<Referential>();
    Set<Scenario> scenarioSet = new HashSet<Scenario>();
    Contract contract = contractFactory.createContract("Contract-test", beginDate, endDate, renewalDate, Float.valueOf(200), functionalitySet, optionElementSet, referenceSet, scenarioSet, null);
    contractDAO.saveOrUpdate(contract);
    assertEquals(nbOfContract + 1, contractDAO.findAll().size());
}
Also used : Referential(org.asqatasun.webapp.entity.referential.Referential) Functionality(org.asqatasun.webapp.entity.functionality.Functionality) OptionElement(org.asqatasun.webapp.entity.option.OptionElement) Contract(org.asqatasun.webapp.entity.contract.Contract) Date(java.util.Date) HashSet(java.util.HashSet) Scenario(org.asqatasun.webapp.entity.scenario.Scenario)

Aggregations

Scenario (org.asqatasun.webapp.entity.scenario.Scenario)8 Contract (org.asqatasun.webapp.entity.contract.Contract)4 Secured (org.springframework.security.access.annotation.Secured)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 HashSet (java.util.HashSet)2 ForbiddenPageException (org.asqatasun.webapp.exception.ForbiddenPageException)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Date (java.util.Date)1 Parameter (org.asqatasun.entity.parameterization.Parameter)1 AuditSetUpCommand (org.asqatasun.webapp.command.AuditSetUpCommand)1 Functionality (org.asqatasun.webapp.entity.functionality.Functionality)1 OptionElement (org.asqatasun.webapp.entity.option.OptionElement)1 Referential (org.asqatasun.webapp.entity.referential.Referential)1