Search in sources :

Example 1 with SessionBoundExpressionExperimentSetValueObject

use of ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject in project Gemma by PavlidisLab.

the class ExpressionExperimentSetController method updateUserAndSessionGroups.

/**
 * AJAX Updates the session group and user database groups.
 */
public Collection<ExpressionExperimentSetValueObject> updateUserAndSessionGroups(Collection<ExpressionExperimentSetValueObject> vos) {
    Collection<ExpressionExperimentSetValueObject> updatedSets = new HashSet<>();
    Collection<ExpressionExperimentSetValueObject> databaseCollection = new HashSet<>();
    Collection<SessionBoundExpressionExperimentSetValueObject> sessionCollection = new HashSet<>();
    for (ExpressionExperimentSetValueObject experimentSetValueObject : vos) {
        if (experimentSetValueObject instanceof SessionBoundExpressionExperimentSetValueObject) {
            sessionCollection.add((SessionBoundExpressionExperimentSetValueObject) experimentSetValueObject);
        } else {
            databaseCollection.add(experimentSetValueObject);
        }
    }
    sessionCollection = this.updateSessionGroups(sessionCollection);
    databaseCollection = this.update(databaseCollection);
    updatedSets.addAll(sessionCollection);
    updatedSets.addAll(databaseCollection);
    return updatedSets;
}
Also used : SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) ExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject) SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) HashSet(java.util.HashSet)

Example 2 with SessionBoundExpressionExperimentSetValueObject

use of ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject in project Gemma by PavlidisLab.

the class ExpressionExperimentSetController method removeUserAndSessionGroups.

/**
 * AJAX Given valid experiment groups will remove them from the session or the database appropriately.
 */
public Collection<ExpressionExperimentSetValueObject> removeUserAndSessionGroups(Collection<ExpressionExperimentSetValueObject> vos) {
    Collection<ExpressionExperimentSetValueObject> removedSets = new HashSet<>();
    Collection<ExpressionExperimentSetValueObject> databaseCollection = new HashSet<>();
    Collection<SessionBoundExpressionExperimentSetValueObject> sessionCollection = new HashSet<>();
    for (ExpressionExperimentSetValueObject experimentSetValueObject : vos) {
        if (experimentSetValueObject instanceof SessionBoundExpressionExperimentSetValueObject) {
            sessionCollection.add((SessionBoundExpressionExperimentSetValueObject) experimentSetValueObject);
        } else {
            databaseCollection.add(experimentSetValueObject);
        }
    }
    sessionCollection = this.removeSessionGroups(sessionCollection);
    databaseCollection = this.remove(databaseCollection);
    removedSets.addAll(sessionCollection);
    removedSets.addAll(databaseCollection);
    return removedSets;
}
Also used : SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) ExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject) SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) HashSet(java.util.HashSet)

Example 3 with SessionBoundExpressionExperimentSetValueObject

use of ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject in project Gemma by PavlidisLab.

the class ExpressionExperimentSetController method canCurrentUserEditGroup.

/**
 * AJAX returns a JSON string encoding whether the current user owns the group and whether the group is db-backed
 */
public String canCurrentUserEditGroup(ExpressionExperimentSetValueObject eesvo) {
    boolean userCanEditGroup = false;
    boolean groupIsDBBacked = false;
    if (!(eesvo instanceof SessionBoundExpressionExperimentSetValueObject)) {
        groupIsDBBacked = true;
        try {
            ExpressionExperimentSetValueObject set = expressionExperimentSetService.loadValueObject(expressionExperimentSetService.load(eesvo.getId()));
            userCanEditGroup = (set.getUserCanWrite() && set.isModifiable());
        } catch (org.springframework.security.access.AccessDeniedException ade) {
            return "{groupIsDBBacked:" + true + ",userCanEditGroup:" + false + "}";
        }
    }
    return "{groupIsDBBacked:" + groupIsDBBacked + ",userCanEditGroup:" + userCanEditGroup + "}";
}
Also used : SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) ExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject) SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) AccessDeniedException(org.springframework.security.access.AccessDeniedException)

Example 4 with SessionBoundExpressionExperimentSetValueObject

use of ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject in project Gemma by PavlidisLab.

the class ExpressionExperimentSetController method addUserAndSessionGroups.

/**
 * AJAX adds the experiment group to the session
 *
 * @return the new gene groups
 */
public Collection<ExpressionExperimentSetValueObject> addUserAndSessionGroups(Collection<ExpressionExperimentSetValueObject> sets) {
    Collection<ExpressionExperimentSetValueObject> result = new HashSet<>();
    Collection<SessionBoundExpressionExperimentSetValueObject> sessionResult = new HashSet<>();
    for (ExpressionExperimentSetValueObject eesvo : sets) {
        if (eesvo instanceof SessionBoundExpressionExperimentSetValueObject) {
            sessionResult.add((SessionBoundExpressionExperimentSetValueObject) eesvo);
        } else {
            result.add(eesvo);
        }
    }
    result = this.create(result);
    result.addAll(this.addSessionGroups(sessionResult, true));
    return result;
}
Also used : SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) ExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject) SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) HashSet(java.util.HashSet)

Aggregations

ExpressionExperimentSetValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject)4 SessionBoundExpressionExperimentSetValueObject (ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject)4 HashSet (java.util.HashSet)3 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1