Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-5716 - Renaming a file is not reflected on the list of files contained by samples #2410

Merged
merged 4 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private void status() throws CatalogException, JsonProcessingException {
if (catalogManager.existsCatalogDB()) {
result.put("installed", true);

MongoDBAdaptorFactory factory = new MongoDBAdaptorFactory(configuration);
MongoDBAdaptorFactory factory = new MongoDBAdaptorFactory(configuration, catalogManager.getIoManagerFactory());
MongoDBCollection metaCollection = factory.getMongoDBCollectionMap().get(MongoDBAdaptorFactory.METADATA_COLLECTION);
Document metaDocument = metaCollection.find(new Document(), QueryOptions.empty()).first();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ OpenCGAResult update(Query query, ObjectMap parameters, List<VariableSet> variab
/**
* Add the variable to all the possible annotations from the variableSetId using the default value.
*
* @param studyUid Study uid.
* @param variableSetId variable set id to identify the annotations that will add a new annotation.
* @param variable new variable that will be added.
* @param variable new variable that will be added.
* @return a OpenCGAResult object.
* @throws CatalogDBException if the variable could not be added to an existing annotationSet.
* @throws CatalogParameterException if there is any unexpected parameter.
* @throws CatalogAuthorizationException if the operation is not authorized.
*/
OpenCGAResult addVariableToAnnotations(long variableSetId, Variable variable) throws CatalogDBException;
OpenCGAResult addVariableToAnnotations(long studyUid, long variableSetId, Variable variable)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

// /**
// * This method will rename the id of all the annotations corresponding to the variableSetId changing oldName per newName.
Expand All @@ -80,21 +84,25 @@ OpenCGAResult update(Query query, ObjectMap parameters, List<VariableSet> variab
/**
* Remove the annotation with annotationName from the annotation set.
*
* @param variableSetId variable set id for which the annotationSets have to delete the annotation.
* @param studyUid Study uid.
* @param variableSetId variable set id for which the annotationSets have to delete the annotation.
* @param annotationName Annotation name.
* @return a OpenCGAResult object.
* @throws CatalogDBException when there is an error in the database.
* @throws CatalogParameterException if there is any unexpected parameter.
* @throws CatalogAuthorizationException if the operation is not authorized.
*/
OpenCGAResult removeAnnotationField(long variableSetId, String annotationName) throws CatalogDBException;
OpenCGAResult removeAnnotationField(long studyUid, long variableSetId, String annotationName)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

/**
* Makes a groupBy to obtain the different values that every annotation has and the total number of each.
*
*
* @param studyId study id.
* @param studyUid study uid.
* @param variableSetId variable set id for which the group by will be done.
* @return a list of Feature count with every different value.
* @throws CatalogDBException when there is an error in the database.
*/
OpenCGAResult<VariableSummary> getAnnotationSummary(long studyId, long variableSetId) throws CatalogDBException;
OpenCGAResult<VariableSummary> getAnnotationSummary(long studyUid, long variableSetId) throws CatalogDBException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
import org.opencb.opencga.catalog.exceptions.CatalogParameterException;
import org.opencb.opencga.core.response.OpenCGAResult;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;

/**
Expand Down Expand Up @@ -61,19 +59,6 @@ default OpenCGAResult<T> stats() {
OpenCGAResult<T> get(Query query, QueryOptions options)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

OpenCGAResult nativeGet(Query query, QueryOptions options)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

default List<OpenCGAResult> nativeGet(List<Query> queries, QueryOptions options)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException {
Objects.requireNonNull(queries);
List<OpenCGAResult> queryResults = new ArrayList<>(queries.size());
for (Query query : queries) {
queryResults.add(nativeGet(query, options));
}
return queryResults;
}

OpenCGAResult<T> update(long id, ObjectMap parameters, QueryOptions queryOptions)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,32 +287,6 @@ OpenCGAResult<File> get(long fileId, QueryOptions options)
OpenCGAResult<File> getAllInStudy(long studyId, QueryOptions options)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

/***
* Retrieves all the files present in the folder.
*
* @param studyId Study id where the files will be extracted from.
* @param path Directory where the files will be extracted from.
* @param options Options to filter the file output.
* @return A OpenCGAResult object containing the files present in the folder of the given study.
* @throws CatalogDBException when the study or the path does not exist.
*/
OpenCGAResult<File> getAllFilesInFolder(long studyId, String path, QueryOptions options) throws CatalogDBException;

/***
* Renames the file.
*
* @param fileId Id of the file to be renamed.
* @param filePath New file or directory name (containing the full path).
* @param fileUri New file uri (containing the full path).
* @param options Options to filter the file output.
* @return A OpenCGAResult object.
* @throws CatalogDBException when the filePath already exists.
* @throws CatalogParameterException if there is any formatting error.
* @throws CatalogAuthorizationException if the user is not authorised to perform the query.
*/
OpenCGAResult rename(long fileId, String filePath, String fileUri, QueryOptions options)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

/**
* Removes the mark of the permission rule (if existed) from all the entries from the study to notify that permission rule would need to
* be applied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,9 @@ default List<OpenCGAResult<Project>> get(List<Query> queries, QueryOptions optio
return queryResults;
}

OpenCGAResult nativeGet(Query query, QueryOptions options) throws CatalogDBException;

OpenCGAResult nativeGet(Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException;

default List<OpenCGAResult> nativeGet(List<Query> queries, QueryOptions options) throws CatalogDBException {
Objects.requireNonNull(queries);
List<OpenCGAResult> queryResults = new ArrayList<>(queries.size());
for (Query query : queries) {
queryResults.add(nativeGet(query, options));
}
return queryResults;
}

OpenCGAResult<Project> update(long id, ObjectMap parameters, QueryOptions queryOptions)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,9 @@ default List<OpenCGAResult<Study>> get(List<Query> queries, QueryOptions options
return queryResults;
}

OpenCGAResult nativeGet(Query query, QueryOptions options) throws CatalogDBException;

OpenCGAResult nativeGet(Query query, QueryOptions options, String user)
throws CatalogDBException, CatalogAuthorizationException;

default List<OpenCGAResult> nativeGet(List<Query> queries, QueryOptions options) throws CatalogDBException {
Objects.requireNonNull(queries);
List<OpenCGAResult> queryResults = new ArrayList<>(queries.size());
for (Query query : queries) {
queryResults.add(nativeGet(query, options));
}
return queryResults;
}

OpenCGAResult<Study> update(long id, ObjectMap parameters, QueryOptions queryOptions)
throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException;

Expand Down Expand Up @@ -395,14 +384,14 @@ default void checkVariableSetExists(String variableSetId, long studyId) throws C

OpenCGAResult<VariableSet> createVariableSet(long studyId, VariableSet variableSet) throws CatalogDBException;

OpenCGAResult<VariableSet> addFieldToVariableSet(long variableSetId, Variable variable, String user)
throws CatalogDBException, CatalogAuthorizationException;
OpenCGAResult<VariableSet> addFieldToVariableSet(long studyUid, long variableSetId, Variable variable, String user)
throws CatalogDBException, CatalogAuthorizationException, CatalogParameterException;

OpenCGAResult<VariableSet> renameFieldVariableSet(long variableSetId, String oldName, String newName, String user)
throws CatalogDBException, CatalogAuthorizationException;

OpenCGAResult<VariableSet> removeFieldFromVariableSet(long variableSetId, String name, String user)
throws CatalogDBException, CatalogAuthorizationException;
OpenCGAResult<VariableSet> removeFieldFromVariableSet(long studyUid, long variableSetId, String name, String user)
throws CatalogDBException, CatalogAuthorizationException, CatalogParameterException;

OpenCGAResult<VariableSet> getVariableSet(long variableSetUid, QueryOptions options) throws CatalogDBException;

Expand Down
Loading
Loading