-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
poc: add support for locations.geojson (use feature collection as entities) #1805
Closed
Closed
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f8a966d
add base classes, main broken
davidgamez 204f931
fix FeedMetadata compilation issues
davidgamez e7751f0
add generated files to gitignore
davidgamez 1131d7d
Merge branch 'master' into poc/json-files
davidgamez f027e9a
update TableStatus use
davidgamez 2eae957
add json container class
davidgamez ae500ef
prepare feed container to load json files
davidgamez acab716
skip abstract classes while initializing the gtfs descriptors
davidgamez 138d550
add empty GtfsJsonFileLoader
davidgamez e1ea3f1
Corrected a NPE caused by containers missing for files not dataset
jcpitre 9847720
add GtfsLocationsSchema and related classes
davidgamez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public abstract class GtfsContainer<T extends GtfsEntity, D extends GtfsDescriptor> { | ||
|
||
private final D descriptor; | ||
private final TableStatus tableStatus; | ||
|
||
public GtfsContainer(D descriptor, TableStatus tableStatus) { | ||
this.tableStatus = tableStatus; | ||
this.descriptor = descriptor; | ||
} | ||
|
||
public TableStatus getTableStatus() { | ||
return tableStatus; | ||
} | ||
|
||
public D getDescriptor() { | ||
return descriptor; | ||
} | ||
|
||
public abstract Class<T> getEntityClass(); | ||
|
||
public int entityCount() { | ||
return getEntities().size(); | ||
} | ||
|
||
public abstract List<T> getEntities(); | ||
|
||
public abstract String gtfsFilename(); | ||
|
||
public abstract Optional<T> byTranslationKey(String recordId, String recordSubId); | ||
|
||
public boolean isMissingFile() { | ||
return tableStatus == TableStatus.MISSING_FILE; | ||
} | ||
|
||
public boolean isParsedSuccessfully() { | ||
switch (tableStatus) { | ||
case PARSABLE_HEADERS_AND_ROWS: | ||
return true; | ||
case MISSING_FILE: | ||
return !descriptor.isRequired(); | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
// TODO: review class name maybe GtfsFileDescriptor | ||
public abstract class GtfsDescriptor<T extends GtfsEntity> { | ||
davidgamez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public abstract <C extends GtfsContainer> C createContainerForInvalidStatus( | ||
TableStatus tableStatus); | ||
|
||
// True if the specified file is required in a feed. | ||
private boolean required; | ||
|
||
private TableStatus tableStatus; | ||
|
||
public abstract boolean isRecommended(); | ||
|
||
public abstract Class<T> getEntityClass(); | ||
|
||
public abstract String gtfsFilename(); | ||
|
||
public boolean isRequired() { | ||
return this.required; | ||
} | ||
|
||
public void setRequired(boolean required) { | ||
this.required = required; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsJsonContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
public abstract class GtfsJsonContainer<T extends GtfsEntity, D extends GtfsDescriptor<T>> | ||
extends GtfsContainer<T, D> { | ||
|
||
public GtfsJsonContainer(D descriptor, TableStatus tableStatus) { | ||
super(descriptor, tableStatus); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsJsonDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
import java.util.List; | ||
import org.mobilitydata.gtfsvalidator.notice.NoticeContainer; | ||
|
||
public abstract class GtfsJsonDescriptor<T extends GtfsEntity> extends GtfsDescriptor<T> { | ||
|
||
public abstract GtfsJsonContainer createContainerForEntities( | ||
List<T> entities, NoticeContainer noticeContainer); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider naming this GtfsEntityContainer to distinguish it from the GtfsFeedContainer type?