class BookmarkableUrlHelper {

    public static PlaceRequest getPerspectiveFromPlace(PlaceRequest place) {
        String url = place.getFullIdentifier();

        if (isPerspectiveInUrl(url)) {
            String perspectiveName = url.substring(0,
                                                   url.indexOf(PERSPECTIVE_SEP));
            PlaceRequest copy = place.clone();
            copy.setIdentifier(perspectiveName);
            if (!place.getParameters().isEmpty()) {
                for (Map.Entry<String, String> elem : place.getParameters().entrySet()) {
                    copy.addParameter(elem.getKey(),
                                      elem.getValue());
                }
            }
            return copy;
        }
        return place;
    }

}