Permalink
Browse files

initial improvement on PathPlaceRequest - still needs improvements

  • Loading branch information...
1 parent c0cda19 commit e332d01339c61db861d6d941a7edeb656d595b8d @porcelli porcelli committed Jan 10, 2013
@@ -2,6 +2,7 @@
import java.util.Map;
+import com.google.gwt.http.client.URL;
import org.jboss.errai.common.client.api.annotations.Portable;
import org.uberfire.backend.vfs.Path;
import org.uberfire.shared.mvp.PlaceRequest;
@@ -49,6 +50,29 @@ public Path getPath() {
}
@Override
+ public String getFullIdentifier() {
+ StringBuilder fullIdentifier = new StringBuilder();
+ fullIdentifier.append( this.getIdentifier() );
+
+ if ( !this.getIdentifier().equals( path.toURI() ) ) {
+ fullIdentifier.append( "?" ).append( "path_uri" ).append( "=" ).append( URL.encode( path.toURI() ) );
+ } else if ( this.getParameterNames().size() > 0 ) {
+ fullIdentifier.append( "?" );
+ }
+
+ for ( String name : this.getParameterNames() ) {
+ fullIdentifier.append( name ).append( "=" ).append( this.getParameter( name, null ).toString() );
+ fullIdentifier.append( "&" );
+ }
+
+ if ( fullIdentifier.length() != 0 && fullIdentifier.lastIndexOf( "&" ) + 1 == fullIdentifier.length() ) {
+ fullIdentifier.deleteCharAt( fullIdentifier.length() - 1 );
+ }
+
+ return fullIdentifier.toString();
+ }
+
+ @Override
public PlaceRequest clone() {
return new PathPlaceRequest( path, identifier, parameters );
}

0 comments on commit e332d01

Please sign in to comment.