use of org.asqatasun.webapp.entity.functionality.Functionality in project Asqatasun by Asqatasun.
the class CreateContractCommandFactory method addFunctionalityToCommand.
/**
*
*/
private void addFunctionalityToCommand(CreateContractCommand ccc, Contract contract) {
Map<String, Boolean> functMap = new LinkedHashMap<String, Boolean>();
for (Functionality funct : this.functionalityList) {
if (contract.getFunctionalitySet().contains(funct)) {
functMap.put(funct.getCode(), Boolean.TRUE);
} else {
functMap.put(funct.getCode(), Boolean.FALSE);
}
}
ccc.setFunctionalityMap(functMap);
}
use of org.asqatasun.webapp.entity.functionality.Functionality in project Asqatasun by Asqatasun.
the class ContractActionHandlerImpl method getActionList.
@Override
public synchronized List<Action> getActionList(Object object) {
if (!(object instanceof Contract)) {
return null;
}
List<Action> userContractActionList = getActionList();
Collection<Functionality> functionalitySet = ((Contract) object).getFunctionalitySet();
for (Action action : userContractActionList) {
activateAction(action, functionalitySet);
}
return userContractActionList;
}
use of org.asqatasun.webapp.entity.functionality.Functionality in project Asqatasun by Asqatasun.
the class CreateContractCommandFactory method addNewFunctionalityToCommand.
/**
*
* @param ccc
*/
private void addNewFunctionalityToCommand(CreateContractCommand ccc) {
Map<String, Boolean> functMap = new LinkedHashMap<String, Boolean>();
for (Functionality funct : this.functionalityList) {
functMap.put(funct.getCode(), Boolean.FALSE);
}
ccc.setFunctionalityMap(functMap);
}
use of org.asqatasun.webapp.entity.functionality.Functionality in project Asqatasun by Asqatasun.
the class ContractDAOImplTest method testRead.
/**
* Test of read method, of class ContractDAOImpl.
*/
public void testRead() {
System.out.println("read");
Contract contract = contractDAO.read(Long.valueOf(1));
assertNotNull(contract);
assertEquals("http://www.contract1.com/", contractDataService.getUrlFromContractOption(contract));
assertEquals(Long.valueOf("1"), contract.getUser().getId());
Set<String> functionalityCodeSet = new HashSet<String>();
for (Functionality functionality : contract.getFunctionalitySet()) {
functionalityCodeSet.add(functionality.getCode());
}
assertTrue(functionalityCodeSet.contains("PAGES_AUDIT"));
assertTrue(!functionalityCodeSet.contains("SITE_AUDIT"));
assertEquals(1, contract.getReferentialSet().size());
assertTrue(contract.getScenarioSet().isEmpty());
contract = contractDAO.read(Long.valueOf(2));
assertNotNull(contract);
assertEquals("http://www.contract2.com/", contractDataService.getUrlFromContractOption(contract));
assertEquals(Long.valueOf("1"), contract.getUser().getId());
functionalityCodeSet = new HashSet<String>();
for (Functionality functionality : contract.getFunctionalitySet()) {
functionalityCodeSet.add(functionality.getCode());
}
assertTrue(functionalityCodeSet.contains("PAGES_AUDIT"));
assertTrue(functionalityCodeSet.contains("SITE_AUDIT"));
assertEquals(2, contract.getReferentialSet().size());
assertEquals(2, contract.getScenarioSet().size());
contract = contractDAO.read(Long.valueOf(3));
assertNull(contract);
}
use of org.asqatasun.webapp.entity.functionality.Functionality 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());
}
Aggregations