use of ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentSetController method create.
public Collection<ExpressionExperimentSetValueObject> create(Collection<ExpressionExperimentSetValueObject> entities) {
Collection<Long> eeSetIds = new HashSet<>();
for (ExpressionExperimentSetValueObject ees : entities) {
if (ees.getExpressionExperimentIds() == null || ees.getExpressionExperimentIds().isEmpty()) {
throw new IllegalArgumentException("No expression experiment ids provided. Cannot save an empty set.");
}
ExpressionExperimentSet newEESet = this.create(ees);
eeSetIds.add(newEESet.getId());
}
return this.expressionExperimentSetService.loadValueObjectsByIds(eeSetIds);
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject 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;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject 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 + "}";
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject 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;
}
use of ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject in project Gemma by PavlidisLab.
the class ExpressionExperimentSetIDsEndpoint method invokeInternal.
/**
* Reads the given <code>requestElement</code>, and sends a the response back.
*
* @param requestElement the contents of the SOAP message as DOM elements
* @param document a DOM document to be used for constructing <code>Node</code>s
* @return the response element
*/
@Override
protected Element invokeInternal(Element requestElement, Document document) {
authenticate();
StopWatch watch = new StopWatch();
watch.start();
setLocalName(LOCAL_NAME);
Collection<ExpressionExperimentSetValueObject> eesCol = expressionExperimentSetService.loadAllExperimentSetValueObjects(false);
// retain expression experiment sets that have a name assigned (probably not necessary?)
Collection<ExpressionExperimentSetValueObject> eesColToUse = new HashSet<ExpressionExperimentSetValueObject>();
for (ExpressionExperimentSetValueObject ees : eesCol) {
if (ees.getName() != null)
eesColToUse.add(ees);
}
// start building the wrapper
// build xml manually for mapped result rather than use buildWrapper inherited from AbstractGemmeEndpoint
Element responseWrapper = document.createElementNS(NAMESPACE_URI, LOCAL_NAME);
Element responseElement = document.createElementNS(NAMESPACE_URI, LOCAL_NAME + RESPONSE);
responseWrapper.appendChild(responseElement);
for (ExpressionExperimentSetValueObject ees : eesColToUse) {
Element e1 = document.createElement("expression_experiment_set_id");
e1.appendChild(document.createTextNode(ees.getId().toString()));
responseElement.appendChild(e1);
Element e2 = document.createElement("ees_name");
e2.appendChild(document.createTextNode(ees.getName()));
responseElement.appendChild(e2);
Collection<Long> eeIds = ees.getExpressionExperimentIds();
Element e3 = document.createElement("datasets");
e3.appendChild(document.createTextNode(encode(eeIds.toArray())));
responseElement.appendChild(e3);
Element e4 = document.createElement("taxon");
assert ees.getTaxonId() != null;
e4.appendChild(document.createTextNode(ees.getTaxonId().toString()));
responseElement.appendChild(e4);
}
watch.stop();
Long time = watch.getTime();
// log.info( "Finished generating result. Sending response to client." );
if (time > 1000) {
log.info("XML response for Experiment Set IDs results built in " + time + "ms.");
}
return responseWrapper;
}
Aggregations