Search in sources :

Example 1 with SchoolDataWorkspaceDiscoveredEvent

use of fi.otavanopisto.muikku.schooldata.events.SchoolDataWorkspaceDiscoveredEvent in project muikku by otavanopisto.

the class AcceptanceTestsRESTService method createWorkspace.

@POST
@Path("/workspaces")
@RESTPermit(handling = Handling.UNSECURED)
public Response createWorkspace(fi.otavanopisto.muikku.atests.Workspace payload) {
    SchoolDataWorkspaceDiscoveredEvent event = new SchoolDataWorkspaceDiscoveredEvent(payload.getSchoolDataSource(), payload.getIdentifier(), payload.getName(), null);
    schoolDataWorkspaceDiscoveredEvent.fire(event);
    WorkspaceEntity workspaceEntity = workspaceEntityController.findWorkspaceEntityById(event.getDiscoveredWorkspaceEntityId());
    if (payload.getPublished() != null) {
        workspaceEntityController.updatePublished(workspaceEntity, payload.getPublished());
    }
    return Response.ok(createRestEntity(workspaceEntity, payload.getName())).build();
}
Also used : WorkspaceEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceEntity) SchoolDataWorkspaceDiscoveredEvent(fi.otavanopisto.muikku.schooldata.events.SchoolDataWorkspaceDiscoveredEvent) Path(javax.ws.rs.Path) RESTPermit(fi.otavanopisto.security.rest.RESTPermit) POST(javax.ws.rs.POST)

Example 2 with SchoolDataWorkspaceDiscoveredEvent

use of fi.otavanopisto.muikku.schooldata.events.SchoolDataWorkspaceDiscoveredEvent in project muikku by otavanopisto.

the class PyramusUpdater method fireWorkspaceDiscovered.

private void fireWorkspaceDiscovered(Course course) {
    String identifier = identifierMapper.getWorkspaceIdentifier(course.getId());
    Map<String, Object> extra = new HashMap<>();
    extra.put("pyramusVariables", course.getVariables());
    schoolDataWorkspaceDiscoveredEvent.fire(new SchoolDataWorkspaceDiscoveredEvent(SchoolDataPyramusPluginDescriptor.SCHOOL_DATA_SOURCE, identifier, course.getName(), extra));
}
Also used : HashMap(java.util.HashMap) SchoolDataWorkspaceDiscoveredEvent(fi.otavanopisto.muikku.schooldata.events.SchoolDataWorkspaceDiscoveredEvent)

Aggregations

SchoolDataWorkspaceDiscoveredEvent (fi.otavanopisto.muikku.schooldata.events.SchoolDataWorkspaceDiscoveredEvent)2 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)1 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)1 HashMap (java.util.HashMap)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1