Пример #1
0
  @Override
  public Challenge from(final ChallengeTO tObject) throws ObjectNotFoundException {
    final Challenge model = super.from(tObject);

    model.setSelfHelpGuideQuestion(tObject.getSelfHelpGuideQuestion());
    model.setSelfHelpGuideDescription(tObject.getSelfHelpGuideDescription());
    model.setShowInSelfHelpSearch(tObject.isShowInSelfHelpSearch());
    model.setShowInStudentIntake(tObject.isShowInStudentIntake());
    model.setTags(tObject.getTags());

    if (tObject.getDefaultConfidentialityLevelId() == null) {
      model.setDefaultConfidentialityLevel(null);
    } else {
      try {
        model.setDefaultConfidentialityLevel(
            confidentialityLevelService.get(tObject.getDefaultConfidentialityLevelId()));
      } catch (final ObjectNotFoundException exc) {
        throw new ObjectNotFoundException(
            tObject.getDefaultConfidentialityLevelId(),
            "ConfidentialityLevel",
            "Invalid confidentiality level for this challenge.",
            exc);
      }
    }

    return model;
  }
 /** Setup the security service with the administrator user. */
 @Before
 public void setUp() {
   securityService.setCurrent(
       new Person(Person.SYSTEM_ADMINISTRATOR_ID),
       confidentialityLevelService.confidentialityLevelsAsGrantedAuthorities(),
       "ROLE_PERSON_JOURNAL_ENTRY_READ",
       "ROLE_PERSON_JOURNAL_ENTRY_WRITE",
       "ROLE_PERSON_JOURNAL_ENTRY_DELETE",
       CONFIDENTIALITY_LEVEL_PERMISSION.asPermissionString());
 }