Skip to content

Commit 855bbcd

Browse files
committed
added a bunch of log messages
1 parent 8971424 commit 855bbcd

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/main/java/de/unirostock/sems/cbarchive/web/UserManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ public UserManager() throws IOException {
6161
}
6262

6363
public UserManager( String workspaceId ) throws IOException {
64+
6465
if( workspaceId != null && !workspaceId.isEmpty() ) {
6566
workspace = workspaceManager.getWorkspace(workspaceId);
67+
LOGGER.debug("Trying to obtain workspace with id ", workspaceId);
6668
}
69+
6770
if( workspace == null ) {
71+
LOGGER.debug("Workspace with id ", workspaceId, " not found. Create new one with random id.");
6872
workspace = workspaceManager.createWorkspace();
6973
}
7074

src/main/java/de/unirostock/sems/cbarchive/web/WorkspaceManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public synchronized Workspace createWorkspace() throws IOException {
100100
workspace.updateLastseen();
101101
// add to settings
102102
workspaces.put(uuid, workspace);
103+
LOGGER.info("Created new workspace with id ", workspace.getWorkspaceId());
103104

104105
return workspace;
105106
}

src/main/java/de/unirostock/sems/cbarchive/web/rest/ShareApi.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public class ShareApi extends RestHelper {
8585
@Path("/share/{user_path}")
8686
@Produces( MediaType.TEXT_PLAIN )
8787
public Response setUserPath( @CookieParam(Fields.COOKIE_PATH) String oldUserPath, @PathParam("user_path") String userPath, @CookieParam(Fields.COOKIE_WORKSPACE_HISTORY) String historyCookie, @Context HttpServletRequest requestContext) {
88+
89+
LOGGER.debug("Got share link to workspace ", userPath);
8890
// user stuff
8991
UserManager user = null;
9092
try {
@@ -104,17 +106,21 @@ public Response setUserPath( @CookieParam(Fields.COOKIE_PATH) String oldUserPath
104106
history = new WorkspaceHistory();
105107

106108
// puts current workspace into history
107-
if( history.containsWorkspace(user.getWorkspaceId()) == false )
109+
if( history.containsWorkspace(user.getWorkspaceId()) == false ) {
108110
history.getRecentWorkspaces().add( user.getWorkspace() );
111+
LOGGER.debug("Added shared workspace to history. Wasn't added yet.");
112+
}
109113
history.setCurrentWorkspace( user.getWorkspaceId() );
114+
LOGGER.info("Set current workspace id to ", user.getWorkspaceId(), " from ", oldUserPath);
110115

111116
if( oldUserPath != null && !oldUserPath.isEmpty() && history.containsWorkspace( oldUserPath ) == false ) {
112117
Workspace workspace = WorkspaceManager.getInstance().getWorkspace(oldUserPath);
113-
if( workspace != null )
118+
if( workspace != null ) {
114119
history.getRecentWorkspaces().add( workspace );
120+
LOGGER.debug("Added old workspace to history ", oldUserPath);
121+
}
115122
}
116123

117-
history.setCurrentWorkspace( user.getWorkspaceId() );
118124
historyCookie = history.toCookieJson();
119125

120126
} catch (IOException e) {

0 commit comments

Comments
 (0)