forked from cBioPortal/cbioportal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REVERT ME: Remove the need for session service dependency.
Pending PR cBioPortal/session-service#45
- Loading branch information
1 parent
7136377
commit 0c4831f
Showing
14 changed files
with
146 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
utils/src/main/java/org/cbioportal/utils/removeme/Session.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package org.cbioportal.utils.removeme; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonView; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Size; | ||
import org.bson.Document; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.util.DigestUtils; | ||
|
||
// TODO this class was taken from session service. The session service dependency had to be dropped | ||
// since it forced cbioportal into autoconfiguration of mongoDB connections. | ||
// When session service is updated reinstate the correct session service dependency. | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class Session { | ||
|
||
public enum SessionType { | ||
main_session, | ||
virtual_study, | ||
group, | ||
comparison_session, | ||
settings, | ||
custom_data, | ||
genomic_chart, | ||
custom_gene_list | ||
} | ||
|
||
@Id | ||
private String id; | ||
@NotNull | ||
private String checksum; | ||
@NotNull | ||
private Object data; | ||
@NotNull | ||
@Size(min=3, message="source has a minimum length of 3") | ||
private String source; | ||
@NotNull | ||
private SessionType type; | ||
|
||
|
||
@JsonView(Session.Views.IdOnly.class) | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getChecksum() { | ||
return checksum; | ||
} | ||
|
||
public void setData(Object data) { | ||
if(data instanceof String) { | ||
this.data = Document.parse((String)data); | ||
} else { | ||
this.data = data; | ||
} | ||
this.checksum = DigestUtils.md5DigestAsHex(this.data.toString().getBytes()); | ||
} | ||
|
||
@JsonView(Session.Views.Full.class) | ||
public Object getData() { | ||
return data; | ||
} | ||
|
||
public void setType(SessionType type) { | ||
this.type = type; | ||
} | ||
|
||
@JsonView(org.cbioportal.utils.removeme.Session.Views.Full.class) | ||
public SessionType getType() { | ||
return type; | ||
} | ||
|
||
public void setSource(String source) { | ||
this.source = source; | ||
} | ||
|
||
@JsonView(Session.Views.Full.class) | ||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public static final class Views { | ||
// show only id | ||
public interface IdOnly {} | ||
|
||
// show all data | ||
public interface Full extends Session.Views.IdOnly {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
web/src/main/java/org/cbioportal/web/util/SessionServiceRequestHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters