public PlaceRequest getPlaceRequest( String fullIdentifier ) {
final String identifier = fullIdentifier.contains( "?" ) ? fullIdentifier.substring( 0, fullIdentifier.indexOf( "?" ) ) : fullIdentifier;
final String query = fullIdentifier.contains( "?" ) ? fullIdentifier.substring( fullIdentifier.indexOf( "?" ) + 1 ) : "";
final Map<String, String> parameters = getParameters( query );
final PlaceRequest placeRequest;
if ( parameters.containsKey( "path_uri" ) ) {
if ( parameters.containsKey( "has_version_support" ) ) {
placeRequest = new PathPlaceRequest( PathFactory.newPath( parameters.remove( "file_name" ), parameters.remove( "path_uri" ), new HashMap<String, Object>() {{
put( PathFactory.VERSION_PROPERTY, Boolean.valueOf( parameters.remove( "has_version_support" ) ) );
}} ), identifier );
} else {
placeRequest = new PathPlaceRequest( PathFactory.newPath( parameters.remove( "file_name" ), parameters.remove( "path_uri" ) ), identifier );
}
} else {
placeRequest = new DefaultPlaceRequest( identifier );
}
for ( String parameterName : parameters.keySet() ) {
placeRequest.addParameter( parameterName, parameters.get( parameterName ) );
}
return placeRequest;
}