-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from planetlabs/0.9.0
WIP Upgrade to 0.9.0-RC1
- Loading branch information
Showing
123 changed files
with
1,507 additions
and
1,093 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
38 changes: 38 additions & 0 deletions
38
staccato-application/src/main/java/com/planet/staccato/api/FieldsPropertyEditor.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,38 @@ | ||
package com.planet.staccato.api; | ||
|
||
import com.planet.staccato.dto.api.extensions.FieldsExtension; | ||
|
||
import java.beans.PropertyEditorSupport; | ||
|
||
/** | ||
* The fields extension supports different formats depending on whether the request is GET or POST. The POST format | ||
* uses the FieldsExtension object, whereas the GET format is simply an array of Strings and must be parsed. This | ||
* property editor will convert the GET format to a FieldsExtension object so that the SearchRequest object only need | ||
* to define the fields field as a FieldsExtension. | ||
* | ||
* @author joshfix | ||
* Created on 1/15/20 | ||
*/ | ||
public class FieldsPropertyEditor extends PropertyEditorSupport { | ||
|
||
@Override | ||
public void setAsText(String text) { | ||
if (text == null) { | ||
return; | ||
} | ||
|
||
String[] fields = text.split(","); | ||
FieldsExtension fieldsExtension = new FieldsExtension(); | ||
for (String field : fields) { | ||
|
||
if (field.startsWith("-")) { | ||
// if the field name starts with an dash, it is to be excluded | ||
fieldsExtension.exclude(field.substring(1)); | ||
} else { | ||
fieldsExtension.include(field); | ||
} | ||
} | ||
|
||
setValue(fieldsExtension); | ||
} | ||
} |
Oops, something went wrong.