]>
git.argeo.org Git - gpl/argeo-suite.git/blob - org.argeo.suite.core/src/org/argeo/suite/core/DefaultSuiteAppService.java
1 package org
.argeo
.suite
.core
;
6 import javax
.jcr
.RepositoryException
;
8 import org
.argeo
.connect
.AppService
;
9 import org
.argeo
.suite
.SuiteConstants
;
11 public class DefaultSuiteAppService
implements AppService
{
13 // Injected known AppWorkbenchServices: order is important, first found
14 // result will be returned by the various methods.
15 private List
<AppService
> knownAppServices
;
18 public Node
createEntity(Node parent
, String nodeType
, Node srcNode
, boolean removeSrcNode
)
19 throws RepositoryException
{
20 for (AppService appService
: knownAppServices
) {
21 if (appService
.isKnownType(nodeType
))
22 return appService
.createEntity(parent
, nodeType
, srcNode
, removeSrcNode
);
28 public String
getAppBaseName() {
29 return SuiteConstants
.SUITE_APP_BASE_NAME
;
33 public String
getBaseRelPath(String nodeType
) {
34 for (AppService appService
: knownAppServices
) {
35 if (appService
.isKnownType(nodeType
))
36 return appService
.getBaseRelPath(nodeType
);
39 // return getAppBaseName();
43 public String
getDefaultRelPath(Node entity
) throws RepositoryException
{
44 for (AppService appService
: knownAppServices
) {
45 if (appService
.isKnownType(entity
))
46 return appService
.getDefaultRelPath(entity
);
52 public String
getDefaultRelPath(String nodetype
, String id
) {
53 for (AppService appService
: knownAppServices
) {
54 if (appService
.isKnownType(nodetype
))
55 return appService
.getDefaultRelPath(nodetype
, id
);
60 /** Insures the correct service is called on save */
62 public Node
saveEntity(Node entity
, boolean publish
) {
63 for (AppService appService
: knownAppServices
) {
64 if (appService
.isKnownType(entity
))
65 return appService
.saveEntity(entity
, publish
);
67 return AppService
.super.saveEntity(entity
, publish
);
71 public boolean isKnownType(Node entity
) {
72 for (AppService appService
: knownAppServices
) {
73 if (appService
.isKnownType(entity
))
80 public boolean isKnownType(String nodeType
) {
81 for (AppService appService
: knownAppServices
) {
82 if (appService
.isKnownType(nodeType
))
88 public void setKnownAppServices(List
<AppService
> knownAppServices
) {
89 this.knownAppServices
= knownAppServices
;