import javax.jcr.RepositoryException;
import org.argeo.connect.AppService;
+import org.argeo.connect.SystemAppService;
import org.argeo.suite.SuiteConstants;
+import org.argeo.suite.SuiteException;
-public class DefaultSuiteAppService implements AppService {
+public class DefaultSuiteAppService implements SystemAppService {
// Injected known AppWorkbenchServices: order is important, first found
// result will be returned by the various methods.
private List<AppService> knownAppServices;
+ @Override
+ public Node createEntity(Node parent, String nodeType, Node srcNode, boolean removeSrcNode)
+ throws RepositoryException {
+ for (AppService appService : knownAppServices) {
+ if (appService.isKnownType(nodeType))
+ return appService.createEntity(parent, nodeType, srcNode, removeSrcNode);
+ }
+ return null;
+ }
+
@Override
public String getAppBaseName() {
return SuiteConstants.SUITE_APP_BASE_NAME;
}
+ @Override
+ public String getBaseRelPath(String nodeType) {
+ for (AppService appService : knownAppServices) {
+ if (appService.isKnownType(nodeType))
+ return appService.getBaseRelPath(nodeType);
+ }
+ return null;
+ // return getAppBaseName();
+ }
+
@Override
public String getDefaultRelPath(Node entity) throws RepositoryException {
for (AppService appService : knownAppServices) {
if (appService.isKnownType(entity))
return appService.saveEntity(entity, publish);
}
- return AppService.super.saveEntity(entity, publish);
+ throw new SuiteException("Unknown NodeType for " + entity + ". Cannot save");
+ // return AppService.super.saveEntity(entity, publish);
}
@Override
public void setKnownAppServices(List<AppService> knownAppServices) {
this.knownAppServices = knownAppServices;
}
+
}