Skip to content

Commit

Permalink
Merge pull request #456 from CertifaiAI/cw_rmVerboseProjectLoader
Browse files Browse the repository at this point in the history
🎨 Remove redundant Projectloader param
  • Loading branch information
devenyantis authored Jul 5, 2021
2 parents 315d270 + 8dd9ef0 commit bf0c88f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public static ProjectLoader parseIn(@NonNull JsonObject jsonObject)
.projectName(jsonObject.getString(ParamConfig.getProjectNameParam())) //project_name
.annotationType(annotationInt) //annotation_type
.projectPath(new File(ActionConfig.getJsonFilePath())) //project_path
.isProjectNew(true) //is_new
.isProjectStarred(jsonObject.getBoolean(ParamConfig.getIsStarredParam())) //is_starred

.projectInfra(projectInfra) //project_infra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ public void reloadProject(Message<JsonObject> message)

ProjectLoader loader = Objects.requireNonNull(ProjectHandler.getProjectLoader(projectID));

ImageHandler.loadProjectRootPath(loader, false);
ImageHandler.loadProjectRootPath(loader);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import ai.classifai.data.type.image.ImageFileType;
import ai.classifai.database.DbConfig;
import ai.classifai.database.VerticleServiceable;
import ai.classifai.database.versioning.ProjectVersion;
import ai.classifai.loader.ProjectLoader;
import ai.classifai.loader.ProjectLoaderStatus;
import ai.classifai.selector.status.FileSystemStatus;
Expand Down Expand Up @@ -103,11 +102,8 @@ private static void writeWasabiCredential(Message<JsonObject> message)
.annotationType(annotationInt)
.projectPath(null)
.projectLoaderStatus(ProjectLoaderStatus.LOADED)
.isProjectStarred(Boolean.FALSE)
.isProjectNew(Boolean.TRUE)
.projectInfra(ProjectInfra.WASABI_S3)
.wasabiProject(wasabiProject)
.projectVersion(new ProjectVersion())
.build();

Tuple wasabiTuple = buildWasabiTuple(request, loader.getProjectId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public class ProjectLoader
private Integer annotationType;
private File projectPath;

private Boolean isProjectNew;
private Boolean isProjectStarred;

private ProjectInfra projectInfra;

//Load an existing project from database
//After loaded once, this value will be always LOADED so retrieving of project from memory than db
private ProjectLoaderStatus projectLoaderStatus;

private ProjectVersion projectVersion;
@Builder.Default private ProjectVersion projectVersion = new ProjectVersion();

@Builder.Default private Boolean isProjectNew = Boolean.TRUE;
@Builder.Default private Boolean isProjectStarred = Boolean.FALSE;

@Builder.Default private WasabiProject wasabiProject = null;

Expand Down Expand Up @@ -268,7 +268,7 @@ public void initFolderIteration()
{
try
{
if(!ImageHandler.loadProjectRootPath(this, true))
if(!ImageHandler.loadProjectRootPath(this))
{
// Get example image from metadata
File srcImgFile = Paths.get(".", "metadata", "classifai_overview.png").toFile();
Expand All @@ -277,7 +277,7 @@ public void initFolderIteration()
log.info("Empty folder. Example image added.");

// Run loadProjectRootPath again
if(!ImageHandler.loadProjectRootPath(this, true))
if(!ImageHandler.loadProjectRootPath(this))
{
log.debug("Loading files in project folder failed");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import ai.classifai.action.ProjectExport;
import ai.classifai.database.annotation.AnnotationQuery;
import ai.classifai.database.portfolio.PortfolioDbQuery;
import ai.classifai.database.versioning.ProjectVersion;
import ai.classifai.loader.ProjectLoader;
import ai.classifai.loader.ProjectLoaderStatus;
import ai.classifai.selector.project.LabelFileSelector;
Expand Down Expand Up @@ -231,9 +230,6 @@ protected void createRawProject(JsonObject requestBody, RoutingContext context)
.projectPath(new File(projectPath))
.labelList(labelList)
.projectLoaderStatus(ProjectLoaderStatus.LOADED)
.isProjectStarred(Boolean.FALSE)
.isProjectNew(Boolean.TRUE)
.projectVersion(new ProjectVersion())
.projectInfra(ProjectInfra.ON_PREMISE)
.fileSystemStatus(FileSystemStatus.ITERATING_FOLDER)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ private static List<String> getUnsupportedImagesFromFolder(File rootPath)
* scenario 4: adding new files
* scenario 5: evrything stills the same
*/
public static boolean loadProjectRootPath(@NonNull ProjectLoader loader, boolean isNewProject)
public static boolean loadProjectRootPath(@NonNull ProjectLoader loader)
{
if(isNewProject)
if(Boolean.TRUE.equals(loader.getIsProjectNew()))
{
loader.resetFileSysProgress(FileSystemStatus.ITERATING_FOLDER);
}
Expand Down Expand Up @@ -367,7 +367,7 @@ public static boolean loadProjectRootPath(@NonNull ProjectLoader loader, boolean
loader.setFileSysTotalUUIDSize(dataFullPathList.size());

//scenario 3 - 5
if(isNewProject)
if(Boolean.TRUE.equals(loader.getIsProjectNew()))
{
saveToProjectTable(loader, dataFullPathList);
}
Expand Down

0 comments on commit bf0c88f

Please sign in to comment.