use of edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId in project webprotege by protegeproject.
the class ProjectViewPlaceTokenizer method getPlace.
public ProjectViewPlace getPlace(String token) {
GWT.log("[ProjectViewPlaceTokenizer] Parsing: " + token);
token = URL.decode(token);
GWT.log("[ProjectViewPlaceTokenizer] Decoded: " + token);
MatchResult result = regExp.exec(token);
GWT.log("[ProjectViewPlaceTokenizer] MatchResult: " + result);
String projectId = result.getGroup(1);
String perspectiveId = result.getGroup(2);
String selectionString = result.getGroup(4);
GWT.log("[ProjectViewPlaceTokenizer] Parsed: ProjectId: " + projectId);
GWT.log("[ProjectViewPlaceTokenizer] Parsed: PerspectiveId: " + perspectiveId);
GWT.log("[ProjectViewPlaceTokenizer] Parsed: Selection: " + selectionString);
ProjectViewPlace.Builder builder = new ProjectViewPlace.Builder(ProjectId.get(projectId), new PerspectiveId(perspectiveId));
if (selectionString != null) {
ItemTokenizer tokenizer = new ItemTokenizer();
List<ItemToken> tokenList = tokenizer.parseTokens(selectionString);
for (ItemToken t : tokenList) {
OWLDataFactoryImpl dataFactory = new OWLDataFactoryImpl();
ItemTokenParser parser = new ItemTokenParser();
DefaultPrefixManager prefixManager = new DefaultPrefixManager();
prefixManager.setPrefix("owl:", Namespaces.OWL.getPrefixIRI());
List<Item<?>> entity = parser.parse(t, new DefaultItemTypeMapper(dataFactory, prefixManager));
for (Item<?> item : entity) {
builder.withSelectedItem(item);
}
}
}
return builder.build();
}
use of edu.stanford.bmir.protege.web.shared.perspective.PerspectiveId in project webprotege by protegeproject.
the class PlaceUrl_TestCase method setUp.
@Before
public void setUp() throws Exception {
when(typeMapper.getPerspectiveId(Matchers.any())).thenReturn(new PerspectiveId("TheClassPerspective"));
when(typeMapper.getDefaultPerspectiveId()).thenReturn(new PerspectiveId("TheDefaultPerspective"));
when(hostProvider.get()).thenReturn(THE_APPLICATION_HOST);
when(portProvider.get()).thenReturn(Optional.empty());
when(pathProvider.get()).thenReturn(THE_APPLICATION_PATH);
when(appNameProvider.get()).thenReturn(THE_APPLICATION_NAME);
when(schemeProvider.get()).thenReturn(ApplicationScheme.HTTPS);
placeUrl = new PlaceUrl(schemeProvider, hostProvider, portProvider, pathProvider, appNameProvider, typeMapper);
}
Aggregations