Search in sources :

Example 1 with AssessmentRequestRESTModel

use of fi.otavanopisto.muikku.plugins.assessmentrequest.rest.model.AssessmentRequestRESTModel in project muikku by otavanopisto.

the class AssessmentRequestRESTService method restModel.

private AssessmentRequestRESTModel restModel(WorkspaceAssessmentRequest workspaceAssessmentRequest) {
    SchoolDataIdentifier workspaceUserIdentifier = new SchoolDataIdentifier(workspaceAssessmentRequest.getWorkspaceUserIdentifier(), workspaceAssessmentRequest.getWorkspaceUserSchoolDataSource());
    WorkspaceUserEntity workspaceUserEntity = workspaceUserEntityController.findWorkspaceUserEntityByWorkspaceUserIdentifier(workspaceUserIdentifier);
    if (workspaceUserEntity != null) {
        SchoolDataIdentifier userIdentifier = new SchoolDataIdentifier(workspaceUserEntity.getUserSchoolDataIdentifier().getIdentifier(), workspaceUserEntity.getUserSchoolDataIdentifier().getDataSource().getIdentifier());
        SchoolDataIdentifier workspaceAssessmentRequestIdentifier = new SchoolDataIdentifier(workspaceAssessmentRequest.getIdentifier(), workspaceAssessmentRequest.getSchoolDataSource());
        WorkspaceEntity workspaceEntity = workspaceUserEntity.getWorkspaceEntity();
        UserEntity userEntity = workspaceUserEntity.getUserSchoolDataIdentifier().getUserEntity();
        AssessmentRequestRESTModel restAssessmentRequest = new AssessmentRequestRESTModel(workspaceAssessmentRequestIdentifier.toId(), userIdentifier.toId(), workspaceUserIdentifier.toId(), workspaceEntity.getId(), userEntity.getId(), workspaceAssessmentRequest.getRequestText(), workspaceAssessmentRequest.getDate());
        return restAssessmentRequest;
    }
    return null;
}
Also used : SchoolDataIdentifier(fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier) WorkspaceUserEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity) WorkspaceEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceEntity) AssessmentRequestRESTModel(fi.otavanopisto.muikku.plugins.assessmentrequest.rest.model.AssessmentRequestRESTModel) WorkspaceUserEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity) UserEntity(fi.otavanopisto.muikku.model.users.UserEntity)

Aggregations

UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)1 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)1 WorkspaceUserEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceUserEntity)1 AssessmentRequestRESTModel (fi.otavanopisto.muikku.plugins.assessmentrequest.rest.model.AssessmentRequestRESTModel)1 SchoolDataIdentifier (fi.otavanopisto.muikku.schooldata.SchoolDataIdentifier)1