repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public SeriesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SeriesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
public String toPath() throws DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStoresPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStoresPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStoresPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/App.java
// Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // }
import com.beust.jcommander.JCommander; import com.google.dicomwebfuse.exception.DicomFuseException; import com.google.dicomwebfuse.parser.Arguments; import java.io.IOException; import java.util.ResourceBundle; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse; public class App { private static final Logger LOGGER = LogManager.getLogger(); public static void main(String[] args) {
// Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // } // Path: src/main/java/com/google/dicomwebfuse/App.java import com.beust.jcommander.JCommander; import com.google.dicomwebfuse.exception.DicomFuseException; import com.google.dicomwebfuse.parser.Arguments; import java.io.IOException; import java.util.ResourceBundle; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse; public class App { private static final Logger LOGGER = LogManager.getLogger(); public static void main(String[] args) {
Arguments arguments = new Arguments();
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/App.java
// Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // }
import com.beust.jcommander.JCommander; import com.google.dicomwebfuse.exception.DicomFuseException; import com.google.dicomwebfuse.parser.Arguments; import java.io.IOException; import java.util.ResourceBundle; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse; public class App { private static final Logger LOGGER = LogManager.getLogger(); public static void main(String[] args) { Arguments arguments = new Arguments(); JCommander jCommander = JCommander.newBuilder() .addObject(arguments) .resourceBundle(ResourceBundle.getBundle("cli-messages")) .programName("DICOMFuse") .build(); jCommander.parse(args); if (arguments.help) { jCommander.usage(); return; } try { AppMountProcess appMountProcess = new AppMountProcess(arguments); appMountProcess.startMountProcess();
// Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // } // Path: src/main/java/com/google/dicomwebfuse/App.java import com.beust.jcommander.JCommander; import com.google.dicomwebfuse.exception.DicomFuseException; import com.google.dicomwebfuse.parser.Arguments; import java.io.IOException; import java.util.ResourceBundle; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse; public class App { private static final Logger LOGGER = LogManager.getLogger(); public static void main(String[] args) { Arguments arguments = new Arguments(); JCommander jCommander = JCommander.newBuilder() .addObject(arguments) .resourceBundle(ResourceBundle.getBundle("cli-messages")) .programName("DICOMFuse") .build(); jCommander.parse(args); if (arguments.help) { jCommander.usage(); return; } try { AppMountProcess appMountProcess = new AppMountProcess(arguments); appMountProcess.startMountProcess();
} catch (IOException | DicomFuseException e) {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class InstancePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public InstancePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class InstancePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public InstancePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
public String toPath() throws DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
} String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
} String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
} String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
} String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } String instanceId = queryBuilder.getInstanceId(); if (instanceId == null) { throw new DicomFuseException("Instance must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/test/java/com/google/dicomwebfuse/TestUtils.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse; /** * Util class with helper methods for unit tests. */ public class TestUtils { /** * Generates mocked HttpClientFactory. * * @param closeableHttpClient mocked CloseableHttpClient * @return generated HttpClientFactory */ public static HttpClientFactory prepareHttpClientFactory( CloseableHttpClient closeableHttpClient) { HttpClientFactory httpClientFactory = Mockito.mock(HttpClientFactory.class); Mockito.when(httpClientFactory.createHttpClient()).thenReturn(closeableHttpClient); return httpClientFactory; } /** * Prepares content for closeableHttpClient. * * @param closeableHttpClient mocked CloseableHttpClient * @param entityCount how many entities would be generated * @param entityType type of entity * @param statusCode http status code */ public static void prepareHttpClient(CloseableHttpClient closeableHttpClient, int entityCount,
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/test/java/com/google/dicomwebfuse/TestUtils.java import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse; /** * Util class with helper methods for unit tests. */ public class TestUtils { /** * Generates mocked HttpClientFactory. * * @param closeableHttpClient mocked CloseableHttpClient * @return generated HttpClientFactory */ public static HttpClientFactory prepareHttpClientFactory( CloseableHttpClient closeableHttpClient) { HttpClientFactory httpClientFactory = Mockito.mock(HttpClientFactory.class); Mockito.when(httpClientFactory.createHttpClient()).thenReturn(closeableHttpClient); return httpClientFactory; } /** * Prepares content for closeableHttpClient. * * @param closeableHttpClient mocked CloseableHttpClient * @param entityCount how many entities would be generated * @param entityType type of entity * @param statusCode http status code */ public static void prepareHttpClient(CloseableHttpClient closeableHttpClient, int entityCount,
EntityType entityType, int statusCode) throws IOException, DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/test/java/com/google/dicomwebfuse/TestUtils.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
/** * Generates AuthAdc with a mocked token. * * @param token mocked token * @return generated AuthAdc */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY:
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/test/java/com/google/dicomwebfuse/TestUtils.java import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; /** * Generates AuthAdc with a mocked token. * * @param token mocked token * @return generated AuthAdc */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY:
entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/test/java/com/google/dicomwebfuse/TestUtils.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
* Generates AuthAdc with a mocked token. * * @param token mocked token * @return generated AuthAdc */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/test/java/com/google/dicomwebfuse/TestUtils.java import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; * Generates AuthAdc with a mocked token. * * @param token mocked token * @return generated AuthAdc */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY;
maxEntities = MAX_STUDIES_IN_DICOM_STORE;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/test/java/com/google/dicomwebfuse/TestUtils.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
* @return generated AuthAdc */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY; maxEntities = MAX_STUDIES_IN_DICOM_STORE; break; case SERIES:
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/test/java/com/google/dicomwebfuse/TestUtils.java import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; * @return generated AuthAdc */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY; maxEntities = MAX_STUDIES_IN_DICOM_STORE; break; case SERIES:
entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/test/java/com/google/dicomwebfuse/TestUtils.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
*/ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY; maxEntities = MAX_STUDIES_IN_DICOM_STORE; break; case SERIES: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/test/java/com/google/dicomwebfuse/TestUtils.java import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; */ public static AuthAdc prepareAuthAdc(String token) { AccessToken accessToken = new AccessToken(token, null); GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY; maxEntities = MAX_STUDIES_IN_DICOM_STORE; break; case SERIES: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES;
maxEntities = MAX_SERIES_IN_STUDY;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/test/java/com/google/dicomwebfuse/TestUtils.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito;
GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY; maxEntities = MAX_STUDIES_IN_DICOM_STORE; break; case SERIES: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES; maxEntities = MAX_SERIES_IN_STUDY; break; case INSTANCE:
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_SERIES_IN_STUDY = VALUE_PARAM_MAX_LIMIT_FOR_SERIES * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer MAX_STUDIES_IN_DICOM_STORE = VALUE_PARAM_MAX_LIMIT_FOR_STUDY * 3; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES = 15000; // max - 50 000 results // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_SERIES = 5000; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final Integer VALUE_PARAM_MAX_LIMIT_FOR_STUDY = 5000; // // Path: src/main/java/com/google/dicomwebfuse/auth/AuthAdc.java // public class AuthAdc { // // private static final List<String> SCOPES = Collections.singletonList( // "https://www.googleapis.com/auth/cloud-healthcare" // ); // private GoogleCredentials googleCredentials; // // public AuthAdc(GoogleCredentials googleCredentials) { // this.googleCredentials = googleCredentials; // } // // public AuthAdc() { // } // // public void createCredentials(Path keyPath) throws IOException { // InputStream inputStream = new FileInputStream(keyPath.toFile()); // googleCredentials = GoogleCredentials.fromStream(inputStream).createScoped(SCOPES); // } // // public void createCredentials() throws IOException { // googleCredentials = GoogleCredentials.getApplicationDefault().createScoped(SCOPES); // } // // public GoogleCredentials getCredentials() throws IOException { // googleCredentials.getRequestMetadata(); // Update token if it necessary. // return googleCredentials; // } // } // // Path: src/main/java/com/google/dicomwebfuse/dao/http/HttpClientFactory.java // public interface HttpClientFactory { // // CloseableHttpClient createHttpClient(); // } // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/test/java/com/google/dicomwebfuse/TestUtils.java import static com.google.dicomwebfuse.EntityType.DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.MAX_INSTANCES_IN_SERIES; import static com.google.dicomwebfuse.dao.Constants.MAX_SERIES_IN_STUDY; import static com.google.dicomwebfuse.dao.Constants.MAX_STUDIES_IN_DICOM_STORE; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_SERIES; import static com.google.dicomwebfuse.dao.Constants.VALUE_PARAM_MAX_LIMIT_FOR_STUDY; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.GoogleCredentials; import com.google.dicomwebfuse.auth.AuthAdc; import com.google.dicomwebfuse.dao.http.HttpClientFactory; import com.google.dicomwebfuse.exception.DicomFuseException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.http.ProtocolVersion; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.BasicHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.message.BasicStatusLine; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; GoogleCredentials googleCredentials = GoogleCredentials.create(accessToken); return new AuthAdc(googleCredentials); } /** * Generates http entities list. * * @param entityCount how many entities would be generated * @param offset start offset * @param entityType type of entity */ private static List<BasicHttpEntity> prepareHttpEntities(int entityCount, int offset, EntityType entityType) throws DicomFuseException { List<BasicHttpEntity> basicHttpEntities = new ArrayList<>(); int entityLimit; int maxEntities; switch (entityType) { case DICOM_STORE: entityLimit = 100; maxEntities = 100; break; case STUDY: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_STUDY; maxEntities = MAX_STUDIES_IN_DICOM_STORE; break; case SERIES: entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_SERIES; maxEntities = MAX_SERIES_IN_STUDY; break; case INSTANCE:
entityLimit = VALUE_PARAM_MAX_LIMIT_FOR_INSTANCES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
public String toPath() throws DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/StudiesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class StudiesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public StudiesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/entities/cache/InstanceContent.java
// Path: src/main/java/com/google/dicomwebfuse/fuse/Command.java // public enum Command { // GETATTR, // READDIR, // READ, // OPEN, // OPEN_DIR, // CREATE, // WRITE, // RELEASE, // UNLINK, // TRUNCATE, // RENAME // } // // Path: src/main/java/com/google/dicomwebfuse/entities/Instance.java // @JsonInclude(JsonInclude.Include.NON_NULL) // public class Instance { // // @JsonProperty("0020000D") // private DicomAttribute<String> studyInstanceUID; // @JsonProperty("0020000E") // private DicomAttribute<String> seriesInstanceUID; // @JsonProperty("00080018") // private DicomAttribute<String> sopInstanceUID; // // public DicomAttribute<String> getStudyInstanceUID() { // return studyInstanceUID; // } // // public void setStudyInstanceUID(DicomAttribute<String> studyInstanceUID) { // this.studyInstanceUID = studyInstanceUID; // } // // public DicomAttribute<String> getSeriesInstanceUID() { // return seriesInstanceUID; // } // // public void setSeriesInstanceUID(DicomAttribute<String> seriesInstanceUID) { // this.seriesInstanceUID = seriesInstanceUID; // } // // public DicomAttribute<String> getSopInstanceUID() { // return sopInstanceUID; // } // // public void setSopInstanceUID(DicomAttribute<String> sopInstanceUID) { // this.sopInstanceUID = sopInstanceUID; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // Instance instance = (Instance) o; // return studyInstanceUID.equals(instance.studyInstanceUID) && // seriesInstanceUID.equals(instance.seriesInstanceUID) && // sopInstanceUID.equals(instance.sopInstanceUID); // } // // @Override // public int hashCode() { // return Objects.hash(studyInstanceUID, seriesInstanceUID, sopInstanceUID); // } // }
import com.google.dicomwebfuse.fuse.Command; import com.google.dicomwebfuse.entities.Instance; import java.util.concurrent.atomic.AtomicLong;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.entities.cache; public class InstanceContent { private final Instance instance; // offset for macOS for to prevent the following error: // https://github.com/osxfuse/osxfuse/issues/587 private final AtomicLong offset = new AtomicLong(); private long instanceSize;
// Path: src/main/java/com/google/dicomwebfuse/fuse/Command.java // public enum Command { // GETATTR, // READDIR, // READ, // OPEN, // OPEN_DIR, // CREATE, // WRITE, // RELEASE, // UNLINK, // TRUNCATE, // RENAME // } // // Path: src/main/java/com/google/dicomwebfuse/entities/Instance.java // @JsonInclude(JsonInclude.Include.NON_NULL) // public class Instance { // // @JsonProperty("0020000D") // private DicomAttribute<String> studyInstanceUID; // @JsonProperty("0020000E") // private DicomAttribute<String> seriesInstanceUID; // @JsonProperty("00080018") // private DicomAttribute<String> sopInstanceUID; // // public DicomAttribute<String> getStudyInstanceUID() { // return studyInstanceUID; // } // // public void setStudyInstanceUID(DicomAttribute<String> studyInstanceUID) { // this.studyInstanceUID = studyInstanceUID; // } // // public DicomAttribute<String> getSeriesInstanceUID() { // return seriesInstanceUID; // } // // public void setSeriesInstanceUID(DicomAttribute<String> seriesInstanceUID) { // this.seriesInstanceUID = seriesInstanceUID; // } // // public DicomAttribute<String> getSopInstanceUID() { // return sopInstanceUID; // } // // public void setSopInstanceUID(DicomAttribute<String> sopInstanceUID) { // this.sopInstanceUID = sopInstanceUID; // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (o == null || getClass() != o.getClass()) { // return false; // } // Instance instance = (Instance) o; // return studyInstanceUID.equals(instance.studyInstanceUID) && // seriesInstanceUID.equals(instance.seriesInstanceUID) && // sopInstanceUID.equals(instance.sopInstanceUID); // } // // @Override // public int hashCode() { // return Objects.hash(studyInstanceUID, seriesInstanceUID, sopInstanceUID); // } // } // Path: src/main/java/com/google/dicomwebfuse/entities/cache/InstanceContent.java import com.google.dicomwebfuse.fuse.Command; import com.google.dicomwebfuse.entities.Instance; import java.util.concurrent.atomic.AtomicLong; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.entities.cache; public class InstanceContent { private final Instance instance; // offset for macOS for to prevent the following error: // https://github.com/osxfuse/osxfuse/issues/587 private final AtomicLong offset = new AtomicLong(); private long instanceSize;
private volatile Command command;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class InstancesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public InstancesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class InstancesPathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public InstancesPathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
public String toPath() throws DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
@Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
@Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
@Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
@Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException;
public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_WEB = "/dicomWeb"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String INSTANCES = "/instances/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String SERIES = "/series/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String STUDIES = "/studies/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/InstancesPathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.DICOM_WEB; import static com.google.dicomwebfuse.dao.Constants.INSTANCES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import static com.google.dicomwebfuse.dao.Constants.SERIES; import static com.google.dicomwebfuse.dao.Constants.STUDIES; import com.google.dicomwebfuse.exception.DicomFuseException; public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStoreId = queryBuilder.getDicomStoreId(); if (dicomStoreId == null) { throw new DicomFuseException("Dicom store must not be null!"); } String studyId = queryBuilder.getStudyId(); if (studyId == null) { throw new DicomFuseException("Study must not be null!"); } String seriesId = queryBuilder.getSeriesId(); if (seriesId == null) { throw new DicomFuseException("Series must not be null!"); } return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES +
dicomStoreId + DICOM_WEB + STUDIES + studyId + SERIES + seriesId + INSTANCES;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/fuse/Parameters.java
// Path: src/main/java/com/google/dicomwebfuse/dao/FuseDao.java // public interface FuseDao { // // List<DicomStore> getAllDicomStores(QueryBuilder queryBuilder) throws DicomFuseException; // DicomStore getSingleDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // List<Study> getStudies(QueryBuilder queryBuilder) throws DicomFuseException; // Study getSingleStudy(QueryBuilder queryBuilder) throws DicomFuseException; // List<Series> getSeries(QueryBuilder queryBuilder) throws DicomFuseException; // Series getSingleSeries(QueryBuilder queryBuilder) throws DicomFuseException; // List<Instance> getInstances(QueryBuilder queryBuilder) throws DicomFuseException; // Instance getSingleInstance(QueryBuilder queryBuilder) throws DicomFuseException; // // void downloadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void uploadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void createDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // } // // Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // }
import com.google.dicomwebfuse.dao.FuseDao; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import com.google.dicomwebfuse.parser.Arguments; import jnr.ffi.Platform.OS;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.fuse; public class Parameters { private final FuseDao fuseDAO;
// Path: src/main/java/com/google/dicomwebfuse/dao/FuseDao.java // public interface FuseDao { // // List<DicomStore> getAllDicomStores(QueryBuilder queryBuilder) throws DicomFuseException; // DicomStore getSingleDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // List<Study> getStudies(QueryBuilder queryBuilder) throws DicomFuseException; // Study getSingleStudy(QueryBuilder queryBuilder) throws DicomFuseException; // List<Series> getSeries(QueryBuilder queryBuilder) throws DicomFuseException; // Series getSingleSeries(QueryBuilder queryBuilder) throws DicomFuseException; // List<Instance> getInstances(QueryBuilder queryBuilder) throws DicomFuseException; // Instance getSingleInstance(QueryBuilder queryBuilder) throws DicomFuseException; // // void downloadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void uploadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void createDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // } // // Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // } // Path: src/main/java/com/google/dicomwebfuse/fuse/Parameters.java import com.google.dicomwebfuse.dao.FuseDao; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import com.google.dicomwebfuse.parser.Arguments; import jnr.ffi.Platform.OS; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.fuse; public class Parameters { private final FuseDao fuseDAO;
private final CloudConf cloudConf;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/fuse/Parameters.java
// Path: src/main/java/com/google/dicomwebfuse/dao/FuseDao.java // public interface FuseDao { // // List<DicomStore> getAllDicomStores(QueryBuilder queryBuilder) throws DicomFuseException; // DicomStore getSingleDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // List<Study> getStudies(QueryBuilder queryBuilder) throws DicomFuseException; // Study getSingleStudy(QueryBuilder queryBuilder) throws DicomFuseException; // List<Series> getSeries(QueryBuilder queryBuilder) throws DicomFuseException; // Series getSingleSeries(QueryBuilder queryBuilder) throws DicomFuseException; // List<Instance> getInstances(QueryBuilder queryBuilder) throws DicomFuseException; // Instance getSingleInstance(QueryBuilder queryBuilder) throws DicomFuseException; // // void downloadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void uploadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void createDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // } // // Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // }
import com.google.dicomwebfuse.dao.FuseDao; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import com.google.dicomwebfuse.parser.Arguments; import jnr.ffi.Platform.OS;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.fuse; public class Parameters { private final FuseDao fuseDAO; private final CloudConf cloudConf;
// Path: src/main/java/com/google/dicomwebfuse/dao/FuseDao.java // public interface FuseDao { // // List<DicomStore> getAllDicomStores(QueryBuilder queryBuilder) throws DicomFuseException; // DicomStore getSingleDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // List<Study> getStudies(QueryBuilder queryBuilder) throws DicomFuseException; // Study getSingleStudy(QueryBuilder queryBuilder) throws DicomFuseException; // List<Series> getSeries(QueryBuilder queryBuilder) throws DicomFuseException; // Series getSingleSeries(QueryBuilder queryBuilder) throws DicomFuseException; // List<Instance> getInstances(QueryBuilder queryBuilder) throws DicomFuseException; // Instance getSingleInstance(QueryBuilder queryBuilder) throws DicomFuseException; // // void downloadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void uploadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void createDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // } // // Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // } // Path: src/main/java/com/google/dicomwebfuse/fuse/Parameters.java import com.google.dicomwebfuse.dao.FuseDao; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import com.google.dicomwebfuse.parser.Arguments; import jnr.ffi.Platform.OS; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.fuse; public class Parameters { private final FuseDao fuseDAO; private final CloudConf cloudConf;
private final CacheTime cacheTime;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/fuse/Parameters.java
// Path: src/main/java/com/google/dicomwebfuse/dao/FuseDao.java // public interface FuseDao { // // List<DicomStore> getAllDicomStores(QueryBuilder queryBuilder) throws DicomFuseException; // DicomStore getSingleDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // List<Study> getStudies(QueryBuilder queryBuilder) throws DicomFuseException; // Study getSingleStudy(QueryBuilder queryBuilder) throws DicomFuseException; // List<Series> getSeries(QueryBuilder queryBuilder) throws DicomFuseException; // Series getSingleSeries(QueryBuilder queryBuilder) throws DicomFuseException; // List<Instance> getInstances(QueryBuilder queryBuilder) throws DicomFuseException; // Instance getSingleInstance(QueryBuilder queryBuilder) throws DicomFuseException; // // void downloadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void uploadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void createDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // } // // Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // }
import com.google.dicomwebfuse.dao.FuseDao; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import com.google.dicomwebfuse.parser.Arguments; import jnr.ffi.Platform.OS;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.fuse; public class Parameters { private final FuseDao fuseDAO; private final CloudConf cloudConf; private final CacheTime cacheTime; private final long cacheSize; private final boolean enableDeletion; private final OS os;
// Path: src/main/java/com/google/dicomwebfuse/dao/FuseDao.java // public interface FuseDao { // // List<DicomStore> getAllDicomStores(QueryBuilder queryBuilder) throws DicomFuseException; // DicomStore getSingleDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // List<Study> getStudies(QueryBuilder queryBuilder) throws DicomFuseException; // Study getSingleStudy(QueryBuilder queryBuilder) throws DicomFuseException; // List<Series> getSeries(QueryBuilder queryBuilder) throws DicomFuseException; // Series getSingleSeries(QueryBuilder queryBuilder) throws DicomFuseException; // List<Instance> getInstances(QueryBuilder queryBuilder) throws DicomFuseException; // Instance getSingleInstance(QueryBuilder queryBuilder) throws DicomFuseException; // // void downloadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void uploadInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteInstance(QueryBuilder queryBuilder) throws DicomFuseException; // void createDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // void deleteDicomStore(QueryBuilder queryBuilder) throws DicomFuseException; // } // // Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java // public class Arguments { // // @Parameter( // names = {"--datasetAddr", "-a"}, // descriptionKey = "option.datasetAddr", // required = true, // order = 0, // converter = CloudConfigurationConverter.class // ) // public CloudConf cloudConf; // // @Parameter( // names = {"--mountPath", "-p"}, // descriptionKey = "option.mountPath", // required = true, // order = 1, // converter = PathConverter.class // ) // public Path mountPath; // // @Parameter( // names = {"--cacheTime", "-t"}, // descriptionKey = "option.cacheTime", // converter = CacheTimeConverter.class, // order = 2, // validateWith = CacheTimePositiveValidator.class // ) // public CacheTime cacheTime = new CacheTime(60, 300); // // @Parameter( // names = {"--cacheSize", "-s"}, // descriptionKey = "option.cacheSize", // converter = LongConverter.class, // order = 3, // validateWith = CacheSizePositiveValidator.class // ) // public long cacheSize = 10000; // // @Parameter( // names = {"--enableDeletion", "-d"}, // descriptionKey = "option.enableDeletion", // order = 4, // converter = BooleanConverter.class // ) // public boolean enableDeletion = true; // // @Parameter( // names = {"--keyFile", "-k"}, // descriptionKey = "option.keyFile", // order = 5, // converter = PathConverter.class // ) // public Path keyPath; // // @Parameter( // names = {"--extraMountOptions"}, // descriptionKey = "option.extraMountOptions", // order = 6 // ) // public List<String> extraMountOptions = new ArrayList<>(); // // @Parameter( // names = {"--help", "-h"}, // help = true, // descriptionKey = "option.help", // order = 7 // ) // public boolean help = false; // } // Path: src/main/java/com/google/dicomwebfuse/fuse/Parameters.java import com.google.dicomwebfuse.dao.FuseDao; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import com.google.dicomwebfuse.parser.Arguments; import jnr.ffi.Platform.OS; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.fuse; public class Parameters { private final FuseDao fuseDAO; private final CloudConf cloudConf; private final CacheTime cacheTime; private final long cacheSize; private final boolean enableDeletion; private final OS os;
public Parameters(FuseDao fuseDAO, Arguments arguments, OS os) {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
public String toPath() throws DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/SingleDicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class SingleDicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public SingleDicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override
public String toPath() throws DicomFuseException {
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // }
import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
// Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DATASETS = "/datasets/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String DICOM_STORES = "/dicomStores/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String LOCATIONS = "/locations/"; // // Path: src/main/java/com/google/dicomwebfuse/dao/Constants.java // public static final String PROJECTS = "/projects/"; // // Path: src/main/java/com/google/dicomwebfuse/exception/DicomFuseException.java // public class DicomFuseException extends Exception { // // private int statusCode; // // public DicomFuseException(String message) { // super(message); // } // // public DicomFuseException(String message, Exception e) { // super(message, e); // } // // public DicomFuseException(Exception e) { // super(e); // } // // public DicomFuseException(String message, int statusCode) { // super(message); // this.statusCode = statusCode; // } // // public int getStatusCode() { // return statusCode; // } // } // Path: src/main/java/com/google/dicomwebfuse/dao/spec/DicomStorePathBuilder.java import static com.google.dicomwebfuse.dao.Constants.DATASETS; import static com.google.dicomwebfuse.dao.Constants.DICOM_STORES; import static com.google.dicomwebfuse.dao.Constants.LOCATIONS; import static com.google.dicomwebfuse.dao.Constants.PROJECTS; import com.google.dicomwebfuse.exception.DicomFuseException; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.dao.spec; public class DicomStorePathBuilder implements PathBuilder { private QueryBuilder queryBuilder; public DicomStorePathBuilder(QueryBuilder queryBuilder) { this.queryBuilder = queryBuilder; } @Override public String toPath() throws DicomFuseException { String stage = queryBuilder.getCloudConf().getStage(); if (stage == null) { throw new DicomFuseException("Stage must not be null!"); } String project = queryBuilder.getCloudConf().getProject(); if (project == null) { throw new DicomFuseException("Project must not be null!"); } String location = queryBuilder.getCloudConf().getLocation(); if (location == null) { throw new DicomFuseException("Location must not be null!"); } String dataset = queryBuilder.getCloudConf().getDataSet(); if (dataset == null) { throw new DicomFuseException("Dataset must not be null!"); } String dicomStore = queryBuilder.getDicomStoreId(); if (dicomStore == null) { throw new DicomFuseException("DICOM Store must not be null!"); }
return stage + PROJECTS + project + LOCATIONS + location + DATASETS + dataset + DICOM_STORES
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/parser/Arguments.java
// Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // }
import com.beust.jcommander.Parameter; import com.beust.jcommander.converters.BooleanConverter; import com.beust.jcommander.converters.LongConverter; import com.beust.jcommander.converters.PathConverter; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import java.nio.file.Path; import java.util.ArrayList; import java.util.List;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.parser; public class Arguments { @Parameter( names = {"--datasetAddr", "-a"}, descriptionKey = "option.datasetAddr", required = true, order = 0, converter = CloudConfigurationConverter.class )
// Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java import com.beust.jcommander.Parameter; import com.beust.jcommander.converters.BooleanConverter; import com.beust.jcommander.converters.LongConverter; import com.beust.jcommander.converters.PathConverter; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.parser; public class Arguments { @Parameter( names = {"--datasetAddr", "-a"}, descriptionKey = "option.datasetAddr", required = true, order = 0, converter = CloudConfigurationConverter.class )
public CloudConf cloudConf;
GoogleCloudPlatform/healthcare-api-dicom-fuse
src/main/java/com/google/dicomwebfuse/parser/Arguments.java
// Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // }
import com.beust.jcommander.Parameter; import com.beust.jcommander.converters.BooleanConverter; import com.beust.jcommander.converters.LongConverter; import com.beust.jcommander.converters.PathConverter; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import java.nio.file.Path; import java.util.ArrayList; import java.util.List;
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.parser; public class Arguments { @Parameter( names = {"--datasetAddr", "-a"}, descriptionKey = "option.datasetAddr", required = true, order = 0, converter = CloudConfigurationConverter.class ) public CloudConf cloudConf; @Parameter( names = {"--mountPath", "-p"}, descriptionKey = "option.mountPath", required = true, order = 1, converter = PathConverter.class ) public Path mountPath; @Parameter( names = {"--cacheTime", "-t"}, descriptionKey = "option.cacheTime", converter = CacheTimeConverter.class, order = 2, validateWith = CacheTimePositiveValidator.class )
// Path: src/main/java/com/google/dicomwebfuse/entities/CloudConf.java // public class CloudConf { // // private String stage; // private String project; // private String location; // private String dataSet; // // public CloudConf(String stage, String project, String location, String dataSet) { // this.stage = stage; // this.project = project; // this.location = location; // this.dataSet = dataSet; // } // // public String getStage() { // return stage; // } // // public String getProject() { // return project; // } // // public String getLocation() { // return location; // } // // public String getDataSet() { // return dataSet; // } // } // // Path: src/main/java/com/google/dicomwebfuse/entities/cache/CacheTime.java // public class CacheTime { // // private final long objectsCacheTime; // private final long instanceFilesCacheTime; // // public CacheTime(long objectsCacheTime, long instanceFilesCacheTime) { // this.objectsCacheTime = objectsCacheTime; // this.instanceFilesCacheTime = instanceFilesCacheTime; // } // // public long getObjectsCacheTime() { // return objectsCacheTime; // } // // public long getInstanceFilesCacheTime() { // return instanceFilesCacheTime; // } // // @Override // public String toString() { // return objectsCacheTime + "," + instanceFilesCacheTime; // } // } // Path: src/main/java/com/google/dicomwebfuse/parser/Arguments.java import com.beust.jcommander.Parameter; import com.beust.jcommander.converters.BooleanConverter; import com.beust.jcommander.converters.LongConverter; import com.beust.jcommander.converters.PathConverter; import com.google.dicomwebfuse.entities.CloudConf; import com.google.dicomwebfuse.entities.cache.CacheTime; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; // Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.dicomwebfuse.parser; public class Arguments { @Parameter( names = {"--datasetAddr", "-a"}, descriptionKey = "option.datasetAddr", required = true, order = 0, converter = CloudConfigurationConverter.class ) public CloudConf cloudConf; @Parameter( names = {"--mountPath", "-p"}, descriptionKey = "option.mountPath", required = true, order = 1, converter = PathConverter.class ) public Path mountPath; @Parameter( names = {"--cacheTime", "-t"}, descriptionKey = "option.cacheTime", converter = CacheTimeConverter.class, order = 2, validateWith = CacheTimePositiveValidator.class )
public CacheTime cacheTime = new CacheTime(60, 300);
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/rooms/Room.java
// Path: core/src/com/kowaisugoi/game/graphics/Transition.java // public interface Transition { // public void draw(SpriteBatch batch); // // public void draw(ShapeRenderer renderer); // // public void update(float delta); // // public void play(); // } // // Path: core/src/com/kowaisugoi/game/interactables/objects/ItemId.java // public enum ItemId { // KEY_HOUSE, // GLASS, // GLASS_SNOW, // GLASS_WATER, // SHOVEL, // HAMMER, // STICK, // STICK_RAGS, // STICK_RAGS_ALCOHOL, // TORCH, // PRYBAR, // CAR_KEYS // }
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.Disposable; import com.kowaisugoi.game.graphics.Transition; import com.kowaisugoi.game.interactables.objects.ItemId;
package com.kowaisugoi.game.rooms; public interface Room extends Disposable { public void drawFx(SpriteBatch batch); public void draw(SpriteBatch batch); public void draw(ShapeRenderer batch); public boolean click(float curX, float curY);
// Path: core/src/com/kowaisugoi/game/graphics/Transition.java // public interface Transition { // public void draw(SpriteBatch batch); // // public void draw(ShapeRenderer renderer); // // public void update(float delta); // // public void play(); // } // // Path: core/src/com/kowaisugoi/game/interactables/objects/ItemId.java // public enum ItemId { // KEY_HOUSE, // GLASS, // GLASS_SNOW, // GLASS_WATER, // SHOVEL, // HAMMER, // STICK, // STICK_RAGS, // STICK_RAGS_ALCOHOL, // TORCH, // PRYBAR, // CAR_KEYS // } // Path: core/src/com/kowaisugoi/game/rooms/Room.java import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.utils.Disposable; import com.kowaisugoi.game.graphics.Transition; import com.kowaisugoi.game.interactables.objects.ItemId; package com.kowaisugoi.game.rooms; public interface Room extends Disposable { public void drawFx(SpriteBatch batch); public void draw(SpriteBatch batch); public void draw(ShapeRenderer batch); public boolean click(float curX, float curY);
public boolean click(float curX, float curY, ItemId itemId);
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/interactables/Interactable.java
// Path: core/src/com/kowaisugoi/game/audio/SoundId.java // public enum SoundId { // DOOR_CREAK, DOOR_LOCKED, SNOW_CRUNCH, FLOOR_STEP, CLICK, UNCLE_GASP, // ENGINE_START, SCARE // } // // Path: core/src/com/kowaisugoi/game/interactables/objects/ItemId.java // public enum ItemId { // KEY_HOUSE, // GLASS, // GLASS_SNOW, // GLASS_WATER, // SHOVEL, // HAMMER, // STICK, // STICK_RAGS, // STICK_RAGS_ALCOHOL, // TORCH, // PRYBAR, // CAR_KEYS // }
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; import com.kowaisugoi.game.audio.SoundId; import com.kowaisugoi.game.interactables.objects.ItemId;
package com.kowaisugoi.game.interactables; public interface Interactable { // TODO: In a perfect world, the interaction box should probably be private. public Rectangle getInteractionBox(); public void draw(SpriteBatch batch); public void draw(ShapeRenderer renderer); public boolean click(float curX, float curY); public void beautifyCursor(float curX, float curY); public void update(float delta); public void registerListener(InteractionListener listener);
// Path: core/src/com/kowaisugoi/game/audio/SoundId.java // public enum SoundId { // DOOR_CREAK, DOOR_LOCKED, SNOW_CRUNCH, FLOOR_STEP, CLICK, UNCLE_GASP, // ENGINE_START, SCARE // } // // Path: core/src/com/kowaisugoi/game/interactables/objects/ItemId.java // public enum ItemId { // KEY_HOUSE, // GLASS, // GLASS_SNOW, // GLASS_WATER, // SHOVEL, // HAMMER, // STICK, // STICK_RAGS, // STICK_RAGS_ALCOHOL, // TORCH, // PRYBAR, // CAR_KEYS // } // Path: core/src/com/kowaisugoi/game/interactables/Interactable.java import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; import com.kowaisugoi.game.audio.SoundId; import com.kowaisugoi.game.interactables.objects.ItemId; package com.kowaisugoi.game.interactables; public interface Interactable { // TODO: In a perfect world, the interaction box should probably be private. public Rectangle getInteractionBox(); public void draw(SpriteBatch batch); public void draw(ShapeRenderer renderer); public boolean click(float curX, float curY); public void beautifyCursor(float curX, float curY); public void update(float delta); public void registerListener(InteractionListener listener);
public void setSoundEffect(SoundId soundId);
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/interactables/Interactable.java
// Path: core/src/com/kowaisugoi/game/audio/SoundId.java // public enum SoundId { // DOOR_CREAK, DOOR_LOCKED, SNOW_CRUNCH, FLOOR_STEP, CLICK, UNCLE_GASP, // ENGINE_START, SCARE // } // // Path: core/src/com/kowaisugoi/game/interactables/objects/ItemId.java // public enum ItemId { // KEY_HOUSE, // GLASS, // GLASS_SNOW, // GLASS_WATER, // SHOVEL, // HAMMER, // STICK, // STICK_RAGS, // STICK_RAGS_ALCOHOL, // TORCH, // PRYBAR, // CAR_KEYS // }
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; import com.kowaisugoi.game.audio.SoundId; import com.kowaisugoi.game.interactables.objects.ItemId;
package com.kowaisugoi.game.interactables; public interface Interactable { // TODO: In a perfect world, the interaction box should probably be private. public Rectangle getInteractionBox(); public void draw(SpriteBatch batch); public void draw(ShapeRenderer renderer); public boolean click(float curX, float curY); public void beautifyCursor(float curX, float curY); public void update(float delta); public void registerListener(InteractionListener listener); public void setSoundEffect(SoundId soundId); public boolean isItemInteractable();
// Path: core/src/com/kowaisugoi/game/audio/SoundId.java // public enum SoundId { // DOOR_CREAK, DOOR_LOCKED, SNOW_CRUNCH, FLOOR_STEP, CLICK, UNCLE_GASP, // ENGINE_START, SCARE // } // // Path: core/src/com/kowaisugoi/game/interactables/objects/ItemId.java // public enum ItemId { // KEY_HOUSE, // GLASS, // GLASS_SNOW, // GLASS_WATER, // SHOVEL, // HAMMER, // STICK, // STICK_RAGS, // STICK_RAGS_ALCOHOL, // TORCH, // PRYBAR, // CAR_KEYS // } // Path: core/src/com/kowaisugoi/game/interactables/Interactable.java import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Rectangle; import com.kowaisugoi.game.audio.SoundId; import com.kowaisugoi.game.interactables.objects.ItemId; package com.kowaisugoi.game.interactables; public interface Interactable { // TODO: In a perfect world, the interaction box should probably be private. public Rectangle getInteractionBox(); public void draw(SpriteBatch batch); public void draw(ShapeRenderer renderer); public boolean click(float curX, float curY); public void beautifyCursor(float curX, float curY); public void update(float delta); public void registerListener(InteractionListener listener); public void setSoundEffect(SoundId soundId); public boolean isItemInteractable();
public boolean itemInteract(ItemId id);
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/graphics/SnowAnimation.java
// Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_HEIGHT = 90; // // Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_WIDTH = 160;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; import java.util.LinkedList; import java.util.List; import java.util.Random; import static com.kowaisugoi.game.screens.PlayGame.GAME_HEIGHT; import static com.kowaisugoi.game.screens.PlayGame.GAME_WIDTH;
package com.kowaisugoi.game.graphics; public class SnowAnimation { private int _stormSize; private float _stormSpeed; private Random _random; private float _gameWidth; private float _gameHeight; private List<Snowflake> _snowflakes; public SnowAnimation(int size, float stormSpeed) { _stormSize = size; _stormSpeed = stormSpeed;
// Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_HEIGHT = 90; // // Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_WIDTH = 160; // Path: core/src/com/kowaisugoi/game/graphics/SnowAnimation.java import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; import java.util.LinkedList; import java.util.List; import java.util.Random; import static com.kowaisugoi.game.screens.PlayGame.GAME_HEIGHT; import static com.kowaisugoi.game.screens.PlayGame.GAME_WIDTH; package com.kowaisugoi.game.graphics; public class SnowAnimation { private int _stormSize; private float _stormSpeed; private Random _random; private float _gameWidth; private float _gameHeight; private List<Snowflake> _snowflakes; public SnowAnimation(int size, float stormSpeed) { _stormSize = size; _stormSpeed = stormSpeed;
_gameWidth = GAME_WIDTH;
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/graphics/SnowAnimation.java
// Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_HEIGHT = 90; // // Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_WIDTH = 160;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; import java.util.LinkedList; import java.util.List; import java.util.Random; import static com.kowaisugoi.game.screens.PlayGame.GAME_HEIGHT; import static com.kowaisugoi.game.screens.PlayGame.GAME_WIDTH;
package com.kowaisugoi.game.graphics; public class SnowAnimation { private int _stormSize; private float _stormSpeed; private Random _random; private float _gameWidth; private float _gameHeight; private List<Snowflake> _snowflakes; public SnowAnimation(int size, float stormSpeed) { _stormSize = size; _stormSpeed = stormSpeed; _gameWidth = GAME_WIDTH;
// Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_HEIGHT = 90; // // Path: core/src/com/kowaisugoi/game/screens/PlayGame.java // public static final float GAME_WIDTH = 160; // Path: core/src/com/kowaisugoi/game/graphics/SnowAnimation.java import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector2; import java.util.LinkedList; import java.util.List; import java.util.Random; import static com.kowaisugoi.game.screens.PlayGame.GAME_HEIGHT; import static com.kowaisugoi.game.screens.PlayGame.GAME_WIDTH; package com.kowaisugoi.game.graphics; public class SnowAnimation { private int _stormSize; private float _stormSpeed; private Random _random; private float _gameWidth; private float _gameHeight; private List<Snowflake> _snowflakes; public SnowAnimation(int size, float stormSpeed) { _stormSize = size; _stormSpeed = stormSpeed; _gameWidth = GAME_WIDTH;
_gameHeight = GAME_HEIGHT;
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/interactables/passages/Passage.java
// Path: core/src/com/kowaisugoi/game/control/flags/FlagId.java // public enum FlagId { // FLAG_BODY_FOUND, // FLAG_CAR_FOUND, // FLAG_CAR_SNOWREMOVED, // FLAG_SHED_OPENED, // FLAG_NIGHT_TIME, // FLAG_BOARDS_REMOVED, // FLAG_TORCH_PLACED, // FLAG_ENTERED_BATHROOM, // FLAG_KEYS_MISSING, // FLAG_KEYS_APPEARED, // FLAG_KEYS_FOUND, // FLAG_HALLWAY_SCARE, // FLAG_HALLWAY_SCARE_OVER // } // // Path: core/src/com/kowaisugoi/game/interactables/Interactable.java // public interface Interactable { // // TODO: In a perfect world, the interaction box should probably be private. // public Rectangle getInteractionBox(); // // public void draw(SpriteBatch batch); // // public void draw(ShapeRenderer renderer); // // public boolean click(float curX, float curY); // // public void beautifyCursor(float curX, float curY); // // public void update(float delta); // // public void registerListener(InteractionListener listener); // // public void setSoundEffect(SoundId soundId); // // public boolean isItemInteractable(); // // public boolean itemInteract(ItemId id); // // public String getItemInteractionMessage(ItemId id); // // public void setItemInteractionMessage(ItemId id, String message); // // public boolean checkInteraction(float curX, float curY); // } // // Path: core/src/com/kowaisugoi/game/rooms/RoomId.java // public enum RoomId { // MAIN_HALL, // HALLWAY, // FRONT_DOOR_INTERIOR, // BEDROOM, // BATHROOM, // BATHROOM_CABINET, // BACKYARD, // CRAWLSPACE, // FRONTYARD, // KITCHEN, // SHED, // SHED_INTERIOR, // SHRINE, // ROAD, // PARKING_AREA, // CAR // }
import com.badlogic.gdx.graphics.g2d.Sprite; import com.kowaisugoi.game.control.flags.FlagId; import com.kowaisugoi.game.interactables.Interactable; import com.kowaisugoi.game.rooms.RoomId;
package com.kowaisugoi.game.interactables.passages; public interface Passage extends Interactable { public RoomId getDestination(); public void roomTransition(); public void transitionComplete(); public void setTransitionImage(Sprite sprite);
// Path: core/src/com/kowaisugoi/game/control/flags/FlagId.java // public enum FlagId { // FLAG_BODY_FOUND, // FLAG_CAR_FOUND, // FLAG_CAR_SNOWREMOVED, // FLAG_SHED_OPENED, // FLAG_NIGHT_TIME, // FLAG_BOARDS_REMOVED, // FLAG_TORCH_PLACED, // FLAG_ENTERED_BATHROOM, // FLAG_KEYS_MISSING, // FLAG_KEYS_APPEARED, // FLAG_KEYS_FOUND, // FLAG_HALLWAY_SCARE, // FLAG_HALLWAY_SCARE_OVER // } // // Path: core/src/com/kowaisugoi/game/interactables/Interactable.java // public interface Interactable { // // TODO: In a perfect world, the interaction box should probably be private. // public Rectangle getInteractionBox(); // // public void draw(SpriteBatch batch); // // public void draw(ShapeRenderer renderer); // // public boolean click(float curX, float curY); // // public void beautifyCursor(float curX, float curY); // // public void update(float delta); // // public void registerListener(InteractionListener listener); // // public void setSoundEffect(SoundId soundId); // // public boolean isItemInteractable(); // // public boolean itemInteract(ItemId id); // // public String getItemInteractionMessage(ItemId id); // // public void setItemInteractionMessage(ItemId id, String message); // // public boolean checkInteraction(float curX, float curY); // } // // Path: core/src/com/kowaisugoi/game/rooms/RoomId.java // public enum RoomId { // MAIN_HALL, // HALLWAY, // FRONT_DOOR_INTERIOR, // BEDROOM, // BATHROOM, // BATHROOM_CABINET, // BACKYARD, // CRAWLSPACE, // FRONTYARD, // KITCHEN, // SHED, // SHED_INTERIOR, // SHRINE, // ROAD, // PARKING_AREA, // CAR // } // Path: core/src/com/kowaisugoi/game/interactables/passages/Passage.java import com.badlogic.gdx.graphics.g2d.Sprite; import com.kowaisugoi.game.control.flags.FlagId; import com.kowaisugoi.game.interactables.Interactable; import com.kowaisugoi.game.rooms.RoomId; package com.kowaisugoi.game.interactables.passages; public interface Passage extends Interactable { public RoomId getDestination(); public void roomTransition(); public void transitionComplete(); public void setTransitionImage(Sprite sprite);
public void setTravelFlag(FlagId flag);
gjhutchison/pixelhorrorjam2016
core/src/com/kowaisugoi/game/player/inventory/InventorySlot.java
// Path: core/src/com/kowaisugoi/game/interactables/objects/PickupableItem.java // public class PickupableItem implements Item { // private LinkedList<InteractionListener> _listeners = new LinkedList<InteractionListener>(); // private Rectangle _interactionBox; // private Sprite _sprite; // private Sprite _invSprite; // private ItemId _id; // // private SoundId _soundId; // // private String _pickupText; // // private boolean _pickedUp; // // private Map<ItemId, String> _itemInteractionMessages; // // public PickupableItem(Sprite sprite, Rectangle interactionBox, ItemId id) { // _interactionBox = interactionBox; // _sprite = sprite; // _invSprite = sprite; // _sprite.setSize(_interactionBox.getWidth(), _interactionBox.getHeight()); // _sprite.setPosition(_interactionBox.getX(), _interactionBox.getY()); // _id = id; // // _pickedUp = false; // // _itemInteractionMessages = new HashMap<ItemId, String>(); // } // // public PickupableItem(Sprite worldSprite, Sprite invSprite, Rectangle interactionBox, ItemId id) { // _interactionBox = interactionBox; // _sprite = worldSprite; // _invSprite = invSprite; // _sprite.setPosition(0, 0); // _sprite.setSize(PlayGame.GAME_WIDTH, PlayGame.GAME_HEIGHT); // _id = id; // } // // public void setPickupText(String pickupText) { // _pickupText = pickupText; // } // // // Draw debug areas // public void draw(ShapeRenderer renderer) { // if (PlayGame.getDebug()) { // renderer.setColor(0.5f, 0.3f, 0.1f, 0.25f); // renderer.rect(_interactionBox.x, _interactionBox.y, _interactionBox.width, _interactionBox.height); // } // } // // // Draw the world sprite // public void draw(SpriteBatch batch) { // _sprite.draw(batch); // } // // // Draw the inventory sprite // public Sprite getInventorySprite() { // return _invSprite; // } // // public boolean isPickedUp() { // return _pickedUp; // } // // @Override // public Rectangle getInteractionBox() { // return _interactionBox; // } // // @Override // public boolean click(float curX, float curY) { // if (_interactionBox.contains(curX, curY)) { // notifyListeners(); // AudioManager.playSound(_soundId); // if (_pickupText != null) { // PlayGame.getPlayer().think(_pickupText); // _pickedUp = true; // } // return true; // } // return false; // } // // @Override // public void update(float delta) { // // } // // @Override // public void beautifyCursor(float curX, float curY) { // if (_interactionBox.contains(curX, curY)) { // PlayGame.getPlayer().setCursor(Player.CursorType.PICKUP); // } // } // // @Override // public void registerListener(InteractionListener listener) { // _listeners.push(listener); // } // // @Override // public void setSoundEffect(SoundId soundId) { // _soundId = soundId; // } // // @Override // public boolean isItemInteractable() { // return false; // } // // @Override // public boolean itemInteract(ItemId id) { // return false; // } // // @Override // public String getItemInteractionMessage(ItemId id) { // if (_itemInteractionMessages.containsKey(id)) { // return _itemInteractionMessages.get(id); // } // return ""; // } // // @Override // public void setItemInteractionMessage(ItemId id, String message) { // _itemInteractionMessages.put(id, message); // } // // public void notifyListeners() { // for (InteractionListener listener : _listeners) { // listener.notifyListener(); // } // } // // @Override // public ItemId getItemId() { // return _id; // } // // @Override // public boolean checkInteraction(float curX, float curY) { // return _interactionBox.contains(curX, curY); // } // }
import com.badlogic.gdx.math.Rectangle; import com.kowaisugoi.game.interactables.objects.PickupableItem;
package com.kowaisugoi.game.player.inventory; public class InventorySlot { private boolean _remove;
// Path: core/src/com/kowaisugoi/game/interactables/objects/PickupableItem.java // public class PickupableItem implements Item { // private LinkedList<InteractionListener> _listeners = new LinkedList<InteractionListener>(); // private Rectangle _interactionBox; // private Sprite _sprite; // private Sprite _invSprite; // private ItemId _id; // // private SoundId _soundId; // // private String _pickupText; // // private boolean _pickedUp; // // private Map<ItemId, String> _itemInteractionMessages; // // public PickupableItem(Sprite sprite, Rectangle interactionBox, ItemId id) { // _interactionBox = interactionBox; // _sprite = sprite; // _invSprite = sprite; // _sprite.setSize(_interactionBox.getWidth(), _interactionBox.getHeight()); // _sprite.setPosition(_interactionBox.getX(), _interactionBox.getY()); // _id = id; // // _pickedUp = false; // // _itemInteractionMessages = new HashMap<ItemId, String>(); // } // // public PickupableItem(Sprite worldSprite, Sprite invSprite, Rectangle interactionBox, ItemId id) { // _interactionBox = interactionBox; // _sprite = worldSprite; // _invSprite = invSprite; // _sprite.setPosition(0, 0); // _sprite.setSize(PlayGame.GAME_WIDTH, PlayGame.GAME_HEIGHT); // _id = id; // } // // public void setPickupText(String pickupText) { // _pickupText = pickupText; // } // // // Draw debug areas // public void draw(ShapeRenderer renderer) { // if (PlayGame.getDebug()) { // renderer.setColor(0.5f, 0.3f, 0.1f, 0.25f); // renderer.rect(_interactionBox.x, _interactionBox.y, _interactionBox.width, _interactionBox.height); // } // } // // // Draw the world sprite // public void draw(SpriteBatch batch) { // _sprite.draw(batch); // } // // // Draw the inventory sprite // public Sprite getInventorySprite() { // return _invSprite; // } // // public boolean isPickedUp() { // return _pickedUp; // } // // @Override // public Rectangle getInteractionBox() { // return _interactionBox; // } // // @Override // public boolean click(float curX, float curY) { // if (_interactionBox.contains(curX, curY)) { // notifyListeners(); // AudioManager.playSound(_soundId); // if (_pickupText != null) { // PlayGame.getPlayer().think(_pickupText); // _pickedUp = true; // } // return true; // } // return false; // } // // @Override // public void update(float delta) { // // } // // @Override // public void beautifyCursor(float curX, float curY) { // if (_interactionBox.contains(curX, curY)) { // PlayGame.getPlayer().setCursor(Player.CursorType.PICKUP); // } // } // // @Override // public void registerListener(InteractionListener listener) { // _listeners.push(listener); // } // // @Override // public void setSoundEffect(SoundId soundId) { // _soundId = soundId; // } // // @Override // public boolean isItemInteractable() { // return false; // } // // @Override // public boolean itemInteract(ItemId id) { // return false; // } // // @Override // public String getItemInteractionMessage(ItemId id) { // if (_itemInteractionMessages.containsKey(id)) { // return _itemInteractionMessages.get(id); // } // return ""; // } // // @Override // public void setItemInteractionMessage(ItemId id, String message) { // _itemInteractionMessages.put(id, message); // } // // public void notifyListeners() { // for (InteractionListener listener : _listeners) { // listener.notifyListener(); // } // } // // @Override // public ItemId getItemId() { // return _id; // } // // @Override // public boolean checkInteraction(float curX, float curY) { // return _interactionBox.contains(curX, curY); // } // } // Path: core/src/com/kowaisugoi/game/player/inventory/InventorySlot.java import com.badlogic.gdx.math.Rectangle; import com.kowaisugoi.game.interactables.objects.PickupableItem; package com.kowaisugoi.game.player.inventory; public class InventorySlot { private boolean _remove;
private PickupableItem _item;
gjhutchison/pixelhorrorjam2016
desktop/src/com/kowaisugoi/game/desktop/DesktopLauncher.java
// Path: core/src/com/kowaisugoi/game/MainGame.java // public class MainGame extends Game { // public static String TITLE = "Cozy"; // public static String VERSION = "1.0.0"; // // @Override // public void create() { // // Gdx.app.log(TITLE, VERSION); // Gdx.app.log(TITLE, "create()"); // Gdx.graphics.setTitle("Cozy"); // AudioManager.initSounds(); // setScreen(new SplashScreen()); // } // // @Override // public void render() { // super.render(); // } // }
import com.badlogic.gdx.Files; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.kowaisugoi.game.MainGame;
package com.kowaisugoi.game.desktop; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.foregroundFPS = 60; config.vSyncEnabled = true; config.width = 800; config.height = 450; config.addIcon("icons/large.png", Files.FileType.Internal); config.addIcon("icons/med.png", Files.FileType.Internal); config.addIcon("icons/small.png", Files.FileType.Internal);
// Path: core/src/com/kowaisugoi/game/MainGame.java // public class MainGame extends Game { // public static String TITLE = "Cozy"; // public static String VERSION = "1.0.0"; // // @Override // public void create() { // // Gdx.app.log(TITLE, VERSION); // Gdx.app.log(TITLE, "create()"); // Gdx.graphics.setTitle("Cozy"); // AudioManager.initSounds(); // setScreen(new SplashScreen()); // } // // @Override // public void render() { // super.render(); // } // } // Path: desktop/src/com/kowaisugoi/game/desktop/DesktopLauncher.java import com.badlogic.gdx.Files; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.kowaisugoi.game.MainGame; package com.kowaisugoi.game.desktop; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.foregroundFPS = 60; config.vSyncEnabled = true; config.width = 800; config.height = 450; config.addIcon("icons/large.png", Files.FileType.Internal); config.addIcon("icons/med.png", Files.FileType.Internal); config.addIcon("icons/small.png", Files.FileType.Internal);
new LwjglApplication(new MainGame(), config);
Instagram/ig-json-parser
processor/src/test/java/com/instagram/common/json/annotation/processor/SelectiveGenerationTest.java
// Path: processor/testuut/noserializers/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerGlobalUUT.java // @JsonType // public class NoSerializerGlobalUUT { // // @JsonField(fieldName = "value") // String mValue; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerClassUUT.java // @JsonType(generateSerializer = JsonType.TriState.NO) // public class NoSerializerClassUUT { // // enum DummyEnum { // A, // B; // } // // @JsonField(fieldName = "value") // String mValue; // // /** // * Ensure that we don't have to provide a serializeCodeFormatter for enums if serialization is // * disabled. // */ // @JsonField( // fieldName = "dummyEnum", // valueExtractFormatter = "NoSerializerClassUUT.DummyEnum.valueOf(${parser_object}.getText())") // DummyEnum dummyEnum; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/SimpleParseUUT.java // @JsonType // public class SimpleParseUUT { // public static final String INT_FIELD_NAME = "int"; // public static final String INTEGER_FIELD_NAME = "Integer"; // public static final String FLOAT_FIELD_NAME = "float"; // public static final String FLOAT_OBJ_FIELD_NAME = "Float"; // public static final String STRING_FIELD_NAME = "String"; // public static final String INTEGER_LIST_FIELD_NAME = "IntegerList"; // public static final String INTEGER_ARRAY_LIST_FIELD_NAME = "IntegerArrayList"; // public static final String INTEGER_QUEUE_FIELD_NAME = "IntegerQueue"; // public static final String INTEGER_SET_FIELD_NAME = "IntegerSet"; // public static final String SUBOBJECT_FIELD_NAME = "Subobject"; // public static final String SUBENUM_FIELD_NAME = "Subenum"; // public static final String SUBENUM_LIST_FIELD_NAME = "SubenumList"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // // @JsonField(fieldName = INTEGER_FIELD_NAME) // public Integer integerField; // // @JsonField(fieldName = FLOAT_FIELD_NAME) // public float floatField; // // @JsonField(fieldName = FLOAT_OBJ_FIELD_NAME) // public Float FloatField; // // @JsonField(fieldName = STRING_FIELD_NAME, mapping = JsonField.TypeMapping.EXACT) // public String stringField; // // @JsonField(fieldName = INTEGER_LIST_FIELD_NAME) // public List<Integer> integerListField; // // @JsonField(fieldName = INTEGER_ARRAY_LIST_FIELD_NAME) // public ArrayList<Integer> integerArrayListField; // // @JsonField(fieldName = INTEGER_QUEUE_FIELD_NAME) // public Queue<Integer> integerQueueField; // // @JsonField(fieldName = INTEGER_SET_FIELD_NAME) // public Set<Integer> integerSetField; // // @JsonField(fieldName = SUBOBJECT_FIELD_NAME) // public SubobjectParseUUT subobjectField; // // @JsonField( // fieldName = SUBENUM_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = // "${generator_object}.writeStringField(\"${json_fieldname}\", " // + "${object_varname}.${field_varname}.toString())") // public SubenumUUT subenumField; // // @JsonField( // fieldName = SUBENUM_LIST_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = "${generator_object}.writeString(element.toString())", // fieldAssignmentFormatter = // "${object_varname}.${field_varname} = " // + "new ArrayList<SimpleParseUUT.SubenumUUT>(${extracted_value})") // public List<SubenumUUT> subenumFieldList; // // /** UUT for embedding a subobject. */ // @JsonType // public static class SubobjectParseUUT { // public static final String INT_FIELD_NAME = "int"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // } // // /** UUT for embedding a subenum. */ // public enum SubenumUUT { // A, // B // } // }
import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import com.fasterxml.jackson.core.JsonGenerator; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT__JsonHelper; import java.lang.reflect.Method; import org.junit.Test;
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.annotation.processor; public class SelectiveGenerationTest { @Test public void testMissingSerializersGlobalSwitch() throws Exception { Method serializeMethod =
// Path: processor/testuut/noserializers/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerGlobalUUT.java // @JsonType // public class NoSerializerGlobalUUT { // // @JsonField(fieldName = "value") // String mValue; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerClassUUT.java // @JsonType(generateSerializer = JsonType.TriState.NO) // public class NoSerializerClassUUT { // // enum DummyEnum { // A, // B; // } // // @JsonField(fieldName = "value") // String mValue; // // /** // * Ensure that we don't have to provide a serializeCodeFormatter for enums if serialization is // * disabled. // */ // @JsonField( // fieldName = "dummyEnum", // valueExtractFormatter = "NoSerializerClassUUT.DummyEnum.valueOf(${parser_object}.getText())") // DummyEnum dummyEnum; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/SimpleParseUUT.java // @JsonType // public class SimpleParseUUT { // public static final String INT_FIELD_NAME = "int"; // public static final String INTEGER_FIELD_NAME = "Integer"; // public static final String FLOAT_FIELD_NAME = "float"; // public static final String FLOAT_OBJ_FIELD_NAME = "Float"; // public static final String STRING_FIELD_NAME = "String"; // public static final String INTEGER_LIST_FIELD_NAME = "IntegerList"; // public static final String INTEGER_ARRAY_LIST_FIELD_NAME = "IntegerArrayList"; // public static final String INTEGER_QUEUE_FIELD_NAME = "IntegerQueue"; // public static final String INTEGER_SET_FIELD_NAME = "IntegerSet"; // public static final String SUBOBJECT_FIELD_NAME = "Subobject"; // public static final String SUBENUM_FIELD_NAME = "Subenum"; // public static final String SUBENUM_LIST_FIELD_NAME = "SubenumList"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // // @JsonField(fieldName = INTEGER_FIELD_NAME) // public Integer integerField; // // @JsonField(fieldName = FLOAT_FIELD_NAME) // public float floatField; // // @JsonField(fieldName = FLOAT_OBJ_FIELD_NAME) // public Float FloatField; // // @JsonField(fieldName = STRING_FIELD_NAME, mapping = JsonField.TypeMapping.EXACT) // public String stringField; // // @JsonField(fieldName = INTEGER_LIST_FIELD_NAME) // public List<Integer> integerListField; // // @JsonField(fieldName = INTEGER_ARRAY_LIST_FIELD_NAME) // public ArrayList<Integer> integerArrayListField; // // @JsonField(fieldName = INTEGER_QUEUE_FIELD_NAME) // public Queue<Integer> integerQueueField; // // @JsonField(fieldName = INTEGER_SET_FIELD_NAME) // public Set<Integer> integerSetField; // // @JsonField(fieldName = SUBOBJECT_FIELD_NAME) // public SubobjectParseUUT subobjectField; // // @JsonField( // fieldName = SUBENUM_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = // "${generator_object}.writeStringField(\"${json_fieldname}\", " // + "${object_varname}.${field_varname}.toString())") // public SubenumUUT subenumField; // // @JsonField( // fieldName = SUBENUM_LIST_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = "${generator_object}.writeString(element.toString())", // fieldAssignmentFormatter = // "${object_varname}.${field_varname} = " // + "new ArrayList<SimpleParseUUT.SubenumUUT>(${extracted_value})") // public List<SubenumUUT> subenumFieldList; // // /** UUT for embedding a subobject. */ // @JsonType // public static class SubobjectParseUUT { // public static final String INT_FIELD_NAME = "int"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // } // // /** UUT for embedding a subenum. */ // public enum SubenumUUT { // A, // B // } // } // Path: processor/src/test/java/com/instagram/common/json/annotation/processor/SelectiveGenerationTest.java import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import com.fasterxml.jackson.core.JsonGenerator; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT__JsonHelper; import java.lang.reflect.Method; import org.junit.Test; /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.annotation.processor; public class SelectiveGenerationTest { @Test public void testMissingSerializersGlobalSwitch() throws Exception { Method serializeMethod =
SimpleParseUUT__JsonHelper.class.getMethod("serializeToJson", SimpleParseUUT.class);
Instagram/ig-json-parser
processor/src/test/java/com/instagram/common/json/annotation/processor/SelectiveGenerationTest.java
// Path: processor/testuut/noserializers/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerGlobalUUT.java // @JsonType // public class NoSerializerGlobalUUT { // // @JsonField(fieldName = "value") // String mValue; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerClassUUT.java // @JsonType(generateSerializer = JsonType.TriState.NO) // public class NoSerializerClassUUT { // // enum DummyEnum { // A, // B; // } // // @JsonField(fieldName = "value") // String mValue; // // /** // * Ensure that we don't have to provide a serializeCodeFormatter for enums if serialization is // * disabled. // */ // @JsonField( // fieldName = "dummyEnum", // valueExtractFormatter = "NoSerializerClassUUT.DummyEnum.valueOf(${parser_object}.getText())") // DummyEnum dummyEnum; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/SimpleParseUUT.java // @JsonType // public class SimpleParseUUT { // public static final String INT_FIELD_NAME = "int"; // public static final String INTEGER_FIELD_NAME = "Integer"; // public static final String FLOAT_FIELD_NAME = "float"; // public static final String FLOAT_OBJ_FIELD_NAME = "Float"; // public static final String STRING_FIELD_NAME = "String"; // public static final String INTEGER_LIST_FIELD_NAME = "IntegerList"; // public static final String INTEGER_ARRAY_LIST_FIELD_NAME = "IntegerArrayList"; // public static final String INTEGER_QUEUE_FIELD_NAME = "IntegerQueue"; // public static final String INTEGER_SET_FIELD_NAME = "IntegerSet"; // public static final String SUBOBJECT_FIELD_NAME = "Subobject"; // public static final String SUBENUM_FIELD_NAME = "Subenum"; // public static final String SUBENUM_LIST_FIELD_NAME = "SubenumList"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // // @JsonField(fieldName = INTEGER_FIELD_NAME) // public Integer integerField; // // @JsonField(fieldName = FLOAT_FIELD_NAME) // public float floatField; // // @JsonField(fieldName = FLOAT_OBJ_FIELD_NAME) // public Float FloatField; // // @JsonField(fieldName = STRING_FIELD_NAME, mapping = JsonField.TypeMapping.EXACT) // public String stringField; // // @JsonField(fieldName = INTEGER_LIST_FIELD_NAME) // public List<Integer> integerListField; // // @JsonField(fieldName = INTEGER_ARRAY_LIST_FIELD_NAME) // public ArrayList<Integer> integerArrayListField; // // @JsonField(fieldName = INTEGER_QUEUE_FIELD_NAME) // public Queue<Integer> integerQueueField; // // @JsonField(fieldName = INTEGER_SET_FIELD_NAME) // public Set<Integer> integerSetField; // // @JsonField(fieldName = SUBOBJECT_FIELD_NAME) // public SubobjectParseUUT subobjectField; // // @JsonField( // fieldName = SUBENUM_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = // "${generator_object}.writeStringField(\"${json_fieldname}\", " // + "${object_varname}.${field_varname}.toString())") // public SubenumUUT subenumField; // // @JsonField( // fieldName = SUBENUM_LIST_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = "${generator_object}.writeString(element.toString())", // fieldAssignmentFormatter = // "${object_varname}.${field_varname} = " // + "new ArrayList<SimpleParseUUT.SubenumUUT>(${extracted_value})") // public List<SubenumUUT> subenumFieldList; // // /** UUT for embedding a subobject. */ // @JsonType // public static class SubobjectParseUUT { // public static final String INT_FIELD_NAME = "int"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // } // // /** UUT for embedding a subenum. */ // public enum SubenumUUT { // A, // B // } // }
import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import com.fasterxml.jackson.core.JsonGenerator; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT__JsonHelper; import java.lang.reflect.Method; import org.junit.Test;
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.annotation.processor; public class SelectiveGenerationTest { @Test public void testMissingSerializersGlobalSwitch() throws Exception { Method serializeMethod = SimpleParseUUT__JsonHelper.class.getMethod("serializeToJson", SimpleParseUUT.class); assertNotNull(serializeMethod); serializeMethod = SimpleParseUUT__JsonHelper.class.getMethod( "serializeToJson", JsonGenerator.class, SimpleParseUUT.class, boolean.class); assertNotNull(serializeMethod); try { serializeMethod = null; serializeMethod = NoSerializerGlobalUUT__JsonHelper.class.getMethod(
// Path: processor/testuut/noserializers/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerGlobalUUT.java // @JsonType // public class NoSerializerGlobalUUT { // // @JsonField(fieldName = "value") // String mValue; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/NoSerializerClassUUT.java // @JsonType(generateSerializer = JsonType.TriState.NO) // public class NoSerializerClassUUT { // // enum DummyEnum { // A, // B; // } // // @JsonField(fieldName = "value") // String mValue; // // /** // * Ensure that we don't have to provide a serializeCodeFormatter for enums if serialization is // * disabled. // */ // @JsonField( // fieldName = "dummyEnum", // valueExtractFormatter = "NoSerializerClassUUT.DummyEnum.valueOf(${parser_object}.getText())") // DummyEnum dummyEnum; // } // // Path: processor/testuut/src/main/java/com/instagram/common/json/annotation/processor/SimpleParseUUT.java // @JsonType // public class SimpleParseUUT { // public static final String INT_FIELD_NAME = "int"; // public static final String INTEGER_FIELD_NAME = "Integer"; // public static final String FLOAT_FIELD_NAME = "float"; // public static final String FLOAT_OBJ_FIELD_NAME = "Float"; // public static final String STRING_FIELD_NAME = "String"; // public static final String INTEGER_LIST_FIELD_NAME = "IntegerList"; // public static final String INTEGER_ARRAY_LIST_FIELD_NAME = "IntegerArrayList"; // public static final String INTEGER_QUEUE_FIELD_NAME = "IntegerQueue"; // public static final String INTEGER_SET_FIELD_NAME = "IntegerSet"; // public static final String SUBOBJECT_FIELD_NAME = "Subobject"; // public static final String SUBENUM_FIELD_NAME = "Subenum"; // public static final String SUBENUM_LIST_FIELD_NAME = "SubenumList"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // // @JsonField(fieldName = INTEGER_FIELD_NAME) // public Integer integerField; // // @JsonField(fieldName = FLOAT_FIELD_NAME) // public float floatField; // // @JsonField(fieldName = FLOAT_OBJ_FIELD_NAME) // public Float FloatField; // // @JsonField(fieldName = STRING_FIELD_NAME, mapping = JsonField.TypeMapping.EXACT) // public String stringField; // // @JsonField(fieldName = INTEGER_LIST_FIELD_NAME) // public List<Integer> integerListField; // // @JsonField(fieldName = INTEGER_ARRAY_LIST_FIELD_NAME) // public ArrayList<Integer> integerArrayListField; // // @JsonField(fieldName = INTEGER_QUEUE_FIELD_NAME) // public Queue<Integer> integerQueueField; // // @JsonField(fieldName = INTEGER_SET_FIELD_NAME) // public Set<Integer> integerSetField; // // @JsonField(fieldName = SUBOBJECT_FIELD_NAME) // public SubobjectParseUUT subobjectField; // // @JsonField( // fieldName = SUBENUM_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = // "${generator_object}.writeStringField(\"${json_fieldname}\", " // + "${object_varname}.${field_varname}.toString())") // public SubenumUUT subenumField; // // @JsonField( // fieldName = SUBENUM_LIST_FIELD_NAME, // valueExtractFormatter = "SimpleParseUUT.SubenumUUT.valueOf(${parser_object}.getText())", // serializeCodeFormatter = "${generator_object}.writeString(element.toString())", // fieldAssignmentFormatter = // "${object_varname}.${field_varname} = " // + "new ArrayList<SimpleParseUUT.SubenumUUT>(${extracted_value})") // public List<SubenumUUT> subenumFieldList; // // /** UUT for embedding a subobject. */ // @JsonType // public static class SubobjectParseUUT { // public static final String INT_FIELD_NAME = "int"; // // @JsonField(fieldName = INT_FIELD_NAME) // public int intField; // } // // /** UUT for embedding a subenum. */ // public enum SubenumUUT { // A, // B // } // } // Path: processor/src/test/java/com/instagram/common/json/annotation/processor/SelectiveGenerationTest.java import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; import com.fasterxml.jackson.core.JsonGenerator; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT; import com.instagram.common.json.annotation.processor.noserializers.NoSerializerGlobalUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT; import com.instagram.common.json.annotation.processor.uut.NoSerializerClassUUT__JsonHelper; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT; import com.instagram.common.json.annotation.processor.uut.SimpleParseUUT__JsonHelper; import java.lang.reflect.Method; import org.junit.Test; /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.annotation.processor; public class SelectiveGenerationTest { @Test public void testMissingSerializersGlobalSwitch() throws Exception { Method serializeMethod = SimpleParseUUT__JsonHelper.class.getMethod("serializeToJson", SimpleParseUUT.class); assertNotNull(serializeMethod); serializeMethod = SimpleParseUUT__JsonHelper.class.getMethod( "serializeToJson", JsonGenerator.class, SimpleParseUUT.class, boolean.class); assertNotNull(serializeMethod); try { serializeMethod = null; serializeMethod = NoSerializerGlobalUUT__JsonHelper.class.getMethod(
"serializeToJson", NoSerializerGlobalUUT.class);
Instagram/ig-json-parser
demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // }
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException;
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) {
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // } // Path: demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException; /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) {
IgModelRequest igModel;
Instagram/ig-json-parser
demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // }
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException;
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel;
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // } // Path: demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException; /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel;
OmModelRequest omModel;
Instagram/ig-json-parser
demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // }
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException;
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) {
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // } // Path: demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException; /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) {
igModel = new IgModelWorker().parseFromString(mJsonString);
Instagram/ig-json-parser
demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // }
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException;
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) { igModel = new IgModelWorker().parseFromString(mJsonString); } else if (useOmParser) {
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // } // Path: demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException; /* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.instagram.common.json.app.benchmark; public class BenchmarkActivity extends Activity { private String mJsonString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.benchmark_activity); mJsonString = FileUtilsKt.rawResourceAsString(this, R.raw.benchmark_input); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) { igModel = new IgModelWorker().parseFromString(mJsonString); } else if (useOmParser) {
omModel = new OmModelWorker().parseFromString(mJsonString);
Instagram/ig-json-parser
demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // }
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException;
View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) { igModel = new IgModelWorker().parseFromString(mJsonString); } else if (useOmParser) { omModel = new OmModelWorker().parseFromString(mJsonString); } bs.after(); } catch (IOException ex) { Toast.makeText( BenchmarkActivity.this, "yeah, bad things happened", Toast.LENGTH_LONG) .show(); return; } } else { String multiIterationInputString = generateInputString(iterations);
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // } // Path: demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException; View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) { igModel = new IgModelWorker().parseFromString(mJsonString); } else if (useOmParser) { omModel = new OmModelWorker().parseFromString(mJsonString); } bs.after(); } catch (IOException ex) { Toast.makeText( BenchmarkActivity.this, "yeah, bad things happened", Toast.LENGTH_LONG) .show(); return; } } else { String multiIterationInputString = generateInputString(iterations);
IgListOfModels igListofModels;
Instagram/ig-json-parser
demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // }
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException;
View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) { igModel = new IgModelWorker().parseFromString(mJsonString); } else if (useOmParser) { omModel = new OmModelWorker().parseFromString(mJsonString); } bs.after(); } catch (IOException ex) { Toast.makeText( BenchmarkActivity.this, "yeah, bad things happened", Toast.LENGTH_LONG) .show(); return; } } else { String multiIterationInputString = generateInputString(iterations); IgListOfModels igListofModels;
// Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgListOfModels.java // @JsonType // public class IgListOfModels { // @JsonField(fieldName = "list") // List<IgModelRequest> list; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelRequest.java // @JsonType // public class IgModelRequest { // @JsonField(fieldName = "meta") // Meta meta; // // @JsonField(fieldName = "data") // List<Data> data; // } // // Path: demo/igmodel/src/main/java/com/instagram/common/json/app/igmodel/IgModelWorker.java // public class IgModelWorker { // public IgModelRequest parseFromString(String input) throws IOException { // return IgModelRequest__JsonHelper.parseFromJson(input); // } // // public IgListOfModels parseListFromString(String input) throws IOException { // return IgListOfModels__JsonHelper.parseFromJson(input); // } // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmListOfModels.java // public class OmListOfModels { // @JsonProperty("list") // List<OmModelRequest> list; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelRequest.java // public class OmModelRequest { // @JsonProperty("meta") // Meta meta; // // @JsonProperty("data") // List<Data> data; // } // // Path: demo/src/main/java/com/instagram/common/json/app/ommodel/OmModelWorker.java // public class OmModelWorker { // private static final ObjectMapper sObjectMapper = new ObjectMapper(); // // public OmModelRequest parseFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmModelRequest.class); // } // // public OmListOfModels parseListFromString(String input) throws IOException { // return sObjectMapper.readValue(input, OmListOfModels.class); // } // } // Path: demo/src/main/java/com/instagram/common/json/app/benchmark/BenchmarkActivity.java import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.instagram.common.json.app.igmodel.IgListOfModels; import com.instagram.common.json.app.igmodel.IgModelRequest; import com.instagram.common.json.app.igmodel.IgModelWorker; import com.instagram.common.json.app.ommodel.OmListOfModels; import com.instagram.common.json.app.ommodel.OmModelRequest; import com.instagram.common.json.app.ommodel.OmModelWorker; import com.instagram.common.json.app.utils.FileUtilsKt; import com.instagram.jsonbenchmark.app.R; import java.io.IOException; View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { boolean useIgParser = (view == findViewById(R.id.ig_parse_button)); boolean useOmParser = (view == findViewById(R.id.om_parse_button)); BenchmarkStats bs = new BenchmarkStats(); int iterations = getIterationCount(); if (iterations == 1) { IgModelRequest igModel; OmModelRequest omModel; try { bs.before(); if (useIgParser) { igModel = new IgModelWorker().parseFromString(mJsonString); } else if (useOmParser) { omModel = new OmModelWorker().parseFromString(mJsonString); } bs.after(); } catch (IOException ex) { Toast.makeText( BenchmarkActivity.this, "yeah, bad things happened", Toast.LENGTH_LONG) .show(); return; } } else { String multiIterationInputString = generateInputString(iterations); IgListOfModels igListofModels;
OmListOfModels omListofModels;
grooviter/asteroid
asteroid-core/src/main/java/asteroid/Criterias.java
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractMethodNodeTransformer.java // public abstract class AbstractMethodNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find methods eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * MethodNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link MethodNode} will be discarded. // * // * @deprecated // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified method) // * @since 0.2.0 // * @see asteroid.Criterias#byMethodNodeNameContains(String) // */ // public AbstractMethodNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitMethod(final MethodNode methodNode) { // if (methodNode == null || !this.criteria.call(methodNode)) { // return; // } // // transformMethod(methodNode); // } // // /** // * Within this method developer could modify the {@link MethodNode} // * instance. // * // * @param methodNode the {@link MethodNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformMethod(MethodNode methodNode); // // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractClassNodeTransformer.java // public abstract class AbstractClassNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find classes eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * ClassNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link ClassNode} will be discarded. // * // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified class) // * @since 0.2.0 // * @see asteroid.Criterias#byClassNodeNameContains(String) // */ // public AbstractClassNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitClass(final ClassNode classNode) { // if (classNode == null || !this.criteria.call(classNode)) { // return; // } // // transformClass(classNode); // } // // /** // * Within this method developer could modify the {@link ClassNode} // * instance. // * // * @param classNode the {@link ClassNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformClass(final ClassNode classNode); // // }
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.any; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.every; import static asteroid.utils.InternalUtils.collect; import groovy.lang.Closure; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.BinaryExpression; import org.codehaus.groovy.ast.expr.MethodCallExpression; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.syntax.Types; import org.codehaus.groovy.runtime.DefaultGroovyMethods; import asteroid.transformer.AbstractMethodNodeTransformer; import asteroid.transformer.AbstractClassNodeTransformer; import java.util.List;
* with a name equals to the name passed as parameter * * @param name the method name * @return a search criteria * @since 0.2.4 */ public static <T extends Expression> Closure<Boolean> byExprMethodCallByName(final String name) { return new Closure<Boolean>(null) { public Boolean doCall(final T expression) { if (!(expression instanceof MethodCallExpression)) { return false; } final MethodCallExpression expr = (MethodCallExpression) expression; return expr.getMethodAsString().equals(name); } }; } /** * This method returns a criteria to look for {@link * MethodCallExpression} with arguments with the types specified * as parameters * * @param argTypes the classes of every parameter * @return a search criteria * @since 0.2.9 */ public static Closure<Boolean> byExprMethodCallByArgs(final Class... argTypes) {
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractMethodNodeTransformer.java // public abstract class AbstractMethodNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find methods eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * MethodNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link MethodNode} will be discarded. // * // * @deprecated // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified method) // * @since 0.2.0 // * @see asteroid.Criterias#byMethodNodeNameContains(String) // */ // public AbstractMethodNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitMethod(final MethodNode methodNode) { // if (methodNode == null || !this.criteria.call(methodNode)) { // return; // } // // transformMethod(methodNode); // } // // /** // * Within this method developer could modify the {@link MethodNode} // * instance. // * // * @param methodNode the {@link MethodNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformMethod(MethodNode methodNode); // // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractClassNodeTransformer.java // public abstract class AbstractClassNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find classes eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * ClassNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link ClassNode} will be discarded. // * // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified class) // * @since 0.2.0 // * @see asteroid.Criterias#byClassNodeNameContains(String) // */ // public AbstractClassNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitClass(final ClassNode classNode) { // if (classNode == null || !this.criteria.call(classNode)) { // return; // } // // transformClass(classNode); // } // // /** // * Within this method developer could modify the {@link ClassNode} // * instance. // * // * @param classNode the {@link ClassNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformClass(final ClassNode classNode); // // } // Path: asteroid-core/src/main/java/asteroid/Criterias.java import static org.codehaus.groovy.runtime.DefaultGroovyMethods.any; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.every; import static asteroid.utils.InternalUtils.collect; import groovy.lang.Closure; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.BinaryExpression; import org.codehaus.groovy.ast.expr.MethodCallExpression; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.syntax.Types; import org.codehaus.groovy.runtime.DefaultGroovyMethods; import asteroid.transformer.AbstractMethodNodeTransformer; import asteroid.transformer.AbstractClassNodeTransformer; import java.util.List; * with a name equals to the name passed as parameter * * @param name the method name * @return a search criteria * @since 0.2.4 */ public static <T extends Expression> Closure<Boolean> byExprMethodCallByName(final String name) { return new Closure<Boolean>(null) { public Boolean doCall(final T expression) { if (!(expression instanceof MethodCallExpression)) { return false; } final MethodCallExpression expr = (MethodCallExpression) expression; return expr.getMethodAsString().equals(name); } }; } /** * This method returns a criteria to look for {@link * MethodCallExpression} with arguments with the types specified * as parameters * * @param argTypes the classes of every parameter * @return a search criteria * @since 0.2.9 */ public static Closure<Boolean> byExprMethodCallByArgs(final Class... argTypes) {
return byExprMethodCallByArgs(collect(argTypes, toClassNode()).toArray(new ClassNode[argTypes.length]));
grooviter/asteroid
asteroid-core/src/main/java/asteroid/statements/TryCatchStatementBuilder.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import asteroid.A; import java.util.List; import java.util.ArrayList; import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.stmt.CatchStatement; import org.codehaus.groovy.ast.stmt.TryCatchStatement;
package asteroid.statements; /** * This builder tries to make it easier to build a try/catch * statement.<br/><br/> * * <strong>AST</strong> * <pre><code>TryCatchStatement stmt = A.STMT.tryCatchSBuilder() * .tryStmt(protectedStmt) * .addCatchStmt(Exception, 'ex', handlerOneStmt) * .addCatchStmt(IllegalStatementException, 'ix', handlerTwoStmt) * // ... add as many catch as you need * .finallyStmt(finallyStatement) * .build()</code></pre> * * <strong>Result</strong> * <pre><code>try { * // protectedStmt * } catch(Exception ex) { * // handlerOneStmt * } catch(IllegalStateException ix) { * // handlerTwoStmt * } finally { * // finallyStatement * }</code></pre> * * * @since 0.2.3 */ public class TryCatchStatementBuilder { private final List<CatchStatement> catchStatements = new ArrayList<>(); private Statement tryStatement; private Statement finallyStatement; /** * Adds the try statement * * @param stmt the code you want to protect * @return the current builder instance * @since 0.2.3 */ public TryCatchStatementBuilder tryStmt(final Statement stmt) { tryStatement = stmt; return this; } /** * Adds one catch statement to catch a specific exception giving a * specific name for the exception variable. * * </br></br><b>IMPORTANT: </b> * This method uses {@link Class} to specify the class of the {@link Exception}. Don't * use it if you are targetting a very early compilation stage. If so use the method * using {@link ClassNode} * * @param exceptionType the {@link Class} of the exception you want to catch * @param exceptionVarName the name of the exception variable * @param stmt the code handling the exception * @return the current builder instance * @since 0.2.3 */ public TryCatchStatementBuilder addCatchStmt(final Class exceptionType, final String exceptionVarName, final Statement stmt) {
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/statements/TryCatchStatementBuilder.java import asteroid.A; import java.util.List; import java.util.ArrayList; import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.stmt.CatchStatement; import org.codehaus.groovy.ast.stmt.TryCatchStatement; package asteroid.statements; /** * This builder tries to make it easier to build a try/catch * statement.<br/><br/> * * <strong>AST</strong> * <pre><code>TryCatchStatement stmt = A.STMT.tryCatchSBuilder() * .tryStmt(protectedStmt) * .addCatchStmt(Exception, 'ex', handlerOneStmt) * .addCatchStmt(IllegalStatementException, 'ix', handlerTwoStmt) * // ... add as many catch as you need * .finallyStmt(finallyStatement) * .build()</code></pre> * * <strong>Result</strong> * <pre><code>try { * // protectedStmt * } catch(Exception ex) { * // handlerOneStmt * } catch(IllegalStateException ix) { * // handlerTwoStmt * } finally { * // finallyStatement * }</code></pre> * * * @since 0.2.3 */ public class TryCatchStatementBuilder { private final List<CatchStatement> catchStatements = new ArrayList<>(); private Statement tryStatement; private Statement finallyStatement; /** * Adds the try statement * * @param stmt the code you want to protect * @return the current builder instance * @since 0.2.3 */ public TryCatchStatementBuilder tryStmt(final Statement stmt) { tryStatement = stmt; return this; } /** * Adds one catch statement to catch a specific exception giving a * specific name for the exception variable. * * </br></br><b>IMPORTANT: </b> * This method uses {@link Class} to specify the class of the {@link Exception}. Don't * use it if you are targetting a very early compilation stage. If so use the method * using {@link ClassNode} * * @param exceptionType the {@link Class} of the exception you want to catch * @param exceptionVarName the name of the exception variable * @param stmt the code handling the exception * @return the current builder instance * @since 0.2.3 */ public TryCatchStatementBuilder addCatchStmt(final Class exceptionType, final String exceptionVarName, final Statement stmt) {
return this.addCatchStmt(A.NODES.clazz(exceptionType).build(), exceptionVarName, stmt);
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/PhaseTransformation.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/AbstractLocalTransformation.java // public abstract class AbstractLocalTransformation<T extends Annotation,S extends AnnotatedNode> // extends AbstractASTTransformation { // // private final Class<T> annotation; // // /** // * Default constructor // * // * @throws IllegalAccessException // * @since 0.2.0 // */ // @SuppressWarnings("PMD.SignatureDeclaredThrowsException") // public AbstractLocalTransformation() throws IllegalAccessException { // throw new IllegalAccessException("This method should never be used. It will be re-created by a local AST transformation"); // } // // /** // * Default constructor // * // * @param annotation The type of the annotatino used to trigger the transformation // * @since 0.2.0 // */ // public AbstractLocalTransformation(final Class<T> annotation) { // this.annotation = annotation; // } // // /** // * This method processes all annotated nodes annotated with a specific annotation node. // * // * @param annotation the annotation information // * @param annotated the ast node annotated with the specific annotation // * @since 0.2.0 // */ // public abstract void doVisit(AnnotationNode annotation, final S annotated); // // /** // * {@inheritDoc} // */ // @Override // public void visit(final ASTNode[] nodes, final SourceUnit source) { // if (shouldSkip(nodes)) { // return; // skip // } // // final AnnotationNode marker = (AnnotationNode) first(nodes); // // final ClassNode type = marker.getClassNode(); // final ClassNode reference = make(annotation); // final Boolean isAnnotationOk = A.UTIL.NODE.isOrExtends(type, reference); // // if (!isAnnotationOk) { // return; // } // // final S annotated = (S) last(nodes); // // this.sourceUnit = source; // // doVisit(marker, annotated); // } // // private boolean shouldSkip(final ASTNode... nodes) { // return nodes == null || nodes.length != 2 || // !(nodes[0] instanceof AnnotationNode) || // !(nodes[1] instanceof AnnotatedNode); // } // }
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import java.util.Arrays; import java.util.List; import asteroid.A; import asteroid.AbstractLocalTransformation; import asteroid.Phase; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ConstructorNode; import org.codehaus.groovy.ast.GenericsType; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.transform.GroovyASTTransformation;
package asteroid.internal; /** * This transformation makes easier to declare a given local transformation. It narrows the available * compilation phases to those only capable of being used in a local transformation. The way of declaring * the transformation makes clearer the fact that it is a local transformation. * * @since 0.2.0 */ @GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS) public class PhaseTransformation extends AbstractLocalTransformation<Phase,ClassNode> { private static final String METHOD_DOVISIT = "doVisit"; /** * Constructor using abstraction {@link AbstractLocalTransformation} * * @since 0.2.0 */ public PhaseTransformation() { super(Phase.class); } /** * {@inheritDoc} * * @since 0.2.0 */ @Override public void doVisit(final AnnotationNode annotationNode, final ClassNode annotatedNode) {
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/AbstractLocalTransformation.java // public abstract class AbstractLocalTransformation<T extends Annotation,S extends AnnotatedNode> // extends AbstractASTTransformation { // // private final Class<T> annotation; // // /** // * Default constructor // * // * @throws IllegalAccessException // * @since 0.2.0 // */ // @SuppressWarnings("PMD.SignatureDeclaredThrowsException") // public AbstractLocalTransformation() throws IllegalAccessException { // throw new IllegalAccessException("This method should never be used. It will be re-created by a local AST transformation"); // } // // /** // * Default constructor // * // * @param annotation The type of the annotatino used to trigger the transformation // * @since 0.2.0 // */ // public AbstractLocalTransformation(final Class<T> annotation) { // this.annotation = annotation; // } // // /** // * This method processes all annotated nodes annotated with a specific annotation node. // * // * @param annotation the annotation information // * @param annotated the ast node annotated with the specific annotation // * @since 0.2.0 // */ // public abstract void doVisit(AnnotationNode annotation, final S annotated); // // /** // * {@inheritDoc} // */ // @Override // public void visit(final ASTNode[] nodes, final SourceUnit source) { // if (shouldSkip(nodes)) { // return; // skip // } // // final AnnotationNode marker = (AnnotationNode) first(nodes); // // final ClassNode type = marker.getClassNode(); // final ClassNode reference = make(annotation); // final Boolean isAnnotationOk = A.UTIL.NODE.isOrExtends(type, reference); // // if (!isAnnotationOk) { // return; // } // // final S annotated = (S) last(nodes); // // this.sourceUnit = source; // // doVisit(marker, annotated); // } // // private boolean shouldSkip(final ASTNode... nodes) { // return nodes == null || nodes.length != 2 || // !(nodes[0] instanceof AnnotationNode) || // !(nodes[1] instanceof AnnotatedNode); // } // } // Path: asteroid-core/src/main/java/asteroid/internal/PhaseTransformation.java import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import java.util.Arrays; import java.util.List; import asteroid.A; import asteroid.AbstractLocalTransformation; import asteroid.Phase; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ConstructorNode; import org.codehaus.groovy.ast.GenericsType; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.transform.GroovyASTTransformation; package asteroid.internal; /** * This transformation makes easier to declare a given local transformation. It narrows the available * compilation phases to those only capable of being used in a local transformation. The way of declaring * the transformation makes clearer the fact that it is a local transformation. * * @since 0.2.0 */ @GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS) public class PhaseTransformation extends AbstractLocalTransformation<Phase,ClassNode> { private static final String METHOD_DOVISIT = "doVisit"; /** * Constructor using abstraction {@link AbstractLocalTransformation} * * @since 0.2.0 */ public PhaseTransformation() { super(Phase.class); } /** * {@inheritDoc} * * @since 0.2.0 */ @Override public void doVisit(final AnnotationNode annotationNode, final ClassNode annotatedNode) {
if(!A.UTIL.NODE.isOrExtends(annotatedNode, AbstractLocalTransformation.class)) {
grooviter/asteroid
asteroid-core/src/main/java/asteroid/Statements.java
// Path: asteroid-core/src/main/java/asteroid/statements/TryCatchStatementBuilder.java // public class TryCatchStatementBuilder { // // private final List<CatchStatement> catchStatements = new ArrayList<>(); // // private Statement tryStatement; // private Statement finallyStatement; // // /** // * Adds the try statement // * // * @param stmt the code you want to protect // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder tryStmt(final Statement stmt) { // tryStatement = stmt; // return this; // } // // /** // * Adds one catch statement to catch a specific exception giving a // * specific name for the exception variable. // * // * </br></br><b>IMPORTANT: </b> // * This method uses {@link Class} to specify the class of the {@link Exception}. Don't // * use it if you are targetting a very early compilation stage. If so use the method // * using {@link ClassNode} // * // * @param exceptionType the {@link Class} of the exception you want to catch // * @param exceptionVarName the name of the exception variable // * @param stmt the code handling the exception // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder addCatchStmt(final Class exceptionType, final String exceptionVarName, final Statement stmt) { // return this.addCatchStmt(A.NODES.clazz(exceptionType).build(), exceptionVarName, stmt); // } // // /** // * Adds one catch statement to catch a specific exception giving a // * specific name for the exception variable. // * // * @param exceptionType the {@link ClassNode} of the exception you want to catch // * @param exceptionVarName the name of the exception variable // * @param stmt the code handling the exception // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder addCatchStmt(final ClassNode exceptionType, final String exceptionVarName, final Statement stmt) { // final Parameter param = A.NODES.param(exceptionVarName).type(exceptionType).build(); // final CatchStatement catchStatement = new CatchStatement(param, stmt); // // catchStatements.add(catchStatement); // return this; // } // // /** // * Adds the statement that will be placed inside the finally block // * // * @param stmt the code executed in the finally block // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder finallyStmt(final Statement stmt) { // finallyStatement = stmt; // return this; // } // // /** // * Returns the created {@link TryCatchStatement} instance. At // * least the "try" statement and the "finally" statement must be // * provided. Otherwise it will throw a {@link // * IllegalStateException} // * // * @return a {@link TryCatchStatement} instance // * @throws IllegalStateException if neither try nor finally statements are provided // * @since 0.2.3 // */ // public TryCatchStatement build() { // if (tryStatement == null || finallyStatement == null) { // throw new IllegalStateException("Both try statement and finally statement must be provided"); // } // // final TryCatchStatement tryCatchStmt = new TryCatchStatement(tryStatement, finallyStatement); // // if (!catchStatements.isEmpty()) { // tryCatchStmt // .getCatchStatements() // .addAll(catchStatements); // } // // return tryCatchStmt; // } // }
import java.util.List; import org.codehaus.groovy.ast.VariableScope; import org.codehaus.groovy.ast.expr.ArgumentListExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.stmt.IfStatement; import org.codehaus.groovy.ast.stmt.WhileStatement; import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.stmt.ThrowStatement; import org.codehaus.groovy.ast.stmt.ReturnStatement; import org.codehaus.groovy.ast.stmt.AssertStatement; import org.codehaus.groovy.ast.stmt.DoWhileStatement; import org.codehaus.groovy.ast.tools.GeneralUtils; import org.codehaus.groovy.ast.builder.AstBuilder; import org.codehaus.groovy.ast.expr.BooleanExpression; import asteroid.statements.TryCatchStatementBuilder;
} /** * Returns an instance of {@link AssertStatement} * <br><br> * * <strong>AST</strong> * <pre><code>assertS(booleanExpr, "checking something important")</code></pre> * * <strong>Result</strong> * <pre><code>assert 1 == 1 : "checking something important"</code></pre> * * @param booleanExpr the expression we want to check * @param errorMessage the error message in case assertion fails * @return an instance of {@link AssertStatement} * @since 0.1.5 */ public static AssertStatement assertS(final BooleanExpression booleanExpr, final String errorMessage) { return new AssertStatement(booleanExpr, A.EXPR.constX(errorMessage)); } /** * Returns an instance of {@link TryCatchStatementBuilder} to * build complex try/catch statements the easy way. Check {@link * TryCatchStatementBuilder} javadoc to know how to use it. * * @return an instance of {@link TryCatchStatementBuilder} * @see TryCatchStatementBuilder * @since 0.2.3 */
// Path: asteroid-core/src/main/java/asteroid/statements/TryCatchStatementBuilder.java // public class TryCatchStatementBuilder { // // private final List<CatchStatement> catchStatements = new ArrayList<>(); // // private Statement tryStatement; // private Statement finallyStatement; // // /** // * Adds the try statement // * // * @param stmt the code you want to protect // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder tryStmt(final Statement stmt) { // tryStatement = stmt; // return this; // } // // /** // * Adds one catch statement to catch a specific exception giving a // * specific name for the exception variable. // * // * </br></br><b>IMPORTANT: </b> // * This method uses {@link Class} to specify the class of the {@link Exception}. Don't // * use it if you are targetting a very early compilation stage. If so use the method // * using {@link ClassNode} // * // * @param exceptionType the {@link Class} of the exception you want to catch // * @param exceptionVarName the name of the exception variable // * @param stmt the code handling the exception // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder addCatchStmt(final Class exceptionType, final String exceptionVarName, final Statement stmt) { // return this.addCatchStmt(A.NODES.clazz(exceptionType).build(), exceptionVarName, stmt); // } // // /** // * Adds one catch statement to catch a specific exception giving a // * specific name for the exception variable. // * // * @param exceptionType the {@link ClassNode} of the exception you want to catch // * @param exceptionVarName the name of the exception variable // * @param stmt the code handling the exception // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder addCatchStmt(final ClassNode exceptionType, final String exceptionVarName, final Statement stmt) { // final Parameter param = A.NODES.param(exceptionVarName).type(exceptionType).build(); // final CatchStatement catchStatement = new CatchStatement(param, stmt); // // catchStatements.add(catchStatement); // return this; // } // // /** // * Adds the statement that will be placed inside the finally block // * // * @param stmt the code executed in the finally block // * @return the current builder instance // * @since 0.2.3 // */ // public TryCatchStatementBuilder finallyStmt(final Statement stmt) { // finallyStatement = stmt; // return this; // } // // /** // * Returns the created {@link TryCatchStatement} instance. At // * least the "try" statement and the "finally" statement must be // * provided. Otherwise it will throw a {@link // * IllegalStateException} // * // * @return a {@link TryCatchStatement} instance // * @throws IllegalStateException if neither try nor finally statements are provided // * @since 0.2.3 // */ // public TryCatchStatement build() { // if (tryStatement == null || finallyStatement == null) { // throw new IllegalStateException("Both try statement and finally statement must be provided"); // } // // final TryCatchStatement tryCatchStmt = new TryCatchStatement(tryStatement, finallyStatement); // // if (!catchStatements.isEmpty()) { // tryCatchStmt // .getCatchStatements() // .addAll(catchStatements); // } // // return tryCatchStmt; // } // } // Path: asteroid-core/src/main/java/asteroid/Statements.java import java.util.List; import org.codehaus.groovy.ast.VariableScope; import org.codehaus.groovy.ast.expr.ArgumentListExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.stmt.IfStatement; import org.codehaus.groovy.ast.stmt.WhileStatement; import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.stmt.ThrowStatement; import org.codehaus.groovy.ast.stmt.ReturnStatement; import org.codehaus.groovy.ast.stmt.AssertStatement; import org.codehaus.groovy.ast.stmt.DoWhileStatement; import org.codehaus.groovy.ast.tools.GeneralUtils; import org.codehaus.groovy.ast.builder.AstBuilder; import org.codehaus.groovy.ast.expr.BooleanExpression; import asteroid.statements.TryCatchStatementBuilder; } /** * Returns an instance of {@link AssertStatement} * <br><br> * * <strong>AST</strong> * <pre><code>assertS(booleanExpr, "checking something important")</code></pre> * * <strong>Result</strong> * <pre><code>assert 1 == 1 : "checking something important"</code></pre> * * @param booleanExpr the expression we want to check * @param errorMessage the error message in case assertion fails * @return an instance of {@link AssertStatement} * @since 0.1.5 */ public static AssertStatement assertS(final BooleanExpression booleanExpr, final String errorMessage) { return new AssertStatement(booleanExpr, A.EXPR.constX(errorMessage)); } /** * Returns an instance of {@link TryCatchStatementBuilder} to * build complex try/catch statements the easy way. Check {@link * TryCatchStatementBuilder} javadoc to know how to use it. * * @return an instance of {@link TryCatchStatementBuilder} * @see TryCatchStatementBuilder * @since 0.2.3 */
public static TryCatchStatementBuilder tryCatchSBuilder(){
grooviter/asteroid
asteroid-core/src/main/java/asteroid/utils/NodeUtils.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/utils/StatementUtils.java // @SuppressWarnings("PMD.BeanMembersShouldSerialize") // public static class Group { // public final Label label; // public final List<Statement> statements; // // /** // * Default constructor // * // * @param label the label identifying this group // * @param statements the statements that belong to this group // */ // Group(final Label label, final List<Statement> statements) { // this.label = label; // this.statements = statements; // } // // /** // * Utility method to clone a given {@link Group} changing the statement list // * // * @param newStatements the new statements of the group // * @return a new {@link Group} // */ // public Group copyWithStatements(final List<Statement> newStatements) { // return new Group(new Label(label.name, label.expression), newStatements); // } // } // // Path: asteroid-core/src/main/java/asteroid/nodes/AnnotationNodeBuilder.java // final public class AnnotationNodeBuilder { // // private final AnnotationNode annotationNode; // // private AnnotationNodeBuilder(final AnnotationNode annotationNode) { // this.annotationNode = annotationNode; // } // // /** // * Creates an instance of {@link AnnotationNodeBuilder} // * <br><br> // * // * <strong>AST</strong> // * <pre><code>annotation(MyAnnotation.class).build()</code></pre> // * // * <strong>Result</strong> // * <pre><code>@MyAnnotation</code></pre> // * // * @param clazz the annotation type // * @return an instance of {@link AnnotationNodeBuilder} // */ // public static AnnotationNodeBuilder annotation(final Class clazz) { // return new AnnotationNodeBuilder(new AnnotationNode(A.NODES.clazz(clazz).build())); // } // // /** // * Adds a new member to the annotation // * <br><br> // * // * <strong>AST</strong> // * <pre><code>annotation(MyAnnotation.class) // * .member('value', classX(String.class)) // * .build()</code></pre> // * // * <strong>Result</strong> // * <pre><code>@MyAnnotation(String.class)</code></pre> // * // * @param name the name of the new member // * @param expression the value of the new member. It could be {@link org.codehaus.groovy.ast.expr.PropertyExpression} // * {@link org.codehaus.groovy.ast.expr.ClassExpression}, or a {@link org.codehaus.groovy.ast.expr.ConstantExpression} // * @return the current instance of {@link AnnotationNodeBuilder} // */ // public AnnotationNodeBuilder member(final String name, final Expression expression) { // this.annotationNode.addMember(name, expression); // // return this; // } // // /** // * Returns the annotation node configured by this builder // * // * @return an instance of {@link AnnotationNode} // */ // public AnnotationNode build() { // return this.annotationNode; // } // // }
import static org.codehaus.groovy.runtime.StringGroovyMethods.take; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.any; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.find; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last; import java.util.Map; import java.util.List; import java.util.HashMap; import groovy.lang.Closure; import groovy.transform.Generated; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.FieldNode; import org.codehaus.groovy.ast.ModuleNode; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.tools.GeneralUtils; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.stmt.ExpressionStatement; import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import asteroid.A; import asteroid.utils.StatementUtils.Group; import asteroid.nodes.AnnotationNodeBuilder;
package asteroid.utils; /** * General utility methods to deal with {@link ASTNode} instances * * @since 0.1.4 * @see asteroid.Utils */ public class NodeUtils { public static final String ANNOTATION_VALUE = "value";
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/utils/StatementUtils.java // @SuppressWarnings("PMD.BeanMembersShouldSerialize") // public static class Group { // public final Label label; // public final List<Statement> statements; // // /** // * Default constructor // * // * @param label the label identifying this group // * @param statements the statements that belong to this group // */ // Group(final Label label, final List<Statement> statements) { // this.label = label; // this.statements = statements; // } // // /** // * Utility method to clone a given {@link Group} changing the statement list // * // * @param newStatements the new statements of the group // * @return a new {@link Group} // */ // public Group copyWithStatements(final List<Statement> newStatements) { // return new Group(new Label(label.name, label.expression), newStatements); // } // } // // Path: asteroid-core/src/main/java/asteroid/nodes/AnnotationNodeBuilder.java // final public class AnnotationNodeBuilder { // // private final AnnotationNode annotationNode; // // private AnnotationNodeBuilder(final AnnotationNode annotationNode) { // this.annotationNode = annotationNode; // } // // /** // * Creates an instance of {@link AnnotationNodeBuilder} // * <br><br> // * // * <strong>AST</strong> // * <pre><code>annotation(MyAnnotation.class).build()</code></pre> // * // * <strong>Result</strong> // * <pre><code>@MyAnnotation</code></pre> // * // * @param clazz the annotation type // * @return an instance of {@link AnnotationNodeBuilder} // */ // public static AnnotationNodeBuilder annotation(final Class clazz) { // return new AnnotationNodeBuilder(new AnnotationNode(A.NODES.clazz(clazz).build())); // } // // /** // * Adds a new member to the annotation // * <br><br> // * // * <strong>AST</strong> // * <pre><code>annotation(MyAnnotation.class) // * .member('value', classX(String.class)) // * .build()</code></pre> // * // * <strong>Result</strong> // * <pre><code>@MyAnnotation(String.class)</code></pre> // * // * @param name the name of the new member // * @param expression the value of the new member. It could be {@link org.codehaus.groovy.ast.expr.PropertyExpression} // * {@link org.codehaus.groovy.ast.expr.ClassExpression}, or a {@link org.codehaus.groovy.ast.expr.ConstantExpression} // * @return the current instance of {@link AnnotationNodeBuilder} // */ // public AnnotationNodeBuilder member(final String name, final Expression expression) { // this.annotationNode.addMember(name, expression); // // return this; // } // // /** // * Returns the annotation node configured by this builder // * // * @return an instance of {@link AnnotationNode} // */ // public AnnotationNode build() { // return this.annotationNode; // } // // } // Path: asteroid-core/src/main/java/asteroid/utils/NodeUtils.java import static org.codehaus.groovy.runtime.StringGroovyMethods.take; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.any; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.find; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last; import java.util.Map; import java.util.List; import java.util.HashMap; import groovy.lang.Closure; import groovy.transform.Generated; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.FieldNode; import org.codehaus.groovy.ast.ModuleNode; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.tools.GeneralUtils; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.stmt.ExpressionStatement; import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import asteroid.A; import asteroid.utils.StatementUtils.Group; import asteroid.nodes.AnnotationNodeBuilder; package asteroid.utils; /** * General utility methods to deal with {@link ASTNode} instances * * @since 0.1.4 * @see asteroid.Utils */ public class NodeUtils { public static final String ANNOTATION_VALUE = "value";
private static final AnnotationNode GENERATED = AnnotationNodeBuilder
grooviter/asteroid
asteroid-core/src/main/java/asteroid/nodes/PropertyNodeBuilder.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import asteroid.A; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.expr.Expression;
package asteroid.nodes; /** * Creates a new {@link PropertyNode} instance * * @since 0.1.4 */ @SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName") final public class PropertyNodeBuilder { private final String name; private int modifiers; private ClassNode type; private ClassNode owner; private Expression initValueExpr; /* Private constructor */ private PropertyNodeBuilder(final String name) { this.name = name; } /** * Creates a builder from the property name * * @param propertyName the name of the property * @return an instance of {@link PropertyNodeBuilder} * @since 0.1.4 */ public static PropertyNodeBuilder property(final String propertyName) { return new PropertyNodeBuilder(propertyName); } /** * Sets property modifiers: static/public/... * <br><br> * * <strong>AST</strong> * <pre><code>property('solution') * .modifiers(A.ACC.ACC_PUBLIC) * .build()</code></pre> * * <strong>Result</strong> * <pre><code>public Object solution</code></pre> * * @param modifiers use {@link A#ACC} to set property modifiers * @return current instance of {@link PropertyNodeBuilder} * @since 0.1.4 */ public PropertyNodeBuilder modifiers(final int modifiers) { this.modifiers = modifiers; return this; } /** * Sets the type of the property * <br><br> * * <strong>AST</strong> * <pre><code>property('solution') * .modifiers(A.ACC.ACC_PUBLIC) * .type(String) * .build()</code></pre> * * <strong>Result</strong> * <pre><code>public String solution</code></pre> * * @param type the {@link Class} of the property * @return current instance of {@link PropertyNodeBuilder} * @since 0.1.4 */ public PropertyNodeBuilder type(final Class type) {
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/nodes/PropertyNodeBuilder.java import asteroid.A; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.expr.Expression; package asteroid.nodes; /** * Creates a new {@link PropertyNode} instance * * @since 0.1.4 */ @SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName") final public class PropertyNodeBuilder { private final String name; private int modifiers; private ClassNode type; private ClassNode owner; private Expression initValueExpr; /* Private constructor */ private PropertyNodeBuilder(final String name) { this.name = name; } /** * Creates a builder from the property name * * @param propertyName the name of the property * @return an instance of {@link PropertyNodeBuilder} * @since 0.1.4 */ public static PropertyNodeBuilder property(final String propertyName) { return new PropertyNodeBuilder(propertyName); } /** * Sets property modifiers: static/public/... * <br><br> * * <strong>AST</strong> * <pre><code>property('solution') * .modifiers(A.ACC.ACC_PUBLIC) * .build()</code></pre> * * <strong>Result</strong> * <pre><code>public Object solution</code></pre> * * @param modifiers use {@link A#ACC} to set property modifiers * @return current instance of {@link PropertyNodeBuilder} * @since 0.1.4 */ public PropertyNodeBuilder modifiers(final int modifiers) { this.modifiers = modifiers; return this; } /** * Sets the type of the property * <br><br> * * <strong>AST</strong> * <pre><code>property('solution') * .modifiers(A.ACC.ACC_PUBLIC) * .type(String) * .build()</code></pre> * * <strong>Result</strong> * <pre><code>public String solution</code></pre> * * @param type the {@link Class} of the property * @return current instance of {@link PropertyNodeBuilder} * @since 0.1.4 */ public PropertyNodeBuilder type(final Class type) {
this.type = A.NODES.clazz(type).build();
grooviter/asteroid
asteroid-core/src/main/java/asteroid/nodes/AnnotationNodeBuilder.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import asteroid.A; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.expr.Expression;
package asteroid.nodes; /** * Builder to create instances of type {@link AnnotationNode} * * @since 0.1.0 */ final public class AnnotationNodeBuilder { private final AnnotationNode annotationNode; private AnnotationNodeBuilder(final AnnotationNode annotationNode) { this.annotationNode = annotationNode; } /** * Creates an instance of {@link AnnotationNodeBuilder} * <br><br> * * <strong>AST</strong> * <pre><code>annotation(MyAnnotation.class).build()</code></pre> * * <strong>Result</strong> * <pre><code>@MyAnnotation</code></pre> * * @param clazz the annotation type * @return an instance of {@link AnnotationNodeBuilder} */ public static AnnotationNodeBuilder annotation(final Class clazz) {
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/nodes/AnnotationNodeBuilder.java import asteroid.A; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.expr.Expression; package asteroid.nodes; /** * Builder to create instances of type {@link AnnotationNode} * * @since 0.1.0 */ final public class AnnotationNodeBuilder { private final AnnotationNode annotationNode; private AnnotationNodeBuilder(final AnnotationNode annotationNode) { this.annotationNode = annotationNode; } /** * Creates an instance of {@link AnnotationNodeBuilder} * <br><br> * * <strong>AST</strong> * <pre><code>annotation(MyAnnotation.class).build()</code></pre> * * <strong>Result</strong> * <pre><code>@MyAnnotation</code></pre> * * @param clazz the annotation type * @return an instance of {@link AnnotationNodeBuilder} */ public static AnnotationNodeBuilder annotation(final Class clazz) {
return new AnnotationNodeBuilder(new AnnotationNode(A.NODES.clazz(clazz).build()));
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/LocalTransformation.java
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last; import static asteroid.utils.InternalUtils.collect; import asteroid.A; import asteroid.Local; import groovy.lang.Closure; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.ListExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformationClass; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Arrays; import java.util.List;
package asteroid.internal; /** * Reduces the boiler plate code when declaring an annotation as possible target for a given * transformation. * * It adds code such as the {@link java.lang.annotation.Retention} and {@link java.lang.annotation.Target} annotations as well as the * {@link org.codehaus.groovy.transform.GroovyASTTransformationClass}. * * This code: * * <pre> * <code> * import my.transformation.MyTransformation * * {@literal @}Local(MyTransformation) * public @interface MyAnnotation { } * </code> * </pre> * * Will become: * * <pre> * <code> * {@literal @}Retention(RetentionPolicy.SOURCE) * {@literal @}Target([ElementType.METHOD]) * {@literal @}GroovyASTTransformation("my.transformation.MyTransformation") * public @interface MyAnnotation { } * </code> * </pre> * * @since 0.1.0 * */ @GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class LocalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.1.0 */ @Override public void visit(final ASTNode[] nodes, final SourceUnit source) { this.sourceUnit = source; if (!check(nodes)) { return; }
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/internal/LocalTransformation.java import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last; import static asteroid.utils.InternalUtils.collect; import asteroid.A; import asteroid.Local; import groovy.lang.Closure; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.ListExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformationClass; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Arrays; import java.util.List; package asteroid.internal; /** * Reduces the boiler plate code when declaring an annotation as possible target for a given * transformation. * * It adds code such as the {@link java.lang.annotation.Retention} and {@link java.lang.annotation.Target} annotations as well as the * {@link org.codehaus.groovy.transform.GroovyASTTransformationClass}. * * This code: * * <pre> * <code> * import my.transformation.MyTransformation * * {@literal @}Local(MyTransformation) * public @interface MyAnnotation { } * </code> * </pre> * * Will become: * * <pre> * <code> * {@literal @}Retention(RetentionPolicy.SOURCE) * {@literal @}Target([ElementType.METHOD]) * {@literal @}GroovyASTTransformation("my.transformation.MyTransformation") * public @interface MyAnnotation { } * </code> * </pre> * * @since 0.1.0 * */ @GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class LocalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.1.0 */ @Override public void visit(final ASTNode[] nodes, final SourceUnit source) { this.sourceUnit = source; if (!check(nodes)) { return; }
final AnnotationNode annotationNode = A.UTIL.NODE.getFirstNodeAs(nodes, AnnotationNode.class);
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/LocalTransformation.java
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last; import static asteroid.utils.InternalUtils.collect; import asteroid.A; import asteroid.Local; import groovy.lang.Closure; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.ListExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformationClass; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Arrays; import java.util.List;
package asteroid.internal; /** * Reduces the boiler plate code when declaring an annotation as possible target for a given * transformation. * * It adds code such as the {@link java.lang.annotation.Retention} and {@link java.lang.annotation.Target} annotations as well as the * {@link org.codehaus.groovy.transform.GroovyASTTransformationClass}. * * This code: * * <pre> * <code> * import my.transformation.MyTransformation * * {@literal @}Local(MyTransformation) * public @interface MyAnnotation { } * </code> * </pre> * * Will become: * * <pre> * <code> * {@literal @}Retention(RetentionPolicy.SOURCE) * {@literal @}Target([ElementType.METHOD]) * {@literal @}GroovyASTTransformation("my.transformation.MyTransformation") * public @interface MyAnnotation { } * </code> * </pre> * * @since 0.1.0 * */ @GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class LocalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.1.0 */ @Override public void visit(final ASTNode[] nodes, final SourceUnit source) { this.sourceUnit = source; if (!check(nodes)) { return; } final AnnotationNode annotationNode = A.UTIL.NODE.getFirstNodeAs(nodes, AnnotationNode.class); final ClassNode annotatedNode = A.UTIL.NODE.getLastNodeAs(nodes, ClassNode.class); addAnnotationsFromTo(annotationNode, annotatedNode); } private void addAnnotationsFromTo(final AnnotationNode annotationNode, final ClassNode annotatedNode) { final String qualifiedName = A.UTIL.NODE.get(annotationNode, String.class); final String target = A.UTIL.NODE.get(annotationNode, "applyTo", String.class); annotatedNode.addAnnotation(getTargetAnnotation(target)); annotatedNode.addAnnotation(getRetentionAnnotation()); annotatedNode.addAnnotation(getGroovyAnnotationWith(qualifiedName)); } private AnnotationNode getTargetAnnotation(final String resolvedTarget) { final List<ElementType> types = resolveAnnotationTarget(resolvedTarget); final ListExpression listExpr = resolveTargetFromElementType(types); return A.NODES.annotation(Target.class) .member(A.UTIL.NODE.ANNOTATION_VALUE, listExpr) .build(); } private ListExpression resolveTargetFromElementType(final List<ElementType> types) { final List<PropertyExpression> expressions =
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/internal/LocalTransformation.java import static org.codehaus.groovy.runtime.DefaultGroovyMethods.first; import static org.codehaus.groovy.runtime.DefaultGroovyMethods.last; import static asteroid.utils.InternalUtils.collect; import asteroid.A; import asteroid.Local; import groovy.lang.Closure; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.AnnotatedNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.ListExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformationClass; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.util.Arrays; import java.util.List; package asteroid.internal; /** * Reduces the boiler plate code when declaring an annotation as possible target for a given * transformation. * * It adds code such as the {@link java.lang.annotation.Retention} and {@link java.lang.annotation.Target} annotations as well as the * {@link org.codehaus.groovy.transform.GroovyASTTransformationClass}. * * This code: * * <pre> * <code> * import my.transformation.MyTransformation * * {@literal @}Local(MyTransformation) * public @interface MyAnnotation { } * </code> * </pre> * * Will become: * * <pre> * <code> * {@literal @}Retention(RetentionPolicy.SOURCE) * {@literal @}Target([ElementType.METHOD]) * {@literal @}GroovyASTTransformation("my.transformation.MyTransformation") * public @interface MyAnnotation { } * </code> * </pre> * * @since 0.1.0 * */ @GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class LocalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.1.0 */ @Override public void visit(final ASTNode[] nodes, final SourceUnit source) { this.sourceUnit = source; if (!check(nodes)) { return; } final AnnotationNode annotationNode = A.UTIL.NODE.getFirstNodeAs(nodes, AnnotationNode.class); final ClassNode annotatedNode = A.UTIL.NODE.getLastNodeAs(nodes, ClassNode.class); addAnnotationsFromTo(annotationNode, annotatedNode); } private void addAnnotationsFromTo(final AnnotationNode annotationNode, final ClassNode annotatedNode) { final String qualifiedName = A.UTIL.NODE.get(annotationNode, String.class); final String target = A.UTIL.NODE.get(annotationNode, "applyTo", String.class); annotatedNode.addAnnotation(getTargetAnnotation(target)); annotatedNode.addAnnotation(getRetentionAnnotation()); annotatedNode.addAnnotation(getGroovyAnnotationWith(qualifiedName)); } private AnnotationNode getTargetAnnotation(final String resolvedTarget) { final List<ElementType> types = resolveAnnotationTarget(resolvedTarget); final ListExpression listExpr = resolveTargetFromElementType(types); return A.NODES.annotation(Target.class) .member(A.UTIL.NODE.ANNOTATION_VALUE, listExpr) .build(); } private ListExpression resolveTargetFromElementType(final List<ElementType> types) { final List<PropertyExpression> expressions =
collect(types, new Closure<PropertyExpression>(null) {
grooviter/asteroid
asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/Transformer.java // public interface Transformer { // // /** // * This function has to be implemented in order the transformation // * to traverse every {@link ClassNode} in the AST // * // * @param clazzNode The next {@link ClassNode} to traverse // * @since 0.2.0 // */ // void visitClass(ClassNode clazzNode); // }
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance; import static asteroid.utils.InternalUtils.collect; import java.util.List; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import asteroid.transformer.Transformer;
package asteroid; /** * This class applies all transformers provided by the method * getTransformers in order to all class nodes present in a given * source unit instance. * * This way you should think of an instance of {@link * AbstractGlobalTransformation} as a set of {@link Transformer} * instances. * <pre class="inner"><code> * class AddTransformation extends AbstractGlobalTransformation { * {@literal @}Override * List{@literal <}Class{@literal <}Transformer{@literal >}{@literal >} getTransformers() { * return [AddPropertyToInnerClass, AddTraitTransformer] * } * } * </code></pre> * * @since 0.2.0 * @see Transformer */ public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.2.0 */ @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) {
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/Transformer.java // public interface Transformer { // // /** // * This function has to be implemented in order the transformation // * to traverse every {@link ClassNode} in the AST // * // * @param clazzNode The next {@link ClassNode} to traverse // * @since 0.2.0 // */ // void visitClass(ClassNode clazzNode); // } // Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java import static org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance; import static asteroid.utils.InternalUtils.collect; import java.util.List; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import asteroid.transformer.Transformer; package asteroid; /** * This class applies all transformers provided by the method * getTransformers in order to all class nodes present in a given * source unit instance. * * This way you should think of an instance of {@link * AbstractGlobalTransformation} as a set of {@link Transformer} * instances. * <pre class="inner"><code> * class AddTransformation extends AbstractGlobalTransformation { * {@literal @}Override * List{@literal <}Class{@literal <}Transformer{@literal >}{@literal >} getTransformers() { * return [AddPropertyToInnerClass, AddTraitTransformer] * } * } * </code></pre> * * @since 0.2.0 * @see Transformer */ public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.2.0 */ @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) {
final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses());
grooviter/asteroid
asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/Transformer.java // public interface Transformer { // // /** // * This function has to be implemented in order the transformation // * to traverse every {@link ClassNode} in the AST // * // * @param clazzNode The next {@link ClassNode} to traverse // * @since 0.2.0 // */ // void visitClass(ClassNode clazzNode); // }
import static org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance; import static asteroid.utils.InternalUtils.collect; import java.util.List; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import asteroid.transformer.Transformer;
package asteroid; /** * This class applies all transformers provided by the method * getTransformers in order to all class nodes present in a given * source unit instance. * * This way you should think of an instance of {@link * AbstractGlobalTransformation} as a set of {@link Transformer} * instances. * <pre class="inner"><code> * class AddTransformation extends AbstractGlobalTransformation { * {@literal @}Override * List{@literal <}Class{@literal <}Transformer{@literal >}{@literal >} getTransformers() { * return [AddPropertyToInnerClass, AddTraitTransformer] * } * } * </code></pre> * * @since 0.2.0 * @see Transformer */ public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.2.0 */ @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); for (final ClassNode clazzNode : classNodeList) {
// Path: asteroid-core/src/main/java/asteroid/utils/InternalUtils.java // public static <T> List<T> collect(final Object iterable, final Closure<T> process) { // if (iterable == null) { // return new ArrayList<>(); // } // // return DefaultGroovyMethods.collect(iterable, process); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/Transformer.java // public interface Transformer { // // /** // * This function has to be implemented in order the transformation // * to traverse every {@link ClassNode} in the AST // * // * @param clazzNode The next {@link ClassNode} to traverse // * @since 0.2.0 // */ // void visitClass(ClassNode clazzNode); // } // Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java import static org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance; import static asteroid.utils.InternalUtils.collect; import java.util.List; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.transform.AbstractASTTransformation; import asteroid.transformer.Transformer; package asteroid; /** * This class applies all transformers provided by the method * getTransformers in order to all class nodes present in a given * source unit instance. * * This way you should think of an instance of {@link * AbstractGlobalTransformation} as a set of {@link Transformer} * instances. * <pre class="inner"><code> * class AddTransformation extends AbstractGlobalTransformation { * {@literal @}Override * List{@literal <}Class{@literal <}Transformer{@literal >}{@literal >} getTransformers() { * return [AddPropertyToInnerClass, AddTraitTransformer] * } * } * </code></pre> * * @since 0.2.0 * @see Transformer */ public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { /** * {@inheritDoc} * * @since 0.2.0 */ @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); for (final ClassNode clazzNode : classNodeList) {
for (final Class<? extends Transformer> clazz : getTransformers()) {
grooviter/asteroid
asteroid-core/src/main/java/asteroid/nodes/MethodNodeBuilder.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import asteroid.A; import org.codehaus.groovy.syntax.Types; import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.stmt.Statement;
package asteroid.nodes; /** * Builder to create instance of type {@link MethodNode} * * @since 0.1.0 */ @SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName") final public class MethodNodeBuilder { private final String name; private int modifiers; private Statement code; private ClassNode returnType; private Parameter[] parameters = new Parameter[0]; private ClassNode[] exceptions = new ClassNode[0]; private MethodNodeBuilder(final String name) { this.name = name; } /** * Sets the method name and creates an instance of {@link * MethodNodeBuilder} * * @param name the name of the method * @return the current builder instance * @since 0.1.0 */ public static MethodNodeBuilder method(final String name) { return new MethodNodeBuilder(name); } /** * Sets the return type of the method * * @param returnType a {@link Class} representing the return type * of the method * @return the current builder instance * @since 0.1.0 */ public MethodNodeBuilder returnType(final Class returnType) {
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/nodes/MethodNodeBuilder.java import asteroid.A; import org.codehaus.groovy.syntax.Types; import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.stmt.Statement; package asteroid.nodes; /** * Builder to create instance of type {@link MethodNode} * * @since 0.1.0 */ @SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName") final public class MethodNodeBuilder { private final String name; private int modifiers; private Statement code; private ClassNode returnType; private Parameter[] parameters = new Parameter[0]; private ClassNode[] exceptions = new ClassNode[0]; private MethodNodeBuilder(final String name) { this.name = name; } /** * Sets the method name and creates an instance of {@link * MethodNodeBuilder} * * @param name the name of the method * @return the current builder instance * @since 0.1.0 */ public static MethodNodeBuilder method(final String name) { return new MethodNodeBuilder(name); } /** * Sets the return type of the method * * @param returnType a {@link Class} representing the return type * of the method * @return the current builder instance * @since 0.1.0 */ public MethodNodeBuilder returnType(final Class returnType) {
this.returnType = A.NODES.clazz(returnType).build();
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/TranslateToGlobalTransform.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java // public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { // // /** // * {@inheritDoc} // * // * @since 0.2.0 // */ // @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) // public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { // final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); // // for (final ClassNode clazzNode : classNodeList) { // for (final Class<? extends Transformer> clazz : getTransformers()) { // newInstance(clazz, new Object[] { sourceUnit }) // .visitClass(clazzNode); // } // } // } // // /** // * This method should return a list of visitor classes {@link // * Class} instances applied globally by this AST. // * // * @return all transformers that will be applied globally by this // * AST transformation // * @since 0.2.0 // * @see Transformer // */ // public abstract List<Class<? extends Transformer>> getTransformers(); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractClassNodeTransformer.java // public abstract class AbstractClassNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find classes eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * ClassNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link ClassNode} will be discarded. // * // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified class) // * @since 0.2.0 // * @see asteroid.Criterias#byClassNodeNameContains(String) // */ // public AbstractClassNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitClass(final ClassNode classNode) { // if (classNode == null || !this.criteria.call(classNode)) { // return; // } // // transformClass(classNode); // } // // /** // * Within this method developer could modify the {@link ClassNode} // * instance. // * // * @param classNode the {@link ClassNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformClass(final ClassNode classNode); // // }
import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.ast.AnnotationNode; import asteroid.A; import asteroid.Phase; import asteroid.AbstractGlobalTransformation; import asteroid.transformer.AbstractClassNodeTransformer;
package asteroid.internal; /** * This {@link AbstractClassNodeTransformer} will be applied to all {@link * ClassNode} instances annotated with {@link Phase}. * <br><br> * It will add certain low level annotations to trigger the process of * the annotated transformation. These annotations are the java * retention and target annotations, and the Groovy transform * annotation. * * @since 0.1.6 */ public class TranslateToGlobalTransform extends AbstractClassNodeTransformer { private static final String BLANK = ""; private static final String TX_NAME = "Phase"; private static final String PHASE_PFIX = "Phase.GLOBAL."; private static final String PHASE_PFIX_SHORT = "GLOBAL."; private static final String PHASE_GROOVY = "CompilePhase."; private static final String PHASE_WRONG = "GlobalAnnotation compilation phase is wrong!!"; private static final String PHASE_MISSING = "GlobalAnnotation compilation phase is missing!!"; /** * Constructor receiving the {@link SourceUnit} * * @param sourceUnit * @since 0.1.6 */ public TranslateToGlobalTransform(final SourceUnit sourceUnit) {
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java // public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { // // /** // * {@inheritDoc} // * // * @since 0.2.0 // */ // @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) // public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { // final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); // // for (final ClassNode clazzNode : classNodeList) { // for (final Class<? extends Transformer> clazz : getTransformers()) { // newInstance(clazz, new Object[] { sourceUnit }) // .visitClass(clazzNode); // } // } // } // // /** // * This method should return a list of visitor classes {@link // * Class} instances applied globally by this AST. // * // * @return all transformers that will be applied globally by this // * AST transformation // * @since 0.2.0 // * @see Transformer // */ // public abstract List<Class<? extends Transformer>> getTransformers(); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractClassNodeTransformer.java // public abstract class AbstractClassNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find classes eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * ClassNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link ClassNode} will be discarded. // * // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified class) // * @since 0.2.0 // * @see asteroid.Criterias#byClassNodeNameContains(String) // */ // public AbstractClassNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitClass(final ClassNode classNode) { // if (classNode == null || !this.criteria.call(classNode)) { // return; // } // // transformClass(classNode); // } // // /** // * Within this method developer could modify the {@link ClassNode} // * instance. // * // * @param classNode the {@link ClassNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformClass(final ClassNode classNode); // // } // Path: asteroid-core/src/main/java/asteroid/internal/TranslateToGlobalTransform.java import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.ast.AnnotationNode; import asteroid.A; import asteroid.Phase; import asteroid.AbstractGlobalTransformation; import asteroid.transformer.AbstractClassNodeTransformer; package asteroid.internal; /** * This {@link AbstractClassNodeTransformer} will be applied to all {@link * ClassNode} instances annotated with {@link Phase}. * <br><br> * It will add certain low level annotations to trigger the process of * the annotated transformation. These annotations are the java * retention and target annotations, and the Groovy transform * annotation. * * @since 0.1.6 */ public class TranslateToGlobalTransform extends AbstractClassNodeTransformer { private static final String BLANK = ""; private static final String TX_NAME = "Phase"; private static final String PHASE_PFIX = "Phase.GLOBAL."; private static final String PHASE_PFIX_SHORT = "GLOBAL."; private static final String PHASE_GROOVY = "CompilePhase."; private static final String PHASE_WRONG = "GlobalAnnotation compilation phase is wrong!!"; private static final String PHASE_MISSING = "GlobalAnnotation compilation phase is missing!!"; /** * Constructor receiving the {@link SourceUnit} * * @param sourceUnit * @since 0.1.6 */ public TranslateToGlobalTransform(final SourceUnit sourceUnit) {
super(sourceUnit, A.CRITERIA.byAnnotationSimpleName(TX_NAME));
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/TranslateToGlobalTransform.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java // public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { // // /** // * {@inheritDoc} // * // * @since 0.2.0 // */ // @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) // public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { // final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); // // for (final ClassNode clazzNode : classNodeList) { // for (final Class<? extends Transformer> clazz : getTransformers()) { // newInstance(clazz, new Object[] { sourceUnit }) // .visitClass(clazzNode); // } // } // } // // /** // * This method should return a list of visitor classes {@link // * Class} instances applied globally by this AST. // * // * @return all transformers that will be applied globally by this // * AST transformation // * @since 0.2.0 // * @see Transformer // */ // public abstract List<Class<? extends Transformer>> getTransformers(); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractClassNodeTransformer.java // public abstract class AbstractClassNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find classes eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * ClassNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link ClassNode} will be discarded. // * // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified class) // * @since 0.2.0 // * @see asteroid.Criterias#byClassNodeNameContains(String) // */ // public AbstractClassNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitClass(final ClassNode classNode) { // if (classNode == null || !this.criteria.call(classNode)) { // return; // } // // transformClass(classNode); // } // // /** // * Within this method developer could modify the {@link ClassNode} // * instance. // * // * @param classNode the {@link ClassNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformClass(final ClassNode classNode); // // }
import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.ast.AnnotationNode; import asteroid.A; import asteroid.Phase; import asteroid.AbstractGlobalTransformation; import asteroid.transformer.AbstractClassNodeTransformer;
package asteroid.internal; /** * This {@link AbstractClassNodeTransformer} will be applied to all {@link * ClassNode} instances annotated with {@link Phase}. * <br><br> * It will add certain low level annotations to trigger the process of * the annotated transformation. These annotations are the java * retention and target annotations, and the Groovy transform * annotation. * * @since 0.1.6 */ public class TranslateToGlobalTransform extends AbstractClassNodeTransformer { private static final String BLANK = ""; private static final String TX_NAME = "Phase"; private static final String PHASE_PFIX = "Phase.GLOBAL."; private static final String PHASE_PFIX_SHORT = "GLOBAL."; private static final String PHASE_GROOVY = "CompilePhase."; private static final String PHASE_WRONG = "GlobalAnnotation compilation phase is wrong!!"; private static final String PHASE_MISSING = "GlobalAnnotation compilation phase is missing!!"; /** * Constructor receiving the {@link SourceUnit} * * @param sourceUnit * @since 0.1.6 */ public TranslateToGlobalTransform(final SourceUnit sourceUnit) { super(sourceUnit, A.CRITERIA.byAnnotationSimpleName(TX_NAME)); } /** * {@inheritDoc} */ @Override public void transformClass(final ClassNode annotated) { final ClassNode superClass = annotated.getSuperClass(); if (superClass == null) { return; }
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // // Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java // public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { // // /** // * {@inheritDoc} // * // * @since 0.2.0 // */ // @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) // public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { // final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); // // for (final ClassNode clazzNode : classNodeList) { // for (final Class<? extends Transformer> clazz : getTransformers()) { // newInstance(clazz, new Object[] { sourceUnit }) // .visitClass(clazzNode); // } // } // } // // /** // * This method should return a list of visitor classes {@link // * Class} instances applied globally by this AST. // * // * @return all transformers that will be applied globally by this // * AST transformation // * @since 0.2.0 // * @see Transformer // */ // public abstract List<Class<? extends Transformer>> getTransformers(); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/AbstractClassNodeTransformer.java // public abstract class AbstractClassNodeTransformer extends AbstractTransformer { // // private final Closure<Boolean> criteria; // // /** // * Every instance needs the source unit and the name of the class // * it's going to transform. // * // * To find classes eligible to be transformed by this {@link Transformer} // * a {@link Closure} returning a boolean is used as a criteria. // * // * You can create your own criteria or use one of the static // * methods present in this class. These methods will create a // * pre-defined criteria. // * // * The {@link Closure} used as a criteria will receive a {@link // * ClassNode} and return a {@link Boolean} value. If the closure // * returns true then the transformation will be apply, if not the // * {@link ClassNode} will be discarded. // * // * @param sourceUnit Needed to apply scope // * @param criteria used to locate target classes // * look for the qualified class) // * @since 0.2.0 // * @see asteroid.Criterias#byClassNodeNameContains(String) // */ // public AbstractClassNodeTransformer(final SourceUnit sourceUnit, final Closure<Boolean> criteria) { // super(sourceUnit); // this.criteria = criteria; // } // // /** // * {@inheritDoc} // */ // @Override // public void visitClass(final ClassNode classNode) { // if (classNode == null || !this.criteria.call(classNode)) { // return; // } // // transformClass(classNode); // } // // /** // * Within this method developer could modify the {@link ClassNode} // * instance. // * // * @param classNode the {@link ClassNode} you want to transform // * @since 0.2.0 // */ // public abstract void transformClass(final ClassNode classNode); // // } // Path: asteroid-core/src/main/java/asteroid/internal/TranslateToGlobalTransform.java import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.ast.AnnotationNode; import asteroid.A; import asteroid.Phase; import asteroid.AbstractGlobalTransformation; import asteroid.transformer.AbstractClassNodeTransformer; package asteroid.internal; /** * This {@link AbstractClassNodeTransformer} will be applied to all {@link * ClassNode} instances annotated with {@link Phase}. * <br><br> * It will add certain low level annotations to trigger the process of * the annotated transformation. These annotations are the java * retention and target annotations, and the Groovy transform * annotation. * * @since 0.1.6 */ public class TranslateToGlobalTransform extends AbstractClassNodeTransformer { private static final String BLANK = ""; private static final String TX_NAME = "Phase"; private static final String PHASE_PFIX = "Phase.GLOBAL."; private static final String PHASE_PFIX_SHORT = "GLOBAL."; private static final String PHASE_GROOVY = "CompilePhase."; private static final String PHASE_WRONG = "GlobalAnnotation compilation phase is wrong!!"; private static final String PHASE_MISSING = "GlobalAnnotation compilation phase is missing!!"; /** * Constructor receiving the {@link SourceUnit} * * @param sourceUnit * @since 0.1.6 */ public TranslateToGlobalTransform(final SourceUnit sourceUnit) { super(sourceUnit, A.CRITERIA.byAnnotationSimpleName(TX_NAME)); } /** * {@inheritDoc} */ @Override public void transformClass(final ClassNode annotated) { final ClassNode superClass = annotated.getSuperClass(); if (superClass == null) { return; }
final ClassNode reference = A.NODES.clazz(AbstractGlobalTransformation.class).build();
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/TransformationUtils.java
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // }
import asteroid.A; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.transform.GroovyASTTransformation; import groovy.transform.InheritConstructors;
package asteroid.internal; /** * A set of utilities to implement base transformation classes * * @since 0.2.0 */ public final class TransformationUtils { private TransformationUtils() { } /** * All transformation will be always annotated with: * * <ul> * <li>{@link InheritConstructors}</li> * <li>{@link GroovyASTTransformation}</li> * </ul> * * To avoid repeating this over and over again this method adds * both to the annotated {@link ClassNode} passed as first * argument * * @param annotated The {@link ClassNode} we want to add both * annotations to * @param compilePhase The {@link CompilePhase} used as argument for * the {@link GroovyASTTransformation} annotation. * @since 0.2.0 */ public static void addASTAnnotationsFromTo(final ClassNode annotated, final CompilePhase compilePhase) { final AnnotationNode groovyAnn = getGroovyAnnotation(compilePhase); final AnnotationNode inheritConsAnn = getInheritConstructorsAnnotation(); annotated.addAnnotation(inheritConsAnn); annotated.addAnnotation(groovyAnn); } /** * Creates an {@link AnnotationNode} of type {@link GroovyASTTransformation}. * * @param compilePhase the target {@link CompilePhase} used as value of the * {@link GroovyASTTransformation} annotation * @return an instance of {@link GroovyASTTransformation} annotation * @since 0.2.0 */ public static AnnotationNode getGroovyAnnotation(final CompilePhase compilePhase) { final PropertyExpression valueExpr = getCompilePhaseAsPropertyExpression(compilePhase);
// Path: asteroid-core/src/main/java/asteroid/A.java // @SuppressWarnings("PMD.ShortClassName") // public final class A { // // /** // * Entry point to get node builders. // * // * @since 0.1.0 // */ // public static final Nodes NODES = new Nodes(); // // /** // * Entry point to access language modifiers // * // * @since 0.1.0 // */ // public static final Modifiers ACC = new Modifiers(); // // /** // * Entry point to create statements. // * // * @since 0.1.0 // */ // public static final Statements STMT = new Statements(); // // /** // * Entry point to create expressions // * // * @since 0.1.0 // */ // public static final Expressions EXPR = new Expressions(); // // /** // * Entry point to get util functions // * // * @since 0.1.0 // */ // public static final Utils UTIL = new Utils(); // // /** // * Entry point to get criterias // * // * @since 0.2.4 // */ // public static final Criterias CRITERIA = new Criterias(); // } // Path: asteroid-core/src/main/java/asteroid/internal/TransformationUtils.java import asteroid.A; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.transform.GroovyASTTransformation; import groovy.transform.InheritConstructors; package asteroid.internal; /** * A set of utilities to implement base transformation classes * * @since 0.2.0 */ public final class TransformationUtils { private TransformationUtils() { } /** * All transformation will be always annotated with: * * <ul> * <li>{@link InheritConstructors}</li> * <li>{@link GroovyASTTransformation}</li> * </ul> * * To avoid repeating this over and over again this method adds * both to the annotated {@link ClassNode} passed as first * argument * * @param annotated The {@link ClassNode} we want to add both * annotations to * @param compilePhase The {@link CompilePhase} used as argument for * the {@link GroovyASTTransformation} annotation. * @since 0.2.0 */ public static void addASTAnnotationsFromTo(final ClassNode annotated, final CompilePhase compilePhase) { final AnnotationNode groovyAnn = getGroovyAnnotation(compilePhase); final AnnotationNode inheritConsAnn = getInheritConstructorsAnnotation(); annotated.addAnnotation(inheritConsAnn); annotated.addAnnotation(groovyAnn); } /** * Creates an {@link AnnotationNode} of type {@link GroovyASTTransformation}. * * @param compilePhase the target {@link CompilePhase} used as value of the * {@link GroovyASTTransformation} annotation * @return an instance of {@link GroovyASTTransformation} annotation * @since 0.2.0 */ public static AnnotationNode getGroovyAnnotation(final CompilePhase compilePhase) { final PropertyExpression valueExpr = getCompilePhaseAsPropertyExpression(compilePhase);
return A.NODES.annotation(GroovyASTTransformation.class)
grooviter/asteroid
asteroid-core/src/main/java/asteroid/internal/GlobalTransformationTransformation.java
// Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java // public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { // // /** // * {@inheritDoc} // * // * @since 0.2.0 // */ // @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) // public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { // final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); // // for (final ClassNode clazzNode : classNodeList) { // for (final Class<? extends Transformer> clazz : getTransformers()) { // newInstance(clazz, new Object[] { sourceUnit }) // .visitClass(clazzNode); // } // } // } // // /** // * This method should return a list of visitor classes {@link // * Class} instances applied globally by this AST. // * // * @return all transformers that will be applied globally by this // * AST transformation // * @since 0.2.0 // * @see Transformer // */ // public abstract List<Class<? extends Transformer>> getTransformers(); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/Transformer.java // public interface Transformer { // // /** // * This function has to be implemented in order the transformation // * to traverse every {@link ClassNode} in the AST // * // * @param clazzNode The next {@link ClassNode} to traverse // * @since 0.2.0 // */ // void visitClass(ClassNode clazzNode); // }
import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.transform.GroovyASTTransformation; import java.util.List; import java.util.ArrayList; import asteroid.AbstractGlobalTransformation; import asteroid.transformer.Transformer;
package asteroid.internal; /** * This transformation makes easier to declare a given global transformation. * * @since 0.1.2 */ @GroovyASTTransformation(phase = CompilePhase.CONVERSION) public class GlobalTransformationTransformation extends AbstractGlobalTransformation { @Override
// Path: asteroid-core/src/main/java/asteroid/AbstractGlobalTransformation.java // public abstract class AbstractGlobalTransformation extends AbstractASTTransformation { // // /** // * {@inheritDoc} // * // * @since 0.2.0 // */ // @SuppressWarnings({"PMD.UnusedMethodParameter", "PMD.AvoidInstantiatingObjectsInLoops"}) // public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit) { // final List<ClassNode> classNodeList = (List<ClassNode>) collect(sourceUnit.getAST().getClasses()); // // for (final ClassNode clazzNode : classNodeList) { // for (final Class<? extends Transformer> clazz : getTransformers()) { // newInstance(clazz, new Object[] { sourceUnit }) // .visitClass(clazzNode); // } // } // } // // /** // * This method should return a list of visitor classes {@link // * Class} instances applied globally by this AST. // * // * @return all transformers that will be applied globally by this // * AST transformation // * @since 0.2.0 // * @see Transformer // */ // public abstract List<Class<? extends Transformer>> getTransformers(); // } // // Path: asteroid-core/src/main/java/asteroid/transformer/Transformer.java // public interface Transformer { // // /** // * This function has to be implemented in order the transformation // * to traverse every {@link ClassNode} in the AST // * // * @param clazzNode The next {@link ClassNode} to traverse // * @since 0.2.0 // */ // void visitClass(ClassNode clazzNode); // } // Path: asteroid-core/src/main/java/asteroid/internal/GlobalTransformationTransformation.java import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.transform.GroovyASTTransformation; import java.util.List; import java.util.ArrayList; import asteroid.AbstractGlobalTransformation; import asteroid.transformer.Transformer; package asteroid.internal; /** * This transformation makes easier to declare a given global transformation. * * @since 0.1.2 */ @GroovyASTTransformation(phase = CompilePhase.CONVERSION) public class GlobalTransformationTransformation extends AbstractGlobalTransformation { @Override
public List<Class<? extends Transformer>> getTransformers() {
danirod/rectball
app/src/main/java/es/danirod/rectball/scene2d/game/BoardActor.java
// Path: app/src/main/java/es/danirod/rectball/scene2d/listeners/BallSelectionListener.java // public interface BallSelectionListener { // // /** // * This event is triggered when a ball has been selected on a board. // * // * @param ball ball that has been selected. // */ // void onBallSelected(BallActor ball); // // /** // * This event is triggered when a ball has been unselected from a board. // * // * @param ball ball that has been unselected. // */ // void onBallUnselected(BallActor ball); // // /** // * This event is triggered when a selection is made and the selection has // * already be checked to be valid. All the selected balls form a rectangle // * whose four corners are made of the same color. // * // * @param selection balls that form this selection. // */ // void onSelectionSucceeded(List<BallActor> selection); // // /** // * This event is triggered when a selection is made and the selection is // * checked not to be valid. Any of the conditions required to be a valid // * selection is not happening. // * // * @param selection balls that don't form this selection. // */ // void onSelectionFailed(List<BallActor> selection); // // /** // * This event is triggered when the board is forced to unselect every ball. // * This happens, for instance, when the game is over, so that no selected // * balls remain on the screen while the animations start. // * // * @param selection the list of balls that has been unselected. // */ // void onSelectionCleared(List<BallActor> selection); // }
import java.util.*; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.Action; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.utils.Align; import es.danirod.rectball.model.*; import es.danirod.rectball.scene2d.input.DragBoardSelectionListener; import es.danirod.rectball.scene2d.listeners.BallSelectionListener;
/* * This file is part of Rectball * Copyright (C) 2015 Dani Rodríguez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package es.danirod.rectball.scene2d.game; public class BoardActor extends Table { private final BallActor[][] actors; private final Set<BallActor> selection = new HashSet<>();
// Path: app/src/main/java/es/danirod/rectball/scene2d/listeners/BallSelectionListener.java // public interface BallSelectionListener { // // /** // * This event is triggered when a ball has been selected on a board. // * // * @param ball ball that has been selected. // */ // void onBallSelected(BallActor ball); // // /** // * This event is triggered when a ball has been unselected from a board. // * // * @param ball ball that has been unselected. // */ // void onBallUnselected(BallActor ball); // // /** // * This event is triggered when a selection is made and the selection has // * already be checked to be valid. All the selected balls form a rectangle // * whose four corners are made of the same color. // * // * @param selection balls that form this selection. // */ // void onSelectionSucceeded(List<BallActor> selection); // // /** // * This event is triggered when a selection is made and the selection is // * checked not to be valid. Any of the conditions required to be a valid // * selection is not happening. // * // * @param selection balls that don't form this selection. // */ // void onSelectionFailed(List<BallActor> selection); // // /** // * This event is triggered when the board is forced to unselect every ball. // * This happens, for instance, when the game is over, so that no selected // * balls remain on the screen while the animations start. // * // * @param selection the list of balls that has been unselected. // */ // void onSelectionCleared(List<BallActor> selection); // } // Path: app/src/main/java/es/danirod/rectball/scene2d/game/BoardActor.java import java.util.*; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.Action; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.utils.Align; import es.danirod.rectball.model.*; import es.danirod.rectball.scene2d.input.DragBoardSelectionListener; import es.danirod.rectball.scene2d.listeners.BallSelectionListener; /* * This file is part of Rectball * Copyright (C) 2015 Dani Rodríguez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package es.danirod.rectball.scene2d.game; public class BoardActor extends Table { private final BallActor[][] actors; private final Set<BallActor> selection = new HashSet<>();
private final List<BallSelectionListener> subscribers = new ArrayList<>();
danirod/rectball
app/src/main/java/es/danirod/rectball/model/GameState.java
// Path: app/src/main/java/es/danirod/rectball/Constants.java // public class Constants { // // /** // * The width of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screen.s // */ // public static final int VIEWPORT_WIDTH = 480; // // /** // * The height of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screens. // */ // public static final int VIEWPORT_HEIGHT = 768; // // /** // * The padding for the table in every stage. // */ // public static final int STAGE_PADDING = 20; // // public static final int SECONDS = 30; // }
import es.danirod.rectball.Constants; import android.os.Bundle; import com.badlogic.gdx.math.Rectangle;
* this variable will flag whether to subtract or not. It will be reset * every time a new combination is made. */ private boolean cheatSeen; public boolean isPlaying() { return playing; } public void setPlaying(boolean playing) { this.playing = playing; } private boolean playing; public boolean isTimeout() { return timeout; } public void setTimeout(boolean timeout) { this.timeout = timeout; } private boolean timeout; private Rectangle boardBounds = new Rectangle(); public GameState() { this.score = 0; this.elapsedTime = 0;
// Path: app/src/main/java/es/danirod/rectball/Constants.java // public class Constants { // // /** // * The width of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screen.s // */ // public static final int VIEWPORT_WIDTH = 480; // // /** // * The height of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screens. // */ // public static final int VIEWPORT_HEIGHT = 768; // // /** // * The padding for the table in every stage. // */ // public static final int STAGE_PADDING = 20; // // public static final int SECONDS = 30; // } // Path: app/src/main/java/es/danirod/rectball/model/GameState.java import es.danirod.rectball.Constants; import android.os.Bundle; import com.badlogic.gdx.math.Rectangle; * this variable will flag whether to subtract or not. It will be reset * every time a new combination is made. */ private boolean cheatSeen; public boolean isPlaying() { return playing; } public void setPlaying(boolean playing) { this.playing = playing; } private boolean playing; public boolean isTimeout() { return timeout; } public void setTimeout(boolean timeout) { this.timeout = timeout; } private boolean timeout; private Rectangle boardBounds = new Rectangle(); public GameState() { this.score = 0; this.elapsedTime = 0;
this.remainingTime = Constants.SECONDS;
danirod/rectball
app/src/main/java/es/danirod/rectball/scene2d/ui/CommonDialog.java
// Path: app/src/main/java/es/danirod/rectball/Constants.java // public class Constants { // // /** // * The width of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screen.s // */ // public static final int VIEWPORT_WIDTH = 480; // // /** // * The height of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screens. // */ // public static final int VIEWPORT_HEIGHT = 768; // // /** // * The padding for the table in every stage. // */ // public static final int STAGE_PADDING = 20; // // public static final int SECONDS = 30; // }
import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.utils.Align; import es.danirod.rectball.Constants;
/* * This file is part of Rectball * Copyright (C) 2015 Dani Rodríguez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package es.danirod.rectball.scene2d.ui; /** * Common dialog for Rectball. This common dialog is a tweak over Scene2D's * dialog to allow things such as full width dialogs or full width buttons. * * @since 0.3.0 */ class CommonDialog extends Dialog { CommonDialog(Skin skin, String text) { super("", skin); // Put the table on center and don't let it move. setMovable(false); setResizable(false); pad(20); // Make the table use the full width. getCell(getContentTable()).fillX().expandX(); getCell(getButtonTable()).fillX().expandX().padTop(20); // Make the child items use the max width. getContentTable().defaults().expandX().fillX(); getButtonTable().defaults().expandX().fillX(); // Add text to the center. Label textLabel = new Label(text, skin); textLabel.setWrap(true); textLabel.setAlignment(Align.center);
// Path: app/src/main/java/es/danirod/rectball/Constants.java // public class Constants { // // /** // * The width of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screen.s // */ // public static final int VIEWPORT_WIDTH = 480; // // /** // * The height of the Scene2D stage. The bigger this value is, the greater // * the space is going to be for child elements of this screen. However, // * the smallest everything is going to be seen, specially in small screens. // */ // public static final int VIEWPORT_HEIGHT = 768; // // /** // * The padding for the table in every stage. // */ // public static final int STAGE_PADDING = 20; // // public static final int SECONDS = 30; // } // Path: app/src/main/java/es/danirod/rectball/scene2d/ui/CommonDialog.java import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.utils.Align; import es.danirod.rectball.Constants; /* * This file is part of Rectball * Copyright (C) 2015 Dani Rodríguez * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package es.danirod.rectball.scene2d.ui; /** * Common dialog for Rectball. This common dialog is a tweak over Scene2D's * dialog to allow things such as full width dialogs or full width buttons. * * @since 0.3.0 */ class CommonDialog extends Dialog { CommonDialog(Skin skin, String text) { super("", skin); // Put the table on center and don't let it move. setMovable(false); setResizable(false); pad(20); // Make the table use the full width. getCell(getContentTable()).fillX().expandX(); getCell(getButtonTable()).fillX().expandX().padTop(20); // Make the child items use the max width. getContentTable().defaults().expandX().fillX(); getButtonTable().defaults().expandX().fillX(); // Add text to the center. Label textLabel = new Label(text, skin); textLabel.setWrap(true); textLabel.setAlignment(Align.center);
getContentTable().add(textLabel).width(Constants.VIEWPORT_WIDTH - 80);
baswerc/routes
src/main/java/org/baswell/routes/ContentConversionType.java
// Path: src/main/java/org/baswell/routes/MIMETypes.java // public class MIMETypes // { // /** // * application/atomcat+xml // */ // static public final String ATOM = "application/atomcat+xml"; // // /** // * text/csv // */ // static public final String CSV = "text/csv"; // // /** // * application/vnd.ms-excel // */ // static public final String EXCEL = "application/vnd.ms-excel"; // // /** // * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet // */ // static public final String EXCEL2 = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; // // /** // * application/msexcel // */ // static public final String EXCEL3 = "application/msexcel"; // // /** // * application/xls // */ // static public final String EXCEL4 = "application/xls"; // // /** // * application/x-xls // */ // static public final String EXCEL5 = "application/x-xls"; // // /** // * application/x-ms-excel // */ // static public final String EXCEL6 = "application/x-ms-excel"; // // /** // * application/x-excel // */ // static public final String EXCEL7 = "application/x-excel"; // // /** // * text/html // */ // static public final String HTML = "text/html"; // // /** // * application/xhtml+xml // */ // static public final String HTML2 = "application/xhtml+xml"; // // /** // * text/calendar // */ // static public final String ICS = "text/calendar"; // // /** // * application/javascript // */ // static public final String JAVASCRIPT = "application/javascript"; // // /** // * application/x-javascript // */ // static public final String JAVASCRIPT2 = "application/x-javascript"; // // /** // * text/javascript // */ // static public final String JAVASCRIPT3 = "text/javascript"; // // /** // * application/json // */ // static public final String JSON = "application/json"; // // /** // * text/x-json // */ // static public final String JSON2 = "text/x-json"; // // /** // * application/pdf // */ // static public final String PDF = "application/pdf"; // // /** // * application/rss+xml // */ // static public final String RSS = "application/rss+xml"; // // /** // * text/plain // */ // static public final String TEXT = "text/plain"; // // /** // * application/msword // */ // static public final String WORD = "application/msword"; // // /** // * application/vnd.openxmlformats-officedocument.wordprocessingml.document // */ // static public final String WORD2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; // // /** // * application/xml // */ // static public final String XML = "application/xml"; // // /** // * text/xml // */ // static public final String XML2 = "text/xml"; // } // // Path: src/main/java/org/baswell/routes/RoutesMethods.java // static boolean classImplementsInterface(Class clazz, Class interfaze) // { // if ((clazz == null) || (clazz == Object.class)) // { // return false; // } // // Class[] implementedInterfaces = clazz.getInterfaces(); // for (Class implementedInterface : implementedInterfaces) // { // if (classInstanceOf(implementedInterface, interfaze)) // { // return true; // } // } // // return classImplementsInterface(clazz.getSuperclass(), interfaze); // }
import javax.xml.bind.annotation.XmlRootElement; import static org.baswell.routes.MIMETypes.*; import static org.baswell.routes.RoutesMethods.classImplementsInterface;
String returnTypePackage = conversionType.getPackage().getName(); if (returnTypePackage.equals("org.json.simple")) { return ContentConversionType.JSON_SIMPLE; } else if (returnTypePackage.startsWith("org.w3c.dom")) { return ContentConversionType.W3C_NODE; } else if (returnClassName.equals("org.jdom2.Document")) { return ContentConversionType.JDOM2_DOCUMENT; } else if (returnClassName.equals("org.jdom2.Element")) { return ContentConversionType.JDOM2_ELEMENT; } else if (conversionType.getAnnotation(XmlRootElement.class) != null) { return ContentConversionType.JAXB; } else if ((((mediaType != null) && (mediaType == MediaType.JSON))) && availableLibraries.jacksonAvailable()) { return ContentConversionType.JACKSON; } else if ((((mediaType != null) && (mediaType == MediaType.JSON))) && availableLibraries.gsonAvailable()) { return ContentConversionType.GSON; }
// Path: src/main/java/org/baswell/routes/MIMETypes.java // public class MIMETypes // { // /** // * application/atomcat+xml // */ // static public final String ATOM = "application/atomcat+xml"; // // /** // * text/csv // */ // static public final String CSV = "text/csv"; // // /** // * application/vnd.ms-excel // */ // static public final String EXCEL = "application/vnd.ms-excel"; // // /** // * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet // */ // static public final String EXCEL2 = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; // // /** // * application/msexcel // */ // static public final String EXCEL3 = "application/msexcel"; // // /** // * application/xls // */ // static public final String EXCEL4 = "application/xls"; // // /** // * application/x-xls // */ // static public final String EXCEL5 = "application/x-xls"; // // /** // * application/x-ms-excel // */ // static public final String EXCEL6 = "application/x-ms-excel"; // // /** // * application/x-excel // */ // static public final String EXCEL7 = "application/x-excel"; // // /** // * text/html // */ // static public final String HTML = "text/html"; // // /** // * application/xhtml+xml // */ // static public final String HTML2 = "application/xhtml+xml"; // // /** // * text/calendar // */ // static public final String ICS = "text/calendar"; // // /** // * application/javascript // */ // static public final String JAVASCRIPT = "application/javascript"; // // /** // * application/x-javascript // */ // static public final String JAVASCRIPT2 = "application/x-javascript"; // // /** // * text/javascript // */ // static public final String JAVASCRIPT3 = "text/javascript"; // // /** // * application/json // */ // static public final String JSON = "application/json"; // // /** // * text/x-json // */ // static public final String JSON2 = "text/x-json"; // // /** // * application/pdf // */ // static public final String PDF = "application/pdf"; // // /** // * application/rss+xml // */ // static public final String RSS = "application/rss+xml"; // // /** // * text/plain // */ // static public final String TEXT = "text/plain"; // // /** // * application/msword // */ // static public final String WORD = "application/msword"; // // /** // * application/vnd.openxmlformats-officedocument.wordprocessingml.document // */ // static public final String WORD2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; // // /** // * application/xml // */ // static public final String XML = "application/xml"; // // /** // * text/xml // */ // static public final String XML2 = "text/xml"; // } // // Path: src/main/java/org/baswell/routes/RoutesMethods.java // static boolean classImplementsInterface(Class clazz, Class interfaze) // { // if ((clazz == null) || (clazz == Object.class)) // { // return false; // } // // Class[] implementedInterfaces = clazz.getInterfaces(); // for (Class implementedInterface : implementedInterfaces) // { // if (classInstanceOf(implementedInterface, interfaze)) // { // return true; // } // } // // return classImplementsInterface(clazz.getSuperclass(), interfaze); // } // Path: src/main/java/org/baswell/routes/ContentConversionType.java import javax.xml.bind.annotation.XmlRootElement; import static org.baswell.routes.MIMETypes.*; import static org.baswell.routes.RoutesMethods.classImplementsInterface; String returnTypePackage = conversionType.getPackage().getName(); if (returnTypePackage.equals("org.json.simple")) { return ContentConversionType.JSON_SIMPLE; } else if (returnTypePackage.startsWith("org.w3c.dom")) { return ContentConversionType.W3C_NODE; } else if (returnClassName.equals("org.jdom2.Document")) { return ContentConversionType.JDOM2_DOCUMENT; } else if (returnClassName.equals("org.jdom2.Element")) { return ContentConversionType.JDOM2_ELEMENT; } else if (conversionType.getAnnotation(XmlRootElement.class) != null) { return ContentConversionType.JAXB; } else if ((((mediaType != null) && (mediaType == MediaType.JSON))) && availableLibraries.jacksonAvailable()) { return ContentConversionType.JACKSON; } else if ((((mediaType != null) && (mediaType == MediaType.JSON))) && availableLibraries.gsonAvailable()) { return ContentConversionType.GSON; }
else if (classImplementsInterface(conversionType, CharSequence.class))
baswerc/routes
src/test/java/org/baswell/routes/MediaTypeTest.java
// Path: src/main/java/org/baswell/routes/MediaType.java // public enum MediaType // { // ATOM(asList(MIMETypes.ATOM), asList("atomcat")), // CSV(asList(MIMETypes.CSV), asList("csv")), // EXCEL(asList(MIMETypes.EXCEL, MIMETypes.EXCEL2, MIMETypes.EXCEL3, MIMETypes.EXCEL4, MIMETypes.EXCEL5, MIMETypes.EXCEL6, MIMETypes.EXCEL7), asList("xlsx", "xls")), // HTML(asList(MIMETypes.HTML, MIMETypes.HTML2), asList("html", "htm", "htmls", "html")), // ICS(asList(MIMETypes.ICS), asList("ics")), // JAVASCRIPT(asList(MIMETypes.JAVASCRIPT, MIMETypes.JAVASCRIPT2, MIMETypes.JAVASCRIPT3), asList("js")), // JSON(asList(MIMETypes.JSON, MIMETypes.JSON2), asList("json")), // PDF(asList(MIMETypes.PDF), asList("pdf")), // RSS(asList(MIMETypes.RSS), asList("rss")), // TEXT(asList(MIMETypes.TEXT), asList("text", "txt")), // WORD(asList(MIMETypes.WORD, MIMETypes.WORD2), asList("doc", "docx")), // XML(asList(MIMETypes.XML, MIMETypes.XML2), asList("xml")); // // /** // * The default mime type. // */ // public final String mimeType; // // /** // * All mime types. // */ // public final List<String> mimeTypes; // // /** // * The default file extension. // */ // public final String extension; // // /** // * All file extensions. // */ // public final List<String> extensions; // // /** // * // * @param mimeTypes A comma delimitted list of mime types // * @return The {@code MediaType} that has a matching mime type or {@code null}. // */ // public static MediaType findFromMimeType(String mimeTypes) // { // if (hasContent(mimeTypes)) // { // for (String mimeType : mimeTypes.toLowerCase().split(",")) // { // if (hasContent(mimeType)) // { // for (MediaType mediaType : values()) // { // for (String mediaTypeMimeType : mediaType.mimeTypes) // { // if (mediaTypeMimeType.equals(mimeType)) // { // return mediaType; // } // } // } // } // } // // if (mimeTypes.contains("html")) // { // return HTML; // } // else if (mimeTypes.contains("xml")) // { // return XML; // } // } // // return null; // } // // /** // * // * @param extension The file extension // * @return The {@code MediaType} that has a matching file extension or {@code null}. // */ // public static MediaType findFromExtension(String extension) // { // if (extension != null) // { // extension = extension.toLowerCase(); // for (MediaType mediaType : values()) // { // for (String mediaTypeExtension : mediaType.extensions) // { // if (mediaTypeExtension.equals(extension)) // { // return mediaType; // } // } // } // } // // return null; // } // // /** // * // * @param mediaTypeParameter The media type parameter // * @return The {@code MediaType} that has the same name as the format parameter (ex. mediaType=json) or {@code null}. // */ // public static MediaType findFromMediaTypeParameter(String mediaTypeParameter) // { // if (mediaTypeParameter != null) // { // for (MediaType mediaType : values()) // { // if (mediaType.toString().equalsIgnoreCase(mediaTypeParameter)) // { // return mediaType; // } // } // } // // return null; // } // // static MediaType guessFromContent(String content) // { // content = content.trim(); // if (content.startsWith("<")) // { // if (content.contains("http://www.w3.org/2005/Atom")) // { // return ATOM; // } // // else if (content.contains("<rss")) // { // return RSS; // } // else if (content.toLowerCase().contains("<html")) // { // return HTML; // } // else // { // return XML; // } // } // else if (content.startsWith("{") || content.startsWith("[")) // { // return JSON; // } // else // { // return null; // } // } // // private MediaType(List<String> mimeTypes, List<String> extensions) // { // this.mimeTypes = mimeTypes; // this.extensions = extensions; // // mimeType = mimeTypes.get(0); // extension = extensions.get(0); // } // }
import org.junit.Test; import static org.baswell.routes.MediaType.*; import static junit.framework.Assert.*;
package org.baswell.routes; public class MediaTypeTest { @Test public void testGuessMediaType() {
// Path: src/main/java/org/baswell/routes/MediaType.java // public enum MediaType // { // ATOM(asList(MIMETypes.ATOM), asList("atomcat")), // CSV(asList(MIMETypes.CSV), asList("csv")), // EXCEL(asList(MIMETypes.EXCEL, MIMETypes.EXCEL2, MIMETypes.EXCEL3, MIMETypes.EXCEL4, MIMETypes.EXCEL5, MIMETypes.EXCEL6, MIMETypes.EXCEL7), asList("xlsx", "xls")), // HTML(asList(MIMETypes.HTML, MIMETypes.HTML2), asList("html", "htm", "htmls", "html")), // ICS(asList(MIMETypes.ICS), asList("ics")), // JAVASCRIPT(asList(MIMETypes.JAVASCRIPT, MIMETypes.JAVASCRIPT2, MIMETypes.JAVASCRIPT3), asList("js")), // JSON(asList(MIMETypes.JSON, MIMETypes.JSON2), asList("json")), // PDF(asList(MIMETypes.PDF), asList("pdf")), // RSS(asList(MIMETypes.RSS), asList("rss")), // TEXT(asList(MIMETypes.TEXT), asList("text", "txt")), // WORD(asList(MIMETypes.WORD, MIMETypes.WORD2), asList("doc", "docx")), // XML(asList(MIMETypes.XML, MIMETypes.XML2), asList("xml")); // // /** // * The default mime type. // */ // public final String mimeType; // // /** // * All mime types. // */ // public final List<String> mimeTypes; // // /** // * The default file extension. // */ // public final String extension; // // /** // * All file extensions. // */ // public final List<String> extensions; // // /** // * // * @param mimeTypes A comma delimitted list of mime types // * @return The {@code MediaType} that has a matching mime type or {@code null}. // */ // public static MediaType findFromMimeType(String mimeTypes) // { // if (hasContent(mimeTypes)) // { // for (String mimeType : mimeTypes.toLowerCase().split(",")) // { // if (hasContent(mimeType)) // { // for (MediaType mediaType : values()) // { // for (String mediaTypeMimeType : mediaType.mimeTypes) // { // if (mediaTypeMimeType.equals(mimeType)) // { // return mediaType; // } // } // } // } // } // // if (mimeTypes.contains("html")) // { // return HTML; // } // else if (mimeTypes.contains("xml")) // { // return XML; // } // } // // return null; // } // // /** // * // * @param extension The file extension // * @return The {@code MediaType} that has a matching file extension or {@code null}. // */ // public static MediaType findFromExtension(String extension) // { // if (extension != null) // { // extension = extension.toLowerCase(); // for (MediaType mediaType : values()) // { // for (String mediaTypeExtension : mediaType.extensions) // { // if (mediaTypeExtension.equals(extension)) // { // return mediaType; // } // } // } // } // // return null; // } // // /** // * // * @param mediaTypeParameter The media type parameter // * @return The {@code MediaType} that has the same name as the format parameter (ex. mediaType=json) or {@code null}. // */ // public static MediaType findFromMediaTypeParameter(String mediaTypeParameter) // { // if (mediaTypeParameter != null) // { // for (MediaType mediaType : values()) // { // if (mediaType.toString().equalsIgnoreCase(mediaTypeParameter)) // { // return mediaType; // } // } // } // // return null; // } // // static MediaType guessFromContent(String content) // { // content = content.trim(); // if (content.startsWith("<")) // { // if (content.contains("http://www.w3.org/2005/Atom")) // { // return ATOM; // } // // else if (content.contains("<rss")) // { // return RSS; // } // else if (content.toLowerCase().contains("<html")) // { // return HTML; // } // else // { // return XML; // } // } // else if (content.startsWith("{") || content.startsWith("[")) // { // return JSON; // } // else // { // return null; // } // } // // private MediaType(List<String> mimeTypes, List<String> extensions) // { // this.mimeTypes = mimeTypes; // this.extensions = extensions; // // mimeType = mimeTypes.get(0); // extension = extensions.get(0); // } // } // Path: src/test/java/org/baswell/routes/MediaTypeTest.java import org.junit.Test; import static org.baswell.routes.MediaType.*; import static junit.framework.Assert.*; package org.baswell.routes; public class MediaTypeTest { @Test public void testGuessMediaType() {
assertEquals(MediaType.JSON, guessFromContent("{one: '1', two: 'three'}"));
baswerc/routes
src/test/java/org/baswell/routes/testroutes/LoginRoutes.java
// Path: src/main/java/org/baswell/routes/RequestContent.java // public class RequestContent<ContentType extends Object> // { // private final RoutesConfiguration configuration; // // private final HttpServletRequest request; // // private final Type contentType; // // private final Class contentClass; // // private final MediaType expectedMediaType; // // private final String mimeType; // // private final AvailableLibraries availableLibraries; // // private ContentType content; // // private boolean contentLoaded; // // RequestContent(RoutesConfiguration configuration, HttpServletRequest request, Type contentType, MediaType expectedMediaType, String mimeType, AvailableLibraries availableLibraries) // { // this.configuration = configuration; // this.request = request; // this.contentType = contentType; // this.expectedMediaType = expectedMediaType; // this.mimeType = mimeType; // this.availableLibraries = availableLibraries; // // contentClass = getClassFromType(contentType); // } // // public ContentType get() throws IOException, RoutesException // { // if (contentLoaded) // { // return content; // } // else // { // contentLoaded = true; // byte[] contentBytes = getContent(); // // if (contentBytes != null) // { // MediaType mediaType = expectedMediaType; // // if ((mediaType == null) && hasContent(mimeType)) // { // mediaType = MediaType.findFromMimeType(mimeType); // } // // if (mediaType == null) // { // mediaType = MediaType.guessFromContent(new String(contentBytes)); // } // // ContentConversionType contentConversionType = mapContentConversionType(contentClass, mediaType, availableLibraries); // if (contentConversionType == null) // { // content = (ContentType) contentBytes; // } // else // { // switch (contentConversionType) // { // case TO_STRING: // content = (ContentType) new String(contentBytes); // break; // // case JSON_SIMPLE: // content = JSONSimpleBridge.parseJson(contentBytes); // break; // // case GSON: // content = GSONBridge.parseGson(contentBytes, contentType); // break; // // case JACKSON: // content = JacksonBridge.parseJackson(contentBytes, contentType); // break; // // case JAXB: // try // { // content = (ContentType) JAXBContext.newInstance(contentClass).createUnmarshaller().unmarshal(new StringReader(new String(contentBytes))); // } // catch (JAXBException e) // { // throw new RoutesException("Unable to create RequestContent class: " + contentClass.getName(), e); // } // break; // // case JDOM2_DOCUMENT: // case JDOM2_ELEMENT: // content = parseJDOM(contentBytes, contentConversionType); // break; // // case W3C_NODE: // content = parseNode(contentBytes); // break; // } // } // } // // return content; // } // } // // ContentType parseJDOM(byte[] contentBytes, ContentConversionType contentConversionType) throws IOException // { // return (ContentType)JDOMBridge.parseRequestContent(contentBytes, contentConversionType, contentClass); // } // // ContentType parseNode(byte[] contentBytes) throws IOException // { // try // { // org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(contentBytes)); // return (ContentType) (contentType == org.w3c.dom.Document.class ? document : document.getDocumentElement()); // } // catch (ParserConfigurationException e) // { // throw new RoutesException("Unable to create RequestContent class: " + contentClass.getName(), e); // } // catch (SAXException e) // { // throw new RoutesException("Unable to create RequestContent class: " + contentClass.getName(), e); // } // } // // // byte[] getContent() throws IOException // { // InputStream inputStream = request.getInputStream(); // if (inputStream == null) // { // return null; // } // else // { // ByteArrayOutputStream bytes = new ByteArrayOutputStream(); // byte[] buffer = new byte[configuration.streamBufferSize]; // int read; // // while ((read = inputStream.read(buffer)) != -1) // { // bytes.write(buffer, 0, read); // } // // return bytes.size() == 0 ? null : bytes.toByteArray(); // } // } // // static Class getClassFromType(Type type) // { // if (type instanceof Class) // { // return (Class)type; // } // else if (type instanceof ParameterizedType) // { // return getClassFromType(((ParameterizedType)type).getRawType()); // } // else // { // return null; // } // } // // }
import org.baswell.routes.RequestContent; import org.baswell.routes.Routes;
/* * Copyright 2015 Corey Baswell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.baswell.routes.testroutes; @Routes(routeUnannotatedPublicMethods =true) public class LoginRoutes extends BaseRoutes { public void post() { methodsCalled.add("post"); } public void get() { methodsCalled.add("get"); } public void getForgotPassword() { methodsCalled.add("getForgotPassword"); }
// Path: src/main/java/org/baswell/routes/RequestContent.java // public class RequestContent<ContentType extends Object> // { // private final RoutesConfiguration configuration; // // private final HttpServletRequest request; // // private final Type contentType; // // private final Class contentClass; // // private final MediaType expectedMediaType; // // private final String mimeType; // // private final AvailableLibraries availableLibraries; // // private ContentType content; // // private boolean contentLoaded; // // RequestContent(RoutesConfiguration configuration, HttpServletRequest request, Type contentType, MediaType expectedMediaType, String mimeType, AvailableLibraries availableLibraries) // { // this.configuration = configuration; // this.request = request; // this.contentType = contentType; // this.expectedMediaType = expectedMediaType; // this.mimeType = mimeType; // this.availableLibraries = availableLibraries; // // contentClass = getClassFromType(contentType); // } // // public ContentType get() throws IOException, RoutesException // { // if (contentLoaded) // { // return content; // } // else // { // contentLoaded = true; // byte[] contentBytes = getContent(); // // if (contentBytes != null) // { // MediaType mediaType = expectedMediaType; // // if ((mediaType == null) && hasContent(mimeType)) // { // mediaType = MediaType.findFromMimeType(mimeType); // } // // if (mediaType == null) // { // mediaType = MediaType.guessFromContent(new String(contentBytes)); // } // // ContentConversionType contentConversionType = mapContentConversionType(contentClass, mediaType, availableLibraries); // if (contentConversionType == null) // { // content = (ContentType) contentBytes; // } // else // { // switch (contentConversionType) // { // case TO_STRING: // content = (ContentType) new String(contentBytes); // break; // // case JSON_SIMPLE: // content = JSONSimpleBridge.parseJson(contentBytes); // break; // // case GSON: // content = GSONBridge.parseGson(contentBytes, contentType); // break; // // case JACKSON: // content = JacksonBridge.parseJackson(contentBytes, contentType); // break; // // case JAXB: // try // { // content = (ContentType) JAXBContext.newInstance(contentClass).createUnmarshaller().unmarshal(new StringReader(new String(contentBytes))); // } // catch (JAXBException e) // { // throw new RoutesException("Unable to create RequestContent class: " + contentClass.getName(), e); // } // break; // // case JDOM2_DOCUMENT: // case JDOM2_ELEMENT: // content = parseJDOM(contentBytes, contentConversionType); // break; // // case W3C_NODE: // content = parseNode(contentBytes); // break; // } // } // } // // return content; // } // } // // ContentType parseJDOM(byte[] contentBytes, ContentConversionType contentConversionType) throws IOException // { // return (ContentType)JDOMBridge.parseRequestContent(contentBytes, contentConversionType, contentClass); // } // // ContentType parseNode(byte[] contentBytes) throws IOException // { // try // { // org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(contentBytes)); // return (ContentType) (contentType == org.w3c.dom.Document.class ? document : document.getDocumentElement()); // } // catch (ParserConfigurationException e) // { // throw new RoutesException("Unable to create RequestContent class: " + contentClass.getName(), e); // } // catch (SAXException e) // { // throw new RoutesException("Unable to create RequestContent class: " + contentClass.getName(), e); // } // } // // // byte[] getContent() throws IOException // { // InputStream inputStream = request.getInputStream(); // if (inputStream == null) // { // return null; // } // else // { // ByteArrayOutputStream bytes = new ByteArrayOutputStream(); // byte[] buffer = new byte[configuration.streamBufferSize]; // int read; // // while ((read = inputStream.read(buffer)) != -1) // { // bytes.write(buffer, 0, read); // } // // return bytes.size() == 0 ? null : bytes.toByteArray(); // } // } // // static Class getClassFromType(Type type) // { // if (type instanceof Class) // { // return (Class)type; // } // else if (type instanceof ParameterizedType) // { // return getClassFromType(((ParameterizedType)type).getRawType()); // } // else // { // return null; // } // } // // } // Path: src/test/java/org/baswell/routes/testroutes/LoginRoutes.java import org.baswell.routes.RequestContent; import org.baswell.routes.Routes; /* * Copyright 2015 Corey Baswell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.baswell.routes.testroutes; @Routes(routeUnannotatedPublicMethods =true) public class LoginRoutes extends BaseRoutes { public void post() { methodsCalled.add("post"); } public void get() { methodsCalled.add("get"); } public void getForgotPassword() { methodsCalled.add("getForgotPassword"); }
public void postTest(RequestContent<byte[]> content)
baswerc/routes
src/test/java/org/baswell/routes/testroutes/ReturnTypes.java
// Path: src/main/java/org/baswell/routes/MediaType.java // public enum MediaType // { // ATOM(asList(MIMETypes.ATOM), asList("atomcat")), // CSV(asList(MIMETypes.CSV), asList("csv")), // EXCEL(asList(MIMETypes.EXCEL, MIMETypes.EXCEL2, MIMETypes.EXCEL3, MIMETypes.EXCEL4, MIMETypes.EXCEL5, MIMETypes.EXCEL6, MIMETypes.EXCEL7), asList("xlsx", "xls")), // HTML(asList(MIMETypes.HTML, MIMETypes.HTML2), asList("html", "htm", "htmls", "html")), // ICS(asList(MIMETypes.ICS), asList("ics")), // JAVASCRIPT(asList(MIMETypes.JAVASCRIPT, MIMETypes.JAVASCRIPT2, MIMETypes.JAVASCRIPT3), asList("js")), // JSON(asList(MIMETypes.JSON, MIMETypes.JSON2), asList("json")), // PDF(asList(MIMETypes.PDF), asList("pdf")), // RSS(asList(MIMETypes.RSS), asList("rss")), // TEXT(asList(MIMETypes.TEXT), asList("text", "txt")), // WORD(asList(MIMETypes.WORD, MIMETypes.WORD2), asList("doc", "docx")), // XML(asList(MIMETypes.XML, MIMETypes.XML2), asList("xml")); // // /** // * The default mime type. // */ // public final String mimeType; // // /** // * All mime types. // */ // public final List<String> mimeTypes; // // /** // * The default file extension. // */ // public final String extension; // // /** // * All file extensions. // */ // public final List<String> extensions; // // /** // * // * @param mimeTypes A comma delimitted list of mime types // * @return The {@code MediaType} that has a matching mime type or {@code null}. // */ // public static MediaType findFromMimeType(String mimeTypes) // { // if (hasContent(mimeTypes)) // { // for (String mimeType : mimeTypes.toLowerCase().split(",")) // { // if (hasContent(mimeType)) // { // for (MediaType mediaType : values()) // { // for (String mediaTypeMimeType : mediaType.mimeTypes) // { // if (mediaTypeMimeType.equals(mimeType)) // { // return mediaType; // } // } // } // } // } // // if (mimeTypes.contains("html")) // { // return HTML; // } // else if (mimeTypes.contains("xml")) // { // return XML; // } // } // // return null; // } // // /** // * // * @param extension The file extension // * @return The {@code MediaType} that has a matching file extension or {@code null}. // */ // public static MediaType findFromExtension(String extension) // { // if (extension != null) // { // extension = extension.toLowerCase(); // for (MediaType mediaType : values()) // { // for (String mediaTypeExtension : mediaType.extensions) // { // if (mediaTypeExtension.equals(extension)) // { // return mediaType; // } // } // } // } // // return null; // } // // /** // * // * @param mediaTypeParameter The media type parameter // * @return The {@code MediaType} that has the same name as the format parameter (ex. mediaType=json) or {@code null}. // */ // public static MediaType findFromMediaTypeParameter(String mediaTypeParameter) // { // if (mediaTypeParameter != null) // { // for (MediaType mediaType : values()) // { // if (mediaType.toString().equalsIgnoreCase(mediaTypeParameter)) // { // return mediaType; // } // } // } // // return null; // } // // static MediaType guessFromContent(String content) // { // content = content.trim(); // if (content.startsWith("<")) // { // if (content.contains("http://www.w3.org/2005/Atom")) // { // return ATOM; // } // // else if (content.contains("<rss")) // { // return RSS; // } // else if (content.toLowerCase().contains("<html")) // { // return HTML; // } // else // { // return XML; // } // } // else if (content.startsWith("{") || content.startsWith("[")) // { // return JSON; // } // else // { // return null; // } // } // // private MediaType(List<String> mimeTypes, List<String> extensions) // { // this.mimeTypes = mimeTypes; // this.extensions = extensions; // // mimeType = mimeTypes.get(0); // extension = extensions.get(0); // } // }
import org.baswell.routes.MediaType; import org.baswell.routes.Route; import org.baswell.routes.Routes;
/* * Copyright 2015 Corey Baswell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.baswell.routes.testroutes; @Routes(defaultReturnedStringIsContent = true) public class ReturnTypes extends BaseRoutes { @Route("/helloworld") public String getHelloWorld() { methodsCalled.add("getHelloWorld"); return "Hello World"; }
// Path: src/main/java/org/baswell/routes/MediaType.java // public enum MediaType // { // ATOM(asList(MIMETypes.ATOM), asList("atomcat")), // CSV(asList(MIMETypes.CSV), asList("csv")), // EXCEL(asList(MIMETypes.EXCEL, MIMETypes.EXCEL2, MIMETypes.EXCEL3, MIMETypes.EXCEL4, MIMETypes.EXCEL5, MIMETypes.EXCEL6, MIMETypes.EXCEL7), asList("xlsx", "xls")), // HTML(asList(MIMETypes.HTML, MIMETypes.HTML2), asList("html", "htm", "htmls", "html")), // ICS(asList(MIMETypes.ICS), asList("ics")), // JAVASCRIPT(asList(MIMETypes.JAVASCRIPT, MIMETypes.JAVASCRIPT2, MIMETypes.JAVASCRIPT3), asList("js")), // JSON(asList(MIMETypes.JSON, MIMETypes.JSON2), asList("json")), // PDF(asList(MIMETypes.PDF), asList("pdf")), // RSS(asList(MIMETypes.RSS), asList("rss")), // TEXT(asList(MIMETypes.TEXT), asList("text", "txt")), // WORD(asList(MIMETypes.WORD, MIMETypes.WORD2), asList("doc", "docx")), // XML(asList(MIMETypes.XML, MIMETypes.XML2), asList("xml")); // // /** // * The default mime type. // */ // public final String mimeType; // // /** // * All mime types. // */ // public final List<String> mimeTypes; // // /** // * The default file extension. // */ // public final String extension; // // /** // * All file extensions. // */ // public final List<String> extensions; // // /** // * // * @param mimeTypes A comma delimitted list of mime types // * @return The {@code MediaType} that has a matching mime type or {@code null}. // */ // public static MediaType findFromMimeType(String mimeTypes) // { // if (hasContent(mimeTypes)) // { // for (String mimeType : mimeTypes.toLowerCase().split(",")) // { // if (hasContent(mimeType)) // { // for (MediaType mediaType : values()) // { // for (String mediaTypeMimeType : mediaType.mimeTypes) // { // if (mediaTypeMimeType.equals(mimeType)) // { // return mediaType; // } // } // } // } // } // // if (mimeTypes.contains("html")) // { // return HTML; // } // else if (mimeTypes.contains("xml")) // { // return XML; // } // } // // return null; // } // // /** // * // * @param extension The file extension // * @return The {@code MediaType} that has a matching file extension or {@code null}. // */ // public static MediaType findFromExtension(String extension) // { // if (extension != null) // { // extension = extension.toLowerCase(); // for (MediaType mediaType : values()) // { // for (String mediaTypeExtension : mediaType.extensions) // { // if (mediaTypeExtension.equals(extension)) // { // return mediaType; // } // } // } // } // // return null; // } // // /** // * // * @param mediaTypeParameter The media type parameter // * @return The {@code MediaType} that has the same name as the format parameter (ex. mediaType=json) or {@code null}. // */ // public static MediaType findFromMediaTypeParameter(String mediaTypeParameter) // { // if (mediaTypeParameter != null) // { // for (MediaType mediaType : values()) // { // if (mediaType.toString().equalsIgnoreCase(mediaTypeParameter)) // { // return mediaType; // } // } // } // // return null; // } // // static MediaType guessFromContent(String content) // { // content = content.trim(); // if (content.startsWith("<")) // { // if (content.contains("http://www.w3.org/2005/Atom")) // { // return ATOM; // } // // else if (content.contains("<rss")) // { // return RSS; // } // else if (content.toLowerCase().contains("<html")) // { // return HTML; // } // else // { // return XML; // } // } // else if (content.startsWith("{") || content.startsWith("[")) // { // return JSON; // } // else // { // return null; // } // } // // private MediaType(List<String> mimeTypes, List<String> extensions) // { // this.mimeTypes = mimeTypes; // this.extensions = extensions; // // mimeType = mimeTypes.get(0); // extension = extensions.get(0); // } // } // Path: src/test/java/org/baswell/routes/testroutes/ReturnTypes.java import org.baswell.routes.MediaType; import org.baswell.routes.Route; import org.baswell.routes.Routes; /* * Copyright 2015 Corey Baswell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.baswell.routes.testroutes; @Routes(defaultReturnedStringIsContent = true) public class ReturnTypes extends BaseRoutes { @Route("/helloworld") public String getHelloWorld() { methodsCalled.add("getHelloWorld"); return "Hello World"; }
@Route(value = "/gson", respondsToMediaRequests = MediaType.JSON)