@Override public void aroundInvoke(final RemoteCallContext context) { final Object o = context.getParameters()[0]; if (o instanceof PathFactory.PathImpl && ((PathFactory.PathImpl) o).getAttributes().size() > 0) { context.setResult(((PathFactory.PathImpl) o).getAttributes()); return; } context.proceed(); } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Path)) { return false; } final Path path = (Path) o; return this.toURI().equals(path.toURI()); }
@Test public void createEvent() { DataObject currentDataObject = new DataObjectImpl(); ObjectProperty currentField = new ObjectPropertyImpl(); Method currentMethod = new MethodImpl(); Module currentModule = new Module(); String source = "testSource"; String contextId = "testContextId"; Path path = new PathFactory.PathImpl(); DataModelerEvent event = new DataModelerEvent() .withCurrentDataObject(currentDataObject) .withCurrentField(currentField) .withCurrentMethod(currentMethod) .withCurrentProject(currentModule) .withSource(source) .withContextId(contextId) .withPath(path); assertEquals(currentDataObject, event.getCurrentDataObject()); assertEquals(currentField, event.getCurrentField()); assertEquals(currentMethod, event.getCurrentMethod()); assertEquals(currentModule, event.getCurrentModule()); assertEquals(source, event.getSource()); assertEquals(contextId, event.getContextId()); assertEquals(path, event.getPath()); } }
public static Path newPath(final String fileName, final String uri, final Map<String, Object> attrs) { return new PathImpl(checkNotEmpty("fileName", fileName), checkNotEmpty("uri", uri), attrs); }
public static Path newPathBasedOn(final String fileName, final String uri, final Path path) { return new PathImpl(checkNotEmpty("fileName", fileName), checkNotEmpty("uri", uri), checkNotNull("path", path)); }
public static Path newPath(final String fileName, final String uri) { return new PathImpl(checkNotEmpty("fileName", fileName), checkNotEmpty("uri", uri)); }
@Override public void aroundInvoke(final RemoteCallContext context) { final Object o = context.getParameters()[0]; if (o instanceof PathFactory.PathImpl && ((PathFactory.PathImpl) o).getAttributes().size() > 0) { context.setResult(((PathFactory.PathImpl) o).getAttributes()); return; } context.proceed(); } }