diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4411ffab..398f5e68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,42 @@ name: 'Continuous Integration' on: push: - branches: - - 'master*' - - 'release*' - pull_request: workflow_dispatch: +env: + ALFRESCO_NEXUS_USERNAME: ${{ secrets.ALFRESCO_NEXUS_USERNAME }} + ALFRESCO_NEXUS_PASSWORD: ${{ secrets.ALFRESCO_NEXUS_PASSWORD }} jobs: - BuildAndPublish: + test: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: temurin + - name: Build interface + uses: gradle/gradle-build-action@v2.3.0 + with: + arguments: :apix-interface:build :apix-interface:javadoc + - name: Unit test REST API + uses: gradle/gradle-build-action@v2.3.0 + with: + arguments: --info :apix-rest-v1:test + - name: Upload test reports + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-result + path: /home/runner/work/**/build/reports + retention-days: 2 + integration-test: + runs-on: ubuntu-latest strategy: + fail-fast: false matrix: alfresco_version: [ 62, 70, 71, 72, 73 ] - runs-on: ubuntu-latest steps: - name: Check out uses: actions/checkout@v3 @@ -26,25 +51,8 @@ jobs: registry: private.docker.xenit.eu username: ${{ secrets.CLOUDSMITH_USER }} password: ${{ secrets.CLOUDSMITH_APIKEY }} - - name: Build interface # Execute before integration testing to catch errors early - uses: gradle/gradle-build-action@v2.3.0 - env: - XENIT_ARTIFACTORY_USERNAME: ${{ secrets.XENIT_ARTIFACTORY_USERNAME }} - XENIT_ARTIFACTORY_PASSWORD: ${{ secrets.XENIT_ARTIFACTORY_PASSWORD }} - with: - arguments: :apix-interface:build :apix-interface:javadoc - - name: Unit test REST API - uses: gradle/gradle-build-action@v2.3.0 - env: - XENIT_ARTIFACTORY_USERNAME: ${{ secrets.XENIT_ARTIFACTORY_USERNAME }} - XENIT_ARTIFACTORY_PASSWORD: ${{ secrets.XENIT_ARTIFACTORY_PASSWORD }} - with: - arguments: --info :apix-rest-v1:test - - name: Build and test + - name: Integration test and apix impl test uses: gradle/gradle-build-action@v2.3.0 - env: - XENIT_ARTIFACTORY_USERNAME: ${{ secrets.XENIT_ARTIFACTORY_USERNAME }} - XENIT_ARTIFACTORY_PASSWORD: ${{ secrets.XENIT_ARTIFACTORY_PASSWORD }} with: arguments: >- --info @@ -54,15 +62,24 @@ jobs: if: always() uses: actions/upload-artifact@v3 with: - name: test-result + name: test-result-${{ matrix.alfresco_version }} path: /home/runner/work/**/build/reports retention-days: 2 + publish: + needs: [ test, integration-test ] + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/release') }} + steps: + - name: Check out + uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: 11 + distribution: temurin - name: Publish - if: ${{ startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/release') }}" uses: gradle/gradle-build-action@v2.3.0 env: - XENIT_ARTIFACTORY_USERNAME: ${{ secrets.XENIT_ARTIFACTORY_USERNAME }} - XENIT_ARTIFACTORY_PASSWORD: ${{ secrets.XENIT_ARTIFACTORY_PASSWORD }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_GPG_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_GPG_PASSWORD }} ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.SONATYPE_S01_USERNAME }} @@ -71,4 +88,4 @@ jobs: arguments: >- --info -PsigningKeyId=DF8285F0 :apix-interface:publish - :alfresco:${{ matrix.alfresco_version }}:publish + :alfresco:publish diff --git a/apix-impl/src/main/java/eu/xenit/apix/alfresco/comments/CommentService.java b/apix-impl/src/main/java/eu/xenit/apix/alfresco/comments/CommentService.java index 4432ce8c..67fe70b9 100644 --- a/apix-impl/src/main/java/eu/xenit/apix/alfresco/comments/CommentService.java +++ b/apix-impl/src/main/java/eu/xenit/apix/alfresco/comments/CommentService.java @@ -112,23 +112,23 @@ protected Comment toComment(org.alfresco.service.cmr.repository.NodeRef document Comment response = new Comment(); response.setId(apixCommentNodeRef); response.setContent(content); - List property = commentMetadata.properties.get(new QName(ContentModel.PROP_TITLE.toString())); + List property = commentMetadata.getProperties().get(new QName(ContentModel.PROP_TITLE.toString())); if (property != null && !property.isEmpty()) { response.setTitle(property.get(0)); } - property = commentMetadata.properties.get(new QName(ContentModel.PROP_CREATED.toString())); + property = commentMetadata.getProperties().get(new QName(ContentModel.PROP_CREATED.toString())); if (property != null && !property.isEmpty()) { response.setCreatedAt(property.get(0)); } - property = commentMetadata.properties.get(new QName(ContentModel.PROP_CREATOR.toString())); + property = commentMetadata.getProperties().get(new QName(ContentModel.PROP_CREATOR.toString())); if (property != null && !property.isEmpty()) { response.setCreatedBy(property.get(0)); } - property = commentMetadata.properties.get(new QName(ContentModel.PROP_MODIFIED.toString())); + property = commentMetadata.getProperties().get(new QName(ContentModel.PROP_MODIFIED.toString())); if (property != null && !property.isEmpty()) { response.setModifiedAt(property.get(0)); } - property = commentMetadata.properties.get(new QName(ContentModel.PROP_MODIFIER.toString())); + property = commentMetadata.getProperties().get(new QName(ContentModel.PROP_MODIFIER.toString())); if (property != null && !property.isEmpty()) { response.setModifiedBy(property.get(0)); } diff --git a/apix-impl/src/main/java/eu/xenit/apix/alfresco/configuration/ConfigurationServiceImpl.java b/apix-impl/src/main/java/eu/xenit/apix/alfresco/configuration/ConfigurationServiceImpl.java index 051a86b8..8beefa51 100644 --- a/apix-impl/src/main/java/eu/xenit/apix/alfresco/configuration/ConfigurationServiceImpl.java +++ b/apix-impl/src/main/java/eu/xenit/apix/alfresco/configuration/ConfigurationServiceImpl.java @@ -111,7 +111,7 @@ public Configurations getConfigurationFiles(String searchDirectory, String nameF ContentInputStream configStream = contentService.getContent(configurationFile.getNodeRef()); if (configStream != null) { String mimetype = configStream.getMimetype(); - String name = configurationFile.getMetadata().properties.get(QNAME_NAME).get(0); + String name = configurationFile.getMetadata().getProperties().get(QNAME_NAME).get(0); logger.debug("Mimetype is {}; filename is {}", mimetype, name); Object parsedContent = null; if (mimetype.equals("text/x-yaml") || name.endsWith(".yaml") || name.endsWith(".yml")) { @@ -144,7 +144,7 @@ private List getChildrenRecursive(NodeRef parent, Configurati for (ChildParentAssociation childParentAssociation : childParentAssociations) { NodeRef child = childParentAssociation.getTarget(); NodeMetadata childMetadata = nodeService.getMetadata(child); - if (childMetadata.type.getValue().equals(QNAME_FOLDER)) { + if (childMetadata.getType().getValue().equals(QNAME_FOLDER)) { files.addAll(getChildrenRecursive(child, filter)); } else if (filter.isAccepted(childMetadata)) { files.add(new ConfigurationFile(child, childMetadata)); @@ -171,7 +171,7 @@ class NameFilter implements ConfigurationServiceImpl.Filter { @Override public boolean isAccepted(NodeMetadata metadata) { - String name = metadata.properties.get(QNAME_NAME).get(0); + String name = metadata.getProperties().get(QNAME_NAME).get(0); logger.debug("Checking if {} matches {}", name, filter); return filter.matcher(name).find(); } diff --git a/apix-impl/src/main/java/eu/xenit/apix/alfresco/dictionary/DictionaryService.java b/apix-impl/src/main/java/eu/xenit/apix/alfresco/dictionary/DictionaryService.java index 18313b7d..9c097de6 100644 --- a/apix-impl/src/main/java/eu/xenit/apix/alfresco/dictionary/DictionaryService.java +++ b/apix-impl/src/main/java/eu/xenit/apix/alfresco/dictionary/DictionaryService.java @@ -37,7 +37,7 @@ @Component("eu.xenit.apix.dictionary.IDictionaryService") public class DictionaryService implements IDictionaryService { - private final static Logger logger = LoggerFactory.getLogger(DictionaryService.class); + private static final Logger logger = LoggerFactory.getLogger(DictionaryService.class); @Autowired private ApixToAlfrescoConversion c; @Autowired @@ -55,8 +55,6 @@ public class DictionaryService implements IDictionaryService { @Autowired private NamespaceService namespaceService; - public DictionaryService() { - } public Namespaces getNamespaces() { Map ret = new HashMap<>(); @@ -65,7 +63,7 @@ public Namespaces getNamespaces() { if (s == null || s.length() == 0) { continue; } - ret.put(s, new Namespace(s, new ArrayList(this.namespaceService.getPrefixes(s)))); + ret.put(s, new Namespace(s, new ArrayList<>(this.namespaceService.getPrefixes(s)))); } return new Namespaces(ret); } diff --git a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/AllNodeInfoTest.java b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/AllNodeInfoTest.java index 67073409..bee5382e 100644 --- a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/AllNodeInfoTest.java +++ b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/AllNodeInfoTest.java @@ -81,7 +81,7 @@ public void testGetAllNodeInfoOfMultipleNodes() throws IOException, JSONExceptio @Test public void testGetAllNodeInfoWithNoNodesListed() throws IOException { - String jsonString = json("{}"); + String jsonString = json(""); final CloseableHttpClient httpclient = HttpClients.createDefault(); final String url = makeAlfrescoBaseurl("admin", "admin") + "/apix/v1/nodes/nodeInfo"; diff --git a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/CopyNodeTest.java b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/CopyNodeTest.java index 868b563b..7e0b8a81 100644 --- a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/CopyNodeTest.java +++ b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/CopyNodeTest.java @@ -132,7 +132,7 @@ public void testCopyFileDuplicateName() { @Test public void testCopyFolderDuplicateName() { final NodeRef childRef = nodeService.getChildAssociations(mainTestFolder).get(0).getTarget(); - final String newName = nodeService.getMetadata(childRef).properties.get(c.apix(ContentModel.PROP_NAME)).get(0); + final String newName = nodeService.getMetadata(childRef).getProperties().get(c.apix(ContentModel.PROP_NAME)).get(0); CreateNodeOptions createNodeOptions = getCreateNodeOptions(mainTestFolder, newName, null, null, copyFromFolder); NodeRef newRef = transactionService.getRetryingTransactionHelper() diff --git a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/NodesBaseTest.java b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/NodesBaseTest.java index 935704ac..89f77609 100644 --- a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/NodesBaseTest.java +++ b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/NodesBaseTest.java @@ -107,7 +107,7 @@ public void checkCreatedNode(NodeRef newRef, CreateNodeOptions createNodeOptions assertEquals(createNodeOptions.getParent(), nodeService.getParentAssociations(newRef).get(0).getTarget().toString()); if (createNodeOptions.getType() != null) { - assertEquals(createNodeOptions.getType(), nodeService.getMetadata(newRef).type.toString()); + assertEquals(createNodeOptions.getType(), nodeService.getMetadata(newRef).getType().toString()); } if (createNodeOptions.getCopyFrom() != null) { @@ -116,13 +116,13 @@ public void checkCreatedNode(NodeRef newRef, CreateNodeOptions createNodeOptions if (createNodeOptions.getProperties() != null) { for (Map.Entry property : createNodeOptions.getProperties().entrySet()) { - assertArrayEquals(property.getValue(), nodeService.getMetadata(newRef).properties.get(property.getKey()).toArray()); + assertArrayEquals(property.getValue(), nodeService.getMetadata(newRef).getProperties().get(property.getKey()).toArray()); } } if (createNodeOptions.getAspectsToAdd() != null) { for (QName aspect : createNodeOptions.getAspectsToAdd()) { - assertNotNull(nodeService.getMetadata(newRef).aspects + assertNotNull(nodeService.getMetadata(newRef).getAspects() .stream() .filter(testAspect -> testAspect.equals(aspect)) .findFirst() @@ -132,7 +132,7 @@ public void checkCreatedNode(NodeRef newRef, CreateNodeOptions createNodeOptions if (createNodeOptions.getAspectsToRemove() != null) { for (QName aspect : createNodeOptions.getAspectsToRemove()) { - assertNull(nodeService.getMetadata(newRef).aspects + assertNull(nodeService.getMetadata(newRef).getAspects() .stream() .filter(testAspect -> testAspect.equals(aspect)) .findFirst() diff --git a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/VersionHistoryTest.java b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/VersionHistoryTest.java index b149571a..f40b7d0b 100644 --- a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/VersionHistoryTest.java +++ b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v1/tests/VersionHistoryTest.java @@ -1,19 +1,12 @@ package eu.xenit.apix.rest.v1.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import com.fasterxml.jackson.databind.ObjectMapper; import eu.xenit.apix.alfresco.ApixToAlfrescoConversion; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.versionhistory.Version; import eu.xenit.apix.versionhistory.VersionHistory; -import java.io.IOException; -import java.util.HashMap; import org.alfresco.model.ContentModel; import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.version.VersionBaseModel; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.NodeService; @@ -22,6 +15,7 @@ import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.fluent.Request; +import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -36,10 +30,17 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import java.io.IOException; +import java.util.HashMap; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class VersionHistoryTest extends RestV1BaseTest { - private final static Logger logger = LoggerFactory.getLogger(VersionHistoryTest.class); + private static final Logger logger = LoggerFactory.getLogger(VersionHistoryTest.class); @Autowired @Qualifier("TransactionService") TransactionService transactionService; @@ -119,12 +120,10 @@ public void testSetVersionHistoryWithoutBody() throws IOException { return null; }, true, true); - int statusCode = Request.Put(versionHistoryUrl) + HttpResponse response = Request.Put(versionHistoryUrl) .execute() - .returnResponse() - .getStatusLine() - .getStatusCode(); - assertEquals(200, statusCode); + .returnResponse(); + assertEquals(200, response.getStatusLine().getStatusCode()); transactionService.getRetryingTransactionHelper() .doInTransaction(() -> { @@ -170,12 +169,11 @@ public void testSetVersionHistoryWithoutBody() throws IOException { HttpPut httpPut = new HttpPut(versionHistoryUrl2); httpPut.setEntity(new StringEntity(json(requestBody), ContentType.APPLICATION_JSON)); - int statusCode2 = HttpClients.createDefault() - .execute(httpPut) + CloseableHttpResponse httpResponse = HttpClients.createDefault() + .execute(httpPut); + assertEquals(200, httpResponse .getStatusLine() - .getStatusCode(); - - assertEquals(200, statusCode2); + .getStatusCode()); transactionService.getRetryingTransactionHelper() .doInTransaction(() -> { diff --git a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v2/tests/AllNodeInfoTest.java b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v2/tests/AllNodeInfoTest.java index ca8cf569..9a953566 100644 --- a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v2/tests/AllNodeInfoTest.java +++ b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/rest/v2/tests/AllNodeInfoTest.java @@ -80,7 +80,7 @@ public void testGetAllNodeInfoOfMultipleNodes() throws IOException, JSONExceptio @Test public void testGetAllNodeInfoWithNoNodesListed() throws IOException { - String jsonString = json("{}"); + String jsonString = json(""); final CloseableHttpClient httpclient = HttpClients.createDefault(); final String url = makeAlfrescoBaseurl("admin", "admin") + "/apix/v2/nodes/nodeInfo"; diff --git a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/tests/metadata/NodeServiceTest.java b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/tests/metadata/NodeServiceTest.java index 76f3f491..add86c16 100644 --- a/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/tests/metadata/NodeServiceTest.java +++ b/apix-integrationtests/alfresco/src/main/java/eu/xenit/apix/tests/metadata/NodeServiceTest.java @@ -270,14 +270,14 @@ public void TestGetMetadata() { NodeMetadata metadatas = service.getMetadata(c.apix(roots.iterator().next())); logger.debug(metadatas.toString().replaceAll(",", ",\n")); - assertEquals(c.apix(roots.iterator().next()), metadatas.id); + assertEquals(c.apix(roots.iterator().next()), metadatas.getId()); - assertTrue(metadatas.properties.containsKey(c.apix(ContentModel.PROP_NAME))); + assertTrue(metadatas.getProperties().containsKey(c.apix(ContentModel.PROP_NAME))); } private Boolean nodeIsInMetaList(NodeRef node, List metadatas) { for (NodeMetadata metadata : metadatas) { - if (metadata.id.equals(node.toString())) { + if (metadata.getId().equals(node.toString())) { return true; } } diff --git a/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFile.java b/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFile.java index c11f0867..2da86883 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFile.java +++ b/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFile.java @@ -17,6 +17,17 @@ public ConfigurationFile(NodeRef nodeRef, NodeMetadata metadata) { this.metadata = metadata; } + public ConfigurationFile() { + } + + public ConfigurationFile(String content, NodeRef nodeRef, NodeMetadata metadata, NodePath path, Object parsedContent) { + this.content = content; + this.nodeRef = nodeRef; + this.metadata = metadata; + this.path = path; + this.parsedContent = parsedContent; + } + public NodeRef getNodeRef() { return nodeRef; } diff --git a/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFileFlags.java b/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFileFlags.java index 492c7415..1cb5c49d 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFileFlags.java +++ b/apix-interface/src/main/java/eu/xenit/apix/configuration/ConfigurationFileFlags.java @@ -8,8 +8,11 @@ public class ConfigurationFileFlags { public boolean addMetadata; public boolean addNodeRef; + public ConfigurationFileFlags() { + } + public ConfigurationFileFlags(boolean addContent, boolean addPath, boolean addParsedContent, boolean addMetadata, - boolean addNodeRef) { + boolean addNodeRef) { this.addContent = addContent; this.addPath = addPath; this.addParsedContent = addParsedContent; diff --git a/apix-interface/src/main/java/eu/xenit/apix/configuration/Configurations.java b/apix-interface/src/main/java/eu/xenit/apix/configuration/Configurations.java index 795b9021..799219de 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/configuration/Configurations.java +++ b/apix-interface/src/main/java/eu/xenit/apix/configuration/Configurations.java @@ -7,6 +7,9 @@ public class Configurations { private List files; + public Configurations() { + } + public Configurations(List files) { this.files = new ArrayList<>(files); this.files.sort(new ConfigurationFileComparator()); diff --git a/apix-interface/src/main/java/eu/xenit/apix/data/NodeRef.java b/apix-interface/src/main/java/eu/xenit/apix/data/NodeRef.java index 0fd74ee3..fc0bc06e 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/data/NodeRef.java +++ b/apix-interface/src/main/java/eu/xenit/apix/data/NodeRef.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; + import java.io.Serializable; /** @@ -14,9 +15,11 @@ public class NodeRef implements Serializable { private static final String FORWARD_SLASH = "/"; private static final String SPACESTORE_DIVIDER = "://"; - private String value; + public NodeRef() { + } + @JsonCreator public NodeRef(String s) { value = s; diff --git a/apix-interface/src/main/java/eu/xenit/apix/data/QName.java b/apix-interface/src/main/java/eu/xenit/apix/data/QName.java index cf8c5c69..84d9ec96 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/data/QName.java +++ b/apix-interface/src/main/java/eu/xenit/apix/data/QName.java @@ -1,7 +1,6 @@ package eu.xenit.apix.data; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.JsonValue; import java.io.Serializable; diff --git a/apix-interface/src/main/java/eu/xenit/apix/filefolder/NodePath.java b/apix-interface/src/main/java/eu/xenit/apix/filefolder/NodePath.java index 576f17da..9ce72315 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/filefolder/NodePath.java +++ b/apix-interface/src/main/java/eu/xenit/apix/filefolder/NodePath.java @@ -9,6 +9,14 @@ public class NodePath { private String displayPath; private String qnamePath; + public NodePath() { + } + + public NodePath(String displayPath, String qnamePath) { + this.displayPath = displayPath; + this.qnamePath = qnamePath; + } + public String getDisplayPath() { return displayPath; } diff --git a/apix-interface/src/main/java/eu/xenit/apix/node/NodeMetadata.java b/apix-interface/src/main/java/eu/xenit/apix/node/NodeMetadata.java index e11897da..af541cd6 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/node/NodeMetadata.java +++ b/apix-interface/src/main/java/eu/xenit/apix/node/NodeMetadata.java @@ -14,13 +14,15 @@ */ public class NodeMetadata { - public NodeRef id; - public QName type; // qname - public QName baseType; //qname - public long transactionId; - public Map> properties;//: { [k: string]: Translation[]; } - public List aspects; - //TODO: parent + private NodeRef id; + private QName type; // qname + private QName baseType; //qname + private long transactionId; + private Map> properties;//: { [k: string]: Translation[]; } + private List aspects; + + public NodeMetadata() { + } public NodeMetadata(NodeRef id, QName type, QName baseType, long transactionId, Map> properties, List aspects) { @@ -32,6 +34,55 @@ public NodeMetadata(NodeRef id, QName type, QName baseType, long transactionId, this.aspects = aspects; } + public NodeRef getId() { + return id; + } + + public void setId(NodeRef id) { + this.id = id; + } + + public QName getType() { + return type; + } + + public void setType(QName type) { + this.type = type; + } + + public QName getBaseType() { + return baseType; + } + + public void setBaseType(QName baseType) { + this.baseType = baseType; + } + + public long getTransactionId() { + return transactionId; + } + + public void setTransactionId(long transactionId) { + this.transactionId = transactionId; + } + + public Map> getProperties() { + return properties; + } + + public void setProperties(Map> properties) { + this.properties = properties; + } + //TODO: parent + + public List getAspects() { + return aspects; + } + + public void setAspects(List aspects) { + this.aspects = aspects; + } + @Override public String toString() { return "NodeMetadata{" + diff --git a/apix-interface/src/main/java/eu/xenit/apix/workflow/model/WorkflowOrTaskChanges.java b/apix-interface/src/main/java/eu/xenit/apix/workflow/model/WorkflowOrTaskChanges.java index 00ec2423..f90c9f45 100644 --- a/apix-interface/src/main/java/eu/xenit/apix/workflow/model/WorkflowOrTaskChanges.java +++ b/apix-interface/src/main/java/eu/xenit/apix/workflow/model/WorkflowOrTaskChanges.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; + import java.util.Map; public class WorkflowOrTaskChanges { @@ -13,6 +14,9 @@ public WorkflowOrTaskChanges(@JsonProperty("propertiesToSet") Map getPropertiesToSet() { return propertiesToSet; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/AlfredApiRestServletContext.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/AlfredApiRestServletContext.java index 37d9d2e7..27308d08 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/AlfredApiRestServletContext.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/AlfredApiRestServletContext.java @@ -4,11 +4,37 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.ObjectMapper; +import com.gradecak.alfresco.mvc.annotation.EnableAlfrescoMvcAop; import com.gradecak.alfresco.mvc.rest.config.DefaultAlfrescoMvcServletContextConfiguration; import eu.xenit.apix.rest.jackson.Jackson2ApixNodeRefDeserializer; import eu.xenit.apix.rest.jackson.Jackson2ApixNodeRefSerializer; import eu.xenit.apix.rest.jackson.Jackson2ApixQnameDeserializer; import eu.xenit.apix.rest.jackson.Jackson2ApixQnameSerializer; +import eu.xenit.apix.rest.staging.workflow.WorkflowWebscript; +import eu.xenit.apix.rest.v0.categories.ClassificationGetWebscript; +import eu.xenit.apix.rest.v0.dictionary.DictionaryServiceChecksumWebscript; +import eu.xenit.apix.rest.v0.metadata.MetadataBulkWebscript; +import eu.xenit.apix.rest.v0.metadata.MetadataGetWebscript; +import eu.xenit.apix.rest.v0.metadata.MetadataPostWebscript; +import eu.xenit.apix.rest.v0.search.SearchWebScript0; +import eu.xenit.apix.rest.v1.GeneralWebscript; +import eu.xenit.apix.rest.v1.bulk.BulkWebscript1; +import eu.xenit.apix.rest.v1.categories.CategoryWebScript1; +import eu.xenit.apix.rest.v1.configuration.ConfigurationWebscript1; +import eu.xenit.apix.rest.v1.dictionary.DictionaryWebScript1; +import eu.xenit.apix.rest.v1.nodes.NodesWebscript1; +import eu.xenit.apix.rest.v1.people.PeopleWebscript1; +import eu.xenit.apix.rest.v1.properties.PropertiesWebScript1; +import eu.xenit.apix.rest.v1.search.SearchWebScript1; +import eu.xenit.apix.rest.v1.sites.SitesWebscript1; +import eu.xenit.apix.rest.v1.temp.LogsWebscript; +import eu.xenit.apix.rest.v1.temp.WIPWebscript; +import eu.xenit.apix.rest.v1.translation.TranslationsWebscript1; +import eu.xenit.apix.rest.v1.versionhistory.VersionHistoryWebScript1; +import eu.xenit.apix.rest.v1.workingcopies.WorkingcopiesWebscript1; +import eu.xenit.apix.rest.v2.groups.GroupsWebscript; +import eu.xenit.apix.rest.v2.nodes.NodesWebscriptV2; +import eu.xenit.apix.rest.v2.people.PeopleWebscript; import eu.xenit.apix.search.json.SearchNodeJsonParser; import org.alfresco.rest.framework.jacksonextensions.RestJsonModule; import org.alfresco.service.namespace.NamespaceService; @@ -27,9 +53,37 @@ @Configuration @EnableWebMvc -@PropertySource(value = { "classpath:application.properties" }) +@PropertySource(value = {"classpath:application.properties"}) // should pick up other controllers from the same package by default -@ComponentScan(basePackages = { "eu.xenit.apix" }) +@ComponentScan(basePackages = {"eu.xenit.apix"}) +@EnableAlfrescoMvcAop(basePackageClasses = { + BulkWebscript1.class, + CategoryWebScript1.class, + ConfigurationWebscript1.class, + ClassificationGetWebscript.class, + DictionaryWebScript1.class, + DictionaryServiceChecksumWebscript.class, + GeneralWebscript.class, + GroupsWebscript.class, + LogsWebscript.class, + MetadataPostWebscript.class, + MetadataBulkWebscript.class, + MetadataGetWebscript.class, + NodesWebscriptV2.class, + NodesWebscript1.class, + PropertiesWebScript1.class, + PeopleWebscript1.class, + PeopleWebscript1.class, + PeopleWebscript.class, + SearchWebScript1.class, + SearchWebScript0.class, + SitesWebscript1.class, + TranslationsWebscript1.class, + VersionHistoryWebScript1.class, + WorkingcopiesWebscript1.class, + WorkflowWebscript.class, + WIPWebscript.class +}) public class AlfredApiRestServletContext extends DefaultAlfrescoMvcServletContextConfiguration { @@ -40,8 +94,8 @@ public AlfredApiRestServletContext(RestJsonModule alfrescoRestJsonModule, Namesp @Override protected List> customJsonDeserializers() { return Arrays.asList( - new Jackson2ApixNodeRefDeserializer(), - new Jackson2ApixQnameDeserializer() + new Jackson2ApixNodeRefDeserializer(), + new Jackson2ApixQnameDeserializer() ); } @@ -74,7 +128,7 @@ public boolean isMultipart(HttpServletRequest request) { return false; } String contentType = request.getContentType(); - return (contentType != null &&contentType.toLowerCase().startsWith("multipart/")); + return (contentType != null && contentType.toLowerCase().startsWith("multipart/")); } }; resolver.setMaxUploadSize(-1); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowClaimsBody.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowClaimsBody.java new file mode 100644 index 00000000..fafc186d --- /dev/null +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowClaimsBody.java @@ -0,0 +1,30 @@ +package eu.xenit.apix.rest.staging.workflow; + +public class WorkflowClaimsBody { + private String id; + private String userName; + + public WorkflowClaimsBody(String id, String userName) { + this.id = id; + this.userName = userName; + } + + public WorkflowClaimsBody() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } +} diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowReleaseBody.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowReleaseBody.java new file mode 100644 index 00000000..93eed4f4 --- /dev/null +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowReleaseBody.java @@ -0,0 +1,27 @@ +package eu.xenit.apix.rest.staging.workflow; + +public class WorkflowReleaseBody { + private String id; + + public WorkflowReleaseBody() { + } + + public WorkflowReleaseBody(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "WorkflowReleaseBody{" + + "id='" + id + '\'' + + '}'; + } +} diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowWebscript.java index f4ef63dc..6a70a467 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/staging/workflow/WorkflowWebscript.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.staging.workflow; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.workflow.IWorkflowService; import eu.xenit.apix.workflow.model.Task; import eu.xenit.apix.workflow.model.Workflow; @@ -9,11 +10,6 @@ import eu.xenit.apix.workflow.search.TaskOrWorkflowSearchResult; import eu.xenit.apix.workflow.search.TaskSearchQuery; import eu.xenit.apix.workflow.search.WorkflowSearchQuery; -import java.io.Serializable; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; import org.apache.http.HttpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,6 +25,12 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.io.Serializable; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + @RestController public class WorkflowWebscript { private static final Logger logger = LoggerFactory.getLogger(WorkflowWebscript.class); @@ -38,7 +40,7 @@ public class WorkflowWebscript { public WorkflowWebscript(@Qualifier("eu.xenit.apix.workflow.IWorkflowService") IWorkflowService workflowService) { this.workflowService = workflowService; } - + @AlfrescoTransaction(readOnly = true) @GetMapping( value = "/staging/workflows/definitions", produces = MediaType.APPLICATION_JSON_VALUE @@ -55,11 +57,13 @@ public ResponseEntity getWorkflowDefinitions( return responseFrom(new WorkflowDefinitionList(definitions)); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/workflows/definition/{name}") public ResponseEntity getWorkflowDefinition(@PathVariable final String name) { return responseFrom(workflowService.getWorkflowDefinition(name)); } + @AlfrescoTransaction @PostMapping(value = "/workflows/search") public ResponseEntity workflowsActiviti(@RequestBody final WorkflowSearchQuery query) { TaskOrWorkflowSearchResult result = workflowService.searchWorkflows(query); @@ -68,81 +72,84 @@ public ResponseEntity workflowsActiviti(@RequestBody return responseFrom(result); } + @AlfrescoTransaction @PostMapping(value = "/tasks/search") public ResponseEntity tasksActiviti(@RequestBody final TaskSearchQuery query) { return responseFrom(workflowService.searchTasks(query)); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/workflows/{id}") public ResponseEntity workflow(@PathVariable final String id) { return responseFrom(workflowService.getWorkflowInfo(id)); } + @AlfrescoTransaction @PostMapping(value = "/workflows/{id}/start") public ResponseEntity startWorkflow(@PathVariable final String id, @RequestBody final Map variables) { logger.debug("variables: {}", variables); return responseFrom(workflowService.startWorkflow(id, variables)); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/tasks/{id}") public ResponseEntity task(@PathVariable final String id) { responseFrom(workflowService.getTaskInfo(id)); return ResponseEntity.ok().build(); } + @AlfrescoTransaction @PutMapping(value = "/workflows/{id}") public ResponseEntity updateWorkflow(@PathVariable final String id, - @RequestBody final WorkflowOrTaskChanges changes) { + @RequestBody final WorkflowOrTaskChanges changes) { return responseFrom(workflowService.updateWorkflow(id, changes)); } + @AlfrescoTransaction @DeleteMapping(value = "/workflows/{id}") public ResponseEntity cancelWorkflow(@PathVariable final String id) { workflowService.cancelWorkflow(id); return ResponseEntity.ok().build(); } + @AlfrescoTransaction @PutMapping(value = "/tasks/{id}") - public ResponseEntity updateTask(@PathVariable final String id, - @RequestBody final WorkflowOrTaskChanges changes) { + public ResponseEntity updateTask(@PathVariable final String id, + @RequestBody final WorkflowOrTaskChanges changes) { try { return responseFrom(workflowService.updateTask(id, changes)); - } catch (Error ex) { + } catch (Exception ex) { return ResponseEntity.status(HttpStatus.SC_CONFLICT).build(); } } + @AlfrescoTransaction @PostMapping(value = "/staging/tasks/claim") - public ResponseEntity claimTask(@RequestBody final Map body) { - logger.debug("Input: {}", body); - String id = body.get("id"); - String userName = body.get("userName"); - + public ResponseEntity claimTask(@RequestBody final WorkflowClaimsBody workflowClaimsBody) { Task wfTask; - if (userName != null) { - logger.debug("Setting owner of task with id {} to {}", id, userName); - wfTask = workflowService.claimWorkflowTask(id, userName); + if (workflowClaimsBody.getUserName() != null) { + logger.debug("Setting owner of task with id {} to {}", workflowClaimsBody.getId(), workflowClaimsBody.getUserName()); + wfTask = workflowService.claimWorkflowTask(workflowClaimsBody.getId(), workflowClaimsBody.getUserName()); } else { logger.debug("Setting owner of task with id "); - wfTask = workflowService.claimWorkflowTask(id); + wfTask = workflowService.claimWorkflowTask(workflowClaimsBody.getId()); } return responseFrom(wfTask); } + @AlfrescoTransaction @PostMapping(value = "/staging/tasks/release") - public ResponseEntity releaseTask(@RequestBody final Map body) { - logger.debug("Setting owner of task {}", body); - String id = body.get("id"); - Task wfTask = workflowService.releaseWorkflowTask(id); + public ResponseEntity releaseTask(@RequestBody final WorkflowReleaseBody workflowReleaseBody) { + logger.debug("Setting owner of task {}", workflowReleaseBody); + Task wfTask = workflowService.releaseWorkflowTask(workflowReleaseBody.getId()); return responseFrom(wfTask); } + @AlfrescoTransaction @PostMapping(value = "/staging/tasks/{id}/end/{transition}") public void transitionTask(@PathVariable String id, @PathVariable String transition) { workflowService.endTask(id, transition); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/staging/workflows/generate/{amount}/{username}") public void generateWorkflow(@PathVariable final int amount, @PathVariable final String username) { workflowService.GenerateWorkflows(amount, username); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/categories/ClassificationGetWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/categories/ClassificationGetWebscript.java index 67b42397..0bc99c70 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/categories/ClassificationGetWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/categories/ClassificationGetWebscript.java @@ -1,16 +1,17 @@ package eu.xenit.apix.rest.v0.categories; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.categories.Category; import eu.xenit.apix.categories.ICategoryService; import eu.xenit.apix.data.QName; -import java.util.List; - import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @RestController public class ClassificationGetWebscript { @@ -20,6 +21,7 @@ public ClassificationGetWebscript(ICategoryService catService) { this.catService = catService; } + @AlfrescoTransaction(readOnly = true) @GetMapping( value = "/classification/{aspectQName}", produces = MediaType.APPLICATION_JSON_VALUE diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/dictionary/DictionaryServiceChecksumWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/dictionary/DictionaryServiceChecksumWebscript.java index e30cbae0..1dc5c1b8 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/dictionary/DictionaryServiceChecksumWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/dictionary/DictionaryServiceChecksumWebscript.java @@ -1,14 +1,15 @@ package eu.xenit.apix.rest.v0.dictionary; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.dictionary.IDictionaryService; -import java.util.Collections; -import java.util.Map; - import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Collections; +import java.util.Map; + @RestController public class DictionaryServiceChecksumWebscript { @@ -18,6 +19,7 @@ public DictionaryServiceChecksumWebscript(IDictionaryService service) { this.service = service; } + @AlfrescoTransaction(readOnly = true) @GetMapping( value = "/dictionary/checksum", produces = MediaType.APPLICATION_JSON_VALUE diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataBulkWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataBulkWebscript.java index 48b0e762..ab10a20c 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataBulkWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataBulkWebscript.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v0.metadata; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.node.INodeService; import eu.xenit.apix.permissions.IPermissionService; @@ -23,6 +24,7 @@ public MetadataBulkWebscript(INodeService service, IPermissionService permission this.permissionService = permissionService; } + @AlfrescoTransaction @PostMapping( value = "/eu/xenit/metadata/bulk", produces = MediaType.APPLICATION_JSON_VALUE diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataGetWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataGetWebscript.java index f7493635..99bd8357 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataGetWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataGetWebscript.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v0.metadata; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.node.INodeService; import eu.xenit.apix.permissions.IPermissionService; @@ -18,7 +19,7 @@ public MetadataGetWebscript(INodeService service, IPermissionService permissionS this.service = service; this.permissionService = permissionService; } - + @AlfrescoTransaction(readOnly = true) @GetMapping( value = "/eu/xenit/metadata", produces = MediaType.APPLICATION_JSON_VALUE diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataPostWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataPostWebscript.java index 7ac68299..c0edf019 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataPostWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/MetadataPostWebscript.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v0.metadata; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.node.INodeService; import eu.xenit.apix.permissions.IPermissionService; @@ -21,6 +22,7 @@ public MetadataPostWebscript(INodeService service, IPermissionService permission this.permissionService = permissionService; } + @AlfrescoTransaction @PostMapping( value = "/eu/xenit/metadata", produces = MediaType.APPLICATION_JSON_VALUE diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/NodeMetadataV0.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/NodeMetadataV0.java index 1d0b770d..7504185c 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/NodeMetadataV0.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/metadata/NodeMetadataV0.java @@ -5,6 +5,7 @@ import eu.xenit.apix.node.NodeMetadata; import eu.xenit.apix.permissions.IPermissionService; import eu.xenit.apix.permissions.PermissionValue; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -16,21 +17,20 @@ */ public class NodeMetadataV0 { - public String id; - public String type; // qname + public boolean canEditMetadata; // TODO: remove + private String id; + private String type; // qname //public String qnamePath;// Whats difference between qname and qnamepath //public String icon16; // REMOVE //public String icon32; // REMOVE //public String mimetype; // REMOVE //public boolean isVersioned; // REMOVE - public long transactionId; + private long transactionId; //TODO: cleanup - public Map> properties;//: { [k: string]: Translation[]; } - public List aspects; + private Map> properties;//: { [k: string]: Translation[]; } //TODO: associations //TODO: parent - - public boolean canEditMetadata; // TODO: remove + private List aspects; //public NodeAssociation[] associations; @@ -39,13 +39,13 @@ public class NodeMetadataV0 { public static NodeMetadataV0 FromV1(NodeMetadata m, IPermissionService permissionService) { NodeMetadataV0 ret = new NodeMetadataV0(); - ret.id = m.id.getValue(); - ret.type = m.type.getValue(); - ret.transactionId = m.transactionId; + ret.id = m.getId().getValue(); + ret.type = m.getType().getValue(); + ret.transactionId = m.getTransactionId(); ret.properties = new HashMap<>(); ret.aspects = new ArrayList<>(); - for (Map.Entry> e : m.properties.entrySet()) { + for (Map.Entry> e : m.getProperties().entrySet()) { List ts = null; if (e != null) { ts = new ArrayList<>(); @@ -56,17 +56,65 @@ public static NodeMetadataV0 FromV1(NodeMetadata m, IPermissionService permissio ret.properties.put(e.getKey().getValue(), ts); } - for (QName a : m.aspects) { + for (QName a : m.getAspects()) { ret.aspects.add(a.getValue()); } - Map perms = permissionService.getPermissions(m.id); + Map perms = permissionService.getPermissions(m.getId()); ret.canEditMetadata = perms.containsKey(IPermissionService.WRITE) && perms.get(IPermissionService.WRITE) == PermissionValue.ALLOW; return ret; } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public long getTransactionId() { + return transactionId; + } + + public void setTransactionId(long transactionId) { + this.transactionId = transactionId; + } + + public Map> getProperties() { + return properties; + } + + public void setProperties(Map> properties) { + this.properties = properties; + } + + public List getAspects() { + return aspects; + } + + public void setAspects(List aspects) { + this.aspects = aspects; + } + + public boolean isCanEditMetadata() { + return canEditMetadata; + } + + public void setCanEditMetadata(boolean canEditMetadata) { + this.canEditMetadata = canEditMetadata; + } + @Override public String toString() { return "NodeMetadata{" + diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/search/SearchWebScript0.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/search/SearchWebScript0.java index 7bb1ab91..ec03d3fb 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/search/SearchWebScript0.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v0/search/SearchWebScript0.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v0.search; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.search.ISearchService; import eu.xenit.apix.search.SearchQueryResult; import org.slf4j.Logger; @@ -19,6 +20,7 @@ public SearchWebScript0(ISearchService service) { this.service = service; } + @AlfrescoTransaction @PostMapping( value = "/eu/xenit/search", produces = MediaType.APPLICATION_JSON_VALUE diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/ApixV1Webscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/ApixV1Webscript.java index e85f2a71..a2086e4e 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/ApixV1Webscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/ApixV1Webscript.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v1; + import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.filefolder.IFileFolderService; import eu.xenit.apix.node.ChildParentAssociation; @@ -63,24 +64,24 @@ protected List nodeRefToNodeInfo(NodeInfoRequest nodeInfoRequest, } protected NodeInfo nodeRefToNodeInfo(NodeRef nodeRef, IFileFolderService fileFolderService, - INodeService nodeService, IPermissionService permissionService) { + INodeService nodeService, IPermissionService permissionService) { return nodeRefToNodeInfo(nodeRef, fileFolderService, nodeService, permissionService, true, true, true, true, true, true, true, true); } protected NodeInfo nodeRefToNodeInfo(NodeRef nodeRef, - IFileFolderService fileFolderService, - INodeService nodeService, - IPermissionService permissionService, - boolean retrievePath, - boolean retrieveMetadata, - boolean retrievePermissions, - boolean retrieveAssocs, - boolean retrieveChildAssocs, - boolean retrieveParentAssocs, - boolean retrieveTargetAssocs, - boolean retrieveSourceAssocs) { + IFileFolderService fileFolderService, + INodeService nodeService, + IPermissionService permissionService, + boolean retrievePath, + boolean retrieveMetadata, + boolean retrievePermissions, + boolean retrieveAssocs, + boolean retrieveChildAssocs, + boolean retrieveParentAssocs, + boolean retrieveTargetAssocs, + boolean retrieveSourceAssocs) { if (!permissionService.hasPermission(nodeRef, IPermissionService.READ)) { logger.warn("Excluding node {} from results due to insufficient permissions", nodeRef); return null; diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/GeneralWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/GeneralWebscript.java index d06d20a6..f70edcf8 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/GeneralWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/GeneralWebscript.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.version.IVersionService; import eu.xenit.apix.version.VersionDescription; @@ -9,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController; @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.GeneralWebscript") +@RestController public class GeneralWebscript extends ApixV1Webscript { private final IVersionService versionService; @@ -18,6 +19,7 @@ public GeneralWebscript(IVersionService versionService) { this.versionService = versionService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/version") public ResponseEntity getApixVersion() { return writeJsonResponse(versionService.getVersionDescription()); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/bulk/BulkWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/bulk/BulkWebscript1.java index fe93596c..0a8569f7 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/bulk/BulkWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/bulk/BulkWebscript1.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.webscript.DispatcherWebscript; import eu.xenit.apix.rest.v1.ApixV1Webscript; import eu.xenit.apix.rest.v1.bulk.request.BulkHttpServletRequest; @@ -30,7 +31,7 @@ import java.util.stream.Collectors; -@RestController("eu.xenit.apix.rest.v1.BulkWebscript") +@RestController public class BulkWebscript1 extends ApixV1Webscript { private static final Logger logger = LoggerFactory.getLogger(BulkWebscript1.class); @@ -45,6 +46,7 @@ public BulkWebscript1(ServiceRegistry serviceRegistry, this.dispatcherWebscript = dispatcherWebscript; } + @AlfrescoTransaction @PostMapping(value = "/v1/bulk") public ResponseEntity> bulk(@RequestBody final BulkRequest[] bulkRequests, final HttpServletRequest req) { diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/categories/CategoryWebScript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/categories/CategoryWebScript1.java index 71bd235a..1cfd9bad 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/categories/CategoryWebScript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/categories/CategoryWebScript1.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1.categories; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.categories.Category; import eu.xenit.apix.categories.ICategoryService; @@ -13,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController; @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.categories.CategoryWebScript1") +@RestController public class CategoryWebScript1 extends ApixV1Webscript { private final ICategoryService categoryService; @@ -22,6 +23,7 @@ public CategoryWebScript1(ICategoryService categoryService) { this.categoryService = categoryService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/category/aspect/{qname}") public ResponseEntity getCategoriesForAspect(@PathVariable final String qname) { QName apixQName = new QName(qname); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/configuration/ConfigurationWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/configuration/ConfigurationWebscript1.java index 6e4dbef2..75f361ff 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/configuration/ConfigurationWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/configuration/ConfigurationWebscript1.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.ObjectMapper; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.configuration.ConfigurationFileFlags; import eu.xenit.apix.configuration.ConfigurationService; @@ -25,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController; @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.configuration.ConfigurationWebscript1") +@RestController public class ConfigurationWebscript1 extends ApixV1Webscript { private static final Logger log = LoggerFactory.getLogger(ConfigurationWebscript1.class); @@ -43,7 +44,7 @@ public ConfigurationWebscript1( mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/configuration", consumes = {"application/js"}, produces = {"application/js"}) public ResponseEntity getJsConfigurationFiles( @RequestParam(defaultValue = "content,nodeRef", required = false) String[] fields, @@ -66,7 +67,7 @@ public ResponseEntity getJsConfigurationFiles( mapper.writeValueAsString(configurations))); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/configuration" , consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/dictionary/DictionaryWebScript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/dictionary/DictionaryWebScript1.java index 021c431e..7f1551c7 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/dictionary/DictionaryWebScript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/dictionary/DictionaryWebScript1.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1.dictionary; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.data.QName; import eu.xenit.apix.dictionary.IDictionaryService; @@ -23,7 +24,7 @@ import javax.servlet.http.HttpServletRequest; @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.property.DictionaryWebScript1") +@RestController public class DictionaryWebScript1 extends ApixV1Webscript { private static final Logger logger = LoggerFactory.getLogger(DictionaryWebScript1.class); @@ -34,6 +35,7 @@ public DictionaryWebScript1( this.dictionaryService = dictionaryService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/properties/**") public ResponseEntity getPropertyDefinition(HttpServletRequest request) { QName qname = extractQNameFromUrlPath(request, "/v1/dictionary/properties/"); @@ -44,15 +46,15 @@ public ResponseEntity getPropertyDefinition(HttpServletRequest request) { return writeJsonResponse(propDef); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/properties") public ResponseEntity getProperties() { return writeJsonResponse(dictionaryService.getProperties()); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/types") - public ResponseEntity getSubTypeDefinitions(@RequestParam(defaultValue = "sys:base", required = false) - final String parent) { + public ResponseEntity getSubTypeDefinitions(@RequestParam(defaultValue = "sys:base", required = false) final String parent) { return writeJsonResponse( dictionaryService.GetSubTypeDefinitions( new QName(parent), true @@ -60,6 +62,7 @@ public ResponseEntity getSubTypeDefinitions(@RequestParam(defaultValue = ); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/types/**") public ResponseEntity getTypeDefinition(HttpServletRequest request) { QName qname = extractQNameFromUrlPath(request, "/v1/dictionary/types/"); @@ -71,6 +74,7 @@ public ResponseEntity getTypeDefinition(HttpServletRequest request) { return writeJsonResponse(classDef); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/aspects/**") public ResponseEntity getAspectDefinition(HttpServletRequest request) { QName qname = extractQNameFromUrlPath(request, "/v1/dictionary/aspects/"); @@ -82,11 +86,13 @@ public ResponseEntity getAspectDefinition(HttpServletRequest request) { return writeJsonResponse(classDef); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/aspects") public ResponseEntity getAspects() { return writeJsonResponse(dictionaryService.getAspects()); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/dictionary/namespaces") public ResponseEntity getNamespaces() { return writeJsonResponse(dictionaryService.getNamespaces()); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeAclsOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeAclsOptions.java index 6dcb374f..c59a1d2e 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeAclsOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeAclsOptions.java @@ -10,8 +10,12 @@ public class ChangeAclsOptions { private boolean inheritFromParent; private Set ownAccessList; - public ChangeAclsOptions( boolean inheritFromParent, - Set ownAccessList) { + public ChangeAclsOptions() { + } + + @JsonCreator + public ChangeAclsOptions(@JsonProperty("inheritFromParent") boolean inheritFromParent, + @JsonProperty("ownAccessList") Set ownAccessList) { this.ownAccessList = ownAccessList; this.inheritFromParent = inheritFromParent; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeParentOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeParentOptions.java index 14d2f3ba..38b31df2 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeParentOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/ChangeParentOptions.java @@ -1,5 +1,8 @@ package eu.xenit.apix.rest.v1.nodes; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + /** * Created by Michiel Huygen on 12/05/2016. */ @@ -8,18 +11,19 @@ class ChangeParentOptions { private String parent; - public ChangeParentOptions(String parent) { + @JsonCreator + public ChangeParentOptions(@JsonProperty("parent") String parent) { this.parent = parent; } public ChangeParentOptions() { } - public void setParent(String parent) { - this.parent = parent; - } - public String getParent() { return parent; } + + public void setParent(String parent) { + this.parent = parent; + } } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateAssociationOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateAssociationOptions.java index e96951d5..37a70cdf 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateAssociationOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateAssociationOptions.java @@ -7,17 +7,16 @@ * Created by Michiel Huygen on 23/05/2016. */ public class CreateAssociationOptions { + private NodeRef target; + private QName type = new QName("{http://www.alfresco.org/model/content/1.0}content"); + public CreateAssociationOptions(NodeRef target, QName type) { this.target = target; this.type = type; } - public CreateAssociationOptions() { } - private NodeRef target; - private QName type = new QName("{http://www.alfresco.org/model/content/1.0}content"); - public NodeRef getTarget() { return target; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateNodeOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateNodeOptions.java index 0d7bbce3..bc941cc5 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateNodeOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/CreateNodeOptions.java @@ -1,5 +1,7 @@ package eu.xenit.apix.rest.v1.nodes; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import eu.xenit.apix.data.QName; import org.alfresco.model.ContentModel; @@ -27,13 +29,14 @@ public CreateNodeOptions() { this.aspectsToAdd = new QName[0]; } - public CreateNodeOptions(String parent, - String name, - String type, - Map properties, - QName[] aspectsToAdd, - QName[] aspectsToRemove, - String copyFrom) { + @JsonCreator + public CreateNodeOptions(@JsonProperty("parent") String parent, + @JsonProperty("name") String name, + @JsonProperty("type") String type, + @JsonProperty("properties") Map properties, + @JsonProperty("aspectsToAdd") QName[] aspectsToAdd, + @JsonProperty("aspectsToRemove") QName[] aspectsToRemove, + @JsonProperty("copyFrom") String copyFrom) { this.parent = parent; this.name = name; this.type = type; @@ -52,60 +55,59 @@ public CreateNodeOptions(String parent, this.copyFrom = copyFrom; } - public void setParent(String parent) { - this.parent = parent; - } - - public void setName(String name) { - this.name = name; - } - - public void setType(String type) { - this.type = type; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - - public void setAspectsToAdd(QName[] aspectsToAdd) { - this.aspectsToAdd = aspectsToAdd; - } - - public void setAspectsToRemove(QName[] aspectsToRemove) { - this.aspectsToRemove = aspectsToRemove; - } - - public void setCopyFrom(String copyFrom) { - this.copyFrom = copyFrom; - } - - public String getParent() { return parent; } + public void setParent(String parent) { + this.parent = parent; + } + public String getName() { return name; } + public void setName(String name) { + this.name = name; + } + public String getType() { return type; } + public void setType(String type) { + this.type = type; + } + public Map getProperties() { return properties; } + public void setProperties(Map properties) { + this.properties = properties; + } + public QName[] getAspectsToAdd() { return aspectsToAdd; } + public void setAspectsToAdd(QName[] aspectsToAdd) { + this.aspectsToAdd = aspectsToAdd; + } + public QName[] getAspectsToRemove() { return aspectsToRemove; } + public void setAspectsToRemove(QName[] aspectsToRemove) { + this.aspectsToRemove = aspectsToRemove; + } + public String getCopyFrom() { return copyFrom; } + + public void setCopyFrom(String copyFrom) { + this.copyFrom = copyFrom; + } } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/InheritFromParent.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/InheritFromParent.java index 0b20c763..5ecda553 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/InheritFromParent.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/InheritFromParent.java @@ -1,5 +1,8 @@ package eu.xenit.apix.rest.v1.nodes; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + class InheritFromParent { private boolean inheritFromParent; @@ -7,7 +10,9 @@ class InheritFromParent { public InheritFromParent() { } - public InheritFromParent(boolean inheritFromParent) { + + @JsonCreator + public InheritFromParent(@JsonProperty("inheritFromParent") boolean inheritFromParent) { this.inheritFromParent = inheritFromParent; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodeInfo.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodeInfo.java index 38d3b366..8f0aff3c 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodeInfo.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodeInfo.java @@ -5,6 +5,7 @@ import eu.xenit.apix.node.NodeAssociations; import eu.xenit.apix.node.NodeMetadata; import eu.xenit.apix.permissions.PermissionValue; + import java.util.Map; /** @@ -18,6 +19,22 @@ public class NodeInfo { private NodeAssociations associations; private NodePath path; + public NodeInfo() { + + } + + public NodeInfo(NodeRef nodeRef, + NodeMetadata metadata, + Map permissions, + NodeAssociations associations, + NodePath path) { + this.noderef = nodeRef; + this.metadata = metadata; + this.permissions = permissions; + this.associations = associations; + this.path = path; + } + public NodeRef getNoderef() { return noderef; } @@ -57,20 +74,4 @@ public NodePath getPath() { public void setPath(NodePath path) { this.path = path; } - - public NodeInfo() { - - } - - public NodeInfo(NodeRef nodeRef, - NodeMetadata metadata, - Map permissions, - NodeAssociations associations, - NodePath path) { - this.noderef = nodeRef; - this.metadata = metadata; - this.permissions = permissions; - this.associations = associations; - this.path = path; - } } \ No newline at end of file diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodesWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodesWebscript1.java index 166a1c26..e18e4385 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodesWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/nodes/NodesWebscript1.java @@ -52,7 +52,7 @@ @AlfrescoTransaction -@RestController("eu.xenit.apix.rest.v1.NodesWebscript") +@RestController public class NodesWebscript1 extends ApixV1Webscript { private static final Logger logger = LoggerFactory.getLogger(NodesWebscript1.class); @@ -77,6 +77,7 @@ public NodesWebscript1(INodeService nodeService, IPermissionService permissionSe this.serviceRegistry = serviceRegistry; } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/{space}/{store}/{guid}/metadata") public ResponseEntity setMetadata(@PathVariable final String space, @PathVariable final String store, @PathVariable final String guid, @RequestBody final MetadataChanges changes) { @@ -87,7 +88,7 @@ public ResponseEntity setMetadata(@PathVariable final String space } return writeJsonResponse(nodeMetadata); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/metadata") public ResponseEntity getMetadata(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -101,7 +102,7 @@ public ResponseEntity getMetadata(@PathVariable String space, @Pat } } - + @AlfrescoTransaction @DeleteMapping(value = "/v1/nodes/{space}/{store}/{guid}") public ResponseEntity deleteNode(@PathVariable final String space, @PathVariable final String store, @PathVariable final String guid, @@ -119,7 +120,7 @@ public ResponseEntity deleteNode(@PathVariable final String space, @Path .status(HttpStatus.SC_NOT_FOUND) .body(String.format("Failed to delete node, node does not exist: %s", nodeRef.toString())); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/associations") public ResponseEntity getAssociations(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -130,6 +131,7 @@ public ResponseEntity getAssociations(@PathVariable String spa ); } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/{space}/{store}/{guid}/associations") public ResponseEntity createAssociation(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @@ -142,6 +144,7 @@ public ResponseEntity createAssociation(@PathVariable String space, @PathV return ResponseEntity.ok().build(); } + @AlfrescoTransaction @DeleteMapping(value = "/v1/nodes/{space}/{store}/{guid}/associations") public ResponseEntity deleteAssociation(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @RequestParam NodeRef target, @@ -154,7 +157,7 @@ public ResponseEntity deleteAssociation(@PathVariable String space, @PathV return ResponseEntity.ok().build(); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/associations/parents") public ResponseEntity> getParentAssociations(@PathVariable String space, @PathVariable String store, @@ -165,7 +168,7 @@ public ResponseEntity> getParentAssociations(@PathV ) ); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/associations/children") public ResponseEntity> getChildAssociations(@PathVariable String space, @PathVariable String store, @@ -176,7 +179,7 @@ public ResponseEntity> getChildAssociations(@PathVa ) ); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/associations/targets") public ResponseEntity> getSourcePeerAssociations(@PathVariable String space, @PathVariable String store, @@ -187,7 +190,7 @@ public ResponseEntity> getSourcePeerAssociations(@PathVari ) ); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/permissions") // It would seem permissions can always be retrieved? public ResponseEntity> getPermissions(@PathVariable String space, @@ -200,6 +203,7 @@ public ResponseEntity> getPermissions(@PathVariable ); } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/{space}/{store}/{guid}/permissions/authority/{authority}/permission/{permission}") public ResponseEntity setPermission(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @PathVariable String authority, @@ -210,6 +214,7 @@ public ResponseEntity setPermission(@PathVariable String space, @PathVaria return ResponseEntity.ok().build(); } + @AlfrescoTransaction @DeleteMapping(value = "/v1/nodes/{space}/{store}/{guid}/permissions/authority/{authority}/permission/{permission}") public ResponseEntity deletePermission(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @PathVariable String authority, @@ -217,7 +222,7 @@ public ResponseEntity deletePermission(@PathVariable String space, @PathVa this.permissionService.deletePermission(this.createNodeRef(space, store, guid), authority, permission); return ResponseEntity.ok().build(); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/acl") public ResponseEntity getAcls(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -228,6 +233,7 @@ public ResponseEntity getAcls(@PathVariable String space, @PathV ); } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/{space}/{store}/{guid}/acl/inheritFromParent") public void setInheritParentPermissions(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @RequestBody final InheritFromParent inherit) { @@ -236,6 +242,7 @@ public void setInheritParentPermissions(@PathVariable String space, @PathVariabl ); } + @AlfrescoTransaction @PutMapping(value = "/v1/nodes/{space}/{store}/{guid}/acl") public ResponseEntity setAcls(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @@ -260,7 +267,7 @@ public ResponseEntity setAcls(@PathVariable String space, @PathVariable St ); return ResponseEntity.ok().build(); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/path") public ResponseEntity getPath(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -270,7 +277,7 @@ public ResponseEntity getPath(@PathVariable String space, @PathVariabl ) ); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}") public ResponseEntity getAllInfoOfNode(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -295,6 +302,7 @@ public ResponseEntity getAllInfoOfNode(@PathVariable String space, @Path } } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/nodeInfo") public ResponseEntity getAllInfoOfNodes(@RequestBody final NodeInfoRequest nodeInfoRequest) { List nodeInfoList = this.nodeRefToNodeInfo(nodeInfoRequest, @@ -304,7 +312,7 @@ public ResponseEntity getAllInfoOfNodes(@RequestBody final NodeInfoReque ); return writeJsonResponse(nodeInfoList); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/ancestors") public ResponseEntity retrieveAncestors(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @@ -330,6 +338,7 @@ public ResponseEntity retrieveAncestors(@PathVariable String space, @Pat } } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes") public ResponseEntity createNode(@RequestBody final CreateNodeOptions createNodeOptions) { try { @@ -360,7 +369,7 @@ public ResponseEntity createNode(@RequestBody final CreateNodeOptions if (createNodeOptions.getType() != null) { type = new QName(createNodeOptions.getType()); } else if (createNodeOptions.getType() == null && createNodeOptions.getCopyFrom() != null) { - type = nodeService.getMetadata(copyFrom).type; + type = nodeService.getMetadata(copyFrom).getType(); } else { return ResponseEntity.status(HttpStatus.SC_BAD_REQUEST) .body("Please provide parameter \"type\" when creating a new node"); @@ -392,6 +401,7 @@ public ResponseEntity createNode(@RequestBody final CreateNodeOptions } } + @AlfrescoTransaction @PutMapping(value = "/v1/nodes/{space}/{store}/{guid}/parent") public ResponseEntity setParent(@PathVariable final String space, @PathVariable final String store, @PathVariable final String guid, @RequestBody ChangeParentOptions location) { @@ -410,7 +420,7 @@ public ResponseEntity setParent(@PathVariable final String space, @Path fileExistsException.getName()); } } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/comments") public ResponseEntity getComments(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @RequestParam(defaultValue = "0") int skipcount, @@ -428,6 +438,7 @@ public ResponseEntity getComments(@PathVariable String space, @PathVariable S return writeNotAuthorizedResponse(new AccessDeniedException(target.getValue())); } + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/{space}/{store}/{guid}/comments") public ResponseEntity addComment(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @RequestBody final Comment newComment) { @@ -438,7 +449,7 @@ public ResponseEntity addComment(@PathVariable String space, @PathVariable St Comment responseComment = commentService.addNewComment(target, newComment.getContent()); return writeJsonResponse(responseComment); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/comments/{space}/{store}/{guid}") public ResponseEntity getComment(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -454,6 +465,7 @@ public ResponseEntity getComment(@PathVariable String space, @PathVariable St } } + @AlfrescoTransaction @PutMapping(value = "/v1/comments/{space}/{store}/{guid}") public ResponseEntity updateComment(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @RequestBody final Comment newComment) { @@ -465,6 +477,7 @@ public ResponseEntity updateComment(@PathVariable String space, @PathVariable return writeJsonResponse(updatedComment); } + @AlfrescoTransaction @DeleteMapping(value = "/v1/comments/{space}/{store}/{guid}") public ResponseEntity deleteComment(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -475,7 +488,7 @@ public ResponseEntity deleteComment(@PathVariable String space, @PathVariable commentService.deleteComment(targetComment); return writeJsonResponse(String.format("Comment %s deleted", targetComment)); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/content") public ResponseEntity getContent(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { final NodeRef nodeRef = this.createNodeRef(space, store, guid); @@ -487,6 +500,7 @@ public ResponseEntity getContent(@PathVariable String space, @PathVariable St .body(new InputStreamResource(contentInputStream.getInputStream())); } + @AlfrescoTransaction @PutMapping(value = "/v1/nodes/{space}/{store}/{guid}/content") public ResponseEntity setContent(@PathVariable String space, @PathVariable String store, @PathVariable String guid, @RequestPart final MultipartFile file) { @@ -501,7 +515,7 @@ public ResponseEntity setContent(@PathVariable String space, @PathVariable return ResponseEntity.ok().build(); } - + @AlfrescoTransaction @DeleteMapping(value = "/v1/nodes/{space}/{store}/{guid}/content") public ResponseEntity deleteContent(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -514,7 +528,7 @@ public ResponseEntity deleteContent(@PathVariable String space, @PathVaria return ResponseEntity.ok().build(); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/exists") public ResponseEntity exists(@PathVariable String space, @PathVariable String store, @PathVariable String guid) { @@ -525,7 +539,7 @@ public ResponseEntity exists(@PathVariable String space, @PathVariable ); } - + @AlfrescoTransaction @PostMapping(value = "/v1/nodes/upload") public ResponseEntity uploadNode( @RequestParam(required = false) String type, diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/people/PeopleWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/people/PeopleWebscript1.java index 2e54e488..4ff512af 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/people/PeopleWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/people/PeopleWebscript1.java @@ -1,11 +1,10 @@ package eu.xenit.apix.rest.v1.people; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.people.IPeopleService; -import eu.xenit.apix.people.Person; import eu.xenit.apix.rest.v1.ApixV1Webscript; -import java.util.NoSuchElementException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; @@ -14,8 +13,10 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.NoSuchElementException; + @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.people.PeopleWebscript") +@RestController public class PeopleWebscript1 extends ApixV1Webscript { private static final Logger logger = LoggerFactory.getLogger(PeopleWebscript1.class); @@ -25,10 +26,11 @@ public PeopleWebscript1(IPeopleService personService) { this.personService = personService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/people/{space}/{store}/{guid}") public ResponseEntity getPerson(@PathVariable final String space, - @PathVariable final String store, - @PathVariable final String guid) { + @PathVariable final String store, + @PathVariable final String guid) { logger.debug("Asked person with guid: {}", guid); try { return writeJsonResponse( @@ -38,19 +40,20 @@ public ResponseEntity getPerson(@PathVariable final String space, ); } catch (NoSuchElementException noSuchElementException) { return ResponseEntity.status(org.springframework.http.HttpStatus.NOT_FOUND) - .body(noSuchElementException.getMessage()); + .body(noSuchElementException.getMessage()); } catch (IllegalArgumentException illegalArgumentException) { return ResponseEntity.status(org.springframework.http.HttpStatus.BAD_REQUEST) .body(illegalArgumentException.getMessage()); } } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/people") public ResponseEntity getPersonViaUserName(@RequestParam final String userName) { logger.debug("Asked person with name: {}", userName); - try{ + try { return writeJsonResponse( - personService.GetPerson(userName) + personService.GetPerson(userName) ); } catch (NoSuchElementException noSuchElementException) { return ResponseEntity.status(org.springframework.http.HttpStatus.NOT_FOUND) diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/properties/PropertiesWebScript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/properties/PropertiesWebScript1.java index 228ee19e..c1137461 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/properties/PropertiesWebScript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/properties/PropertiesWebScript1.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1.properties; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.data.QName; import eu.xenit.apix.dictionary.properties.IPropertyService; @@ -16,7 +17,7 @@ * @deprecated since Oct 2015, use DictionaryWebScript1 instead */ @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.property.PropertiesWebScript1") +@RestController @Deprecated(since = "Deprecated since Oct 2015, use DictionaryWebScript1 instead") public class PropertiesWebScript1 extends ApixV1Webscript { @@ -26,11 +27,12 @@ public PropertiesWebScript1(IPropertyService propertyService) { this.propertyService = propertyService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/properties/{qname}") //Use qname with slash to avoid //https://stackoverflow.com/questions/13482020/encoded-slash-2f-with-spring-requestmapping-path-param-gives-http-400 public ResponseEntity getPropertyDefinition(@PathVariable final QName qname, - @RequestParam(required = false) QName qnameWithSlash) { + @RequestParam(required = false) QName qnameWithSlash) { QName apixQName = qnameWithSlash != null ? qnameWithSlash : qname; PropertyDefinition propDef = propertyService.GetPropertyDefinition(apixQName); if (propDef == null) { diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/search/SearchWebScript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/search/SearchWebScript1.java index 8d0cb80c..4028fe1c 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/search/SearchWebScript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/search/SearchWebScript1.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1.search; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.rest.v1.ApixV1Webscript; import eu.xenit.apix.search.ISearchService; @@ -11,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController; @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.search.SearchWebScriptV1") +@RestController public class SearchWebScript1 extends ApixV1Webscript { private final ISearchService service; @@ -20,6 +21,7 @@ public SearchWebScript1(ISearchService service) { this.service = service; } + @AlfrescoTransaction @PostMapping(value = "/v1/search") public ResponseEntity execute(@RequestBody final SearchQuery query) { try { diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/sites/SitesWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/sites/SitesWebscript1.java index 8967a86d..7fd3a686 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/sites/SitesWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/sites/SitesWebscript1.java @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController; @AlfrescoTransaction -@RestController("eu.xenit.apix.rest.v1.SitesWebscript") +@RestController public class SitesWebscript1 extends ApixV1Webscript { private static final Logger logger = LoggerFactory.getLogger(SitesWebscript1.class); @@ -45,7 +45,7 @@ public SitesWebscript1(INodeService nodeService, IPermissionService permissionSe this.siteService = siteService; this.serviceRegistry = serviceRegistry; } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/sites/mySites") public ResponseEntity> getMySites( @RequestParam(required = false, defaultValue = "false") Boolean retrieveMetadata, diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/LogsWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/LogsWebscript.java index 5f02d19f..cd25bb1a 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/LogsWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/LogsWebscript.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1.temp; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.rest.v1.ApixV1Webscript; import java.io.File; @@ -13,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController; -@RestController("eu.xenit.apix.rest.v1.temp.LogsWebscript") +@RestController public class LogsWebscript extends ApixV1Webscript { private final String logPath; @@ -21,7 +22,7 @@ public class LogsWebscript extends ApixV1Webscript { public LogsWebscript(Environment env) { logPath = env.resolvePlaceholders("$CATALINA_HOME/logs/catalina.out"); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/tmp/log", produces = { MediaType.TEXT_PLAIN_VALUE }) @AlfrescoAuthentication(AuthenticationType.ADMIN) public ResponseEntity showLog(@RequestParam(defaultValue = "200") int lines) throws IOException { diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/WIPWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/WIPWebscript.java index 42eb379c..ca274bd8 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/WIPWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/temp/WIPWebscript.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v1.temp; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.WIP.IWIPService; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.rest.v1.ApixV1Webscript; @@ -18,10 +19,11 @@ public WIPWebscript(IWIPService wipService) { this.wipService = wipService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/nodes/{space}/{store}/{guid}/content/previews/pdf") public ResponseEntity getPreviewPdf(@PathVariable String space, - @PathVariable String store, - @PathVariable String guid) { + @PathVariable String store, + @PathVariable String guid) { final NodeRef nodeRef = new NodeRef(space, store, guid); //TODO: from /searchapp/download return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build(); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/translation/TranslationsWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/translation/TranslationsWebscript1.java index c9c4544a..ee4d0228 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/translation/TranslationsWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/translation/TranslationsWebscript1.java @@ -1,15 +1,17 @@ package eu.xenit.apix.rest.v1.translation; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.rest.v1.ApixV1Webscript; import eu.xenit.apix.translation.ITranslationService; import eu.xenit.apix.translation.Translations; -import java.util.Locale; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; -@RestController("eu.xenit.apix.rest.v1.translation.TranslationsWebscript1") +import java.util.Locale; + +@RestController public class TranslationsWebscript1 extends ApixV1Webscript { private final ITranslationService translationService; @@ -18,6 +20,7 @@ public TranslationsWebscript1(ITranslationService translationService) { this.translationService = translationService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/translations/{locale}/checksum") public ResponseEntity getChecksum(@PathVariable final String locale) { Locale language = Locale.forLanguageTag(locale); @@ -26,6 +29,7 @@ public ResponseEntity getChecksum(@PathVariable final Strin return writeJsonResponse(checksumObj); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/translations/{locale}") public ResponseEntity getTranslations(@PathVariable final String locale) { Locale language = Locale.forLanguageTag(locale); diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionHistoryWebScript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionHistoryWebScript1.java index d5fa226b..1c3738bd 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionHistoryWebScript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionHistoryWebScript1.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v1.versionhistory; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.data.QName; import eu.xenit.apix.rest.v1.ApixV1Webscript; @@ -22,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController; @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v1.versionhistory.VersionHistoryWebScript1") +@RestController public class VersionHistoryWebScript1 extends ApixV1Webscript { private static final Logger logger = LoggerFactory.getLogger(VersionHistoryWebScript1.class); @@ -39,7 +40,7 @@ public class VersionHistoryWebScript1 extends ApixV1Webscript { public VersionHistoryWebScript1(IVersionHistoryService versionHistoryService) { this.versionHistoryService = versionHistoryService; } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/versionhistory/{space}/{store}/{guid}/versions") public ResponseEntity getVersionHistory(@PathVariable final String space, @PathVariable final String store, @@ -49,7 +50,7 @@ public ResponseEntity getVersionHistory(@PathVariable final Stri versionHistoryService.GetVersionHistory(createNodeRef(space, store, guid)) ); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/versionhistory/{space}/{store}/{guid}/root") public ResponseEntity getVersionHistoryRoot(@PathVariable final String space, @PathVariable final String store, @@ -58,7 +59,7 @@ public ResponseEntity getVersionHistoryRoot(@PathVariable final String versionHistoryService.getRootVersion(createNodeRef(space, store, guid)) ); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/versionhistory/{space}/{store}/{guid}/head") public ResponseEntity getVersionHistoryHead(@PathVariable final String space, @PathVariable final String store, @@ -68,6 +69,7 @@ public ResponseEntity getVersionHistoryHead(@PathVariable final String ); } + @AlfrescoTransaction @DeleteMapping(value = "/v1/versionhistory/{space}/{store}/{guid}") //No method available to disable versioning. deleting will merely reset version history, // starting a new history upon a new version change @@ -78,6 +80,7 @@ public ResponseEntity deleteVersionHistory(@PathVariable final String space, return ResponseEntity.ok().build(); } + @AlfrescoTransaction @PutMapping(value = "/v1/versionhistory/{space}/{store}/{guid}") public ResponseEntity setVersionHistory(@PathVariable final String space, @PathVariable final String store, @@ -99,6 +102,7 @@ public ResponseEntity setVersionHistory(@PathVariable final String space, return ResponseEntity.ok().build(); } + @AlfrescoTransaction @PostMapping(value = "/v1/versionhistory/{space}/{store}/{guid}/versions/{label}/revert") public ResponseEntity revertVersionHistory(@PathVariable final String space, @PathVariable final String store, @@ -108,6 +112,7 @@ public ResponseEntity revertVersionHistory(@PathVariable final String space, return ResponseEntity.ok().build(); } + @AlfrescoTransaction @DeleteMapping(value = "/v1/versionhistory/{space}/{store}/{guid}/versions/{label}") public ResponseEntity deleteVersion(@PathVariable final String space, @PathVariable final String store, diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionOptions.java index cae4256b..285f1114 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/versionhistory/VersionOptions.java @@ -6,6 +6,15 @@ public class VersionOptions { private Boolean autoVersion; private Boolean autoVersionOnUpdateProps; + public VersionOptions() { + } + + public VersionOptions(Boolean initialVersion, Boolean autoVersion, Boolean autoVersionOnUpdateProps) { + this.initialVersion = initialVersion; + this.autoVersion = autoVersion; + this.autoVersionOnUpdateProps = autoVersionOnUpdateProps; + } + public Boolean getInitialVersion() { return initialVersion; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckinBody.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckinBody.java index 22a493f4..af53d8e9 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckinBody.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckinBody.java @@ -13,11 +13,14 @@ class CheckinBody { @JsonCreator public CheckinBody(@JsonProperty("comment") String comment, - @JsonProperty("majorVersion") boolean majorVersion) { + @JsonProperty("majorVersion") boolean majorVersion) { this.comment = comment; this.majorVersion = majorVersion; } + public CheckinBody() { + } + public String getComment() { return comment; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckoutBody.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckoutBody.java index 2ccb63f9..aaef1c6a 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckoutBody.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/CheckoutBody.java @@ -12,9 +12,12 @@ class CheckoutBody { public NodeRef original; public NodeRef destinationFolder; + public CheckoutBody() { + } + @JsonCreator public CheckoutBody(@JsonProperty("original") NodeRef original, - @JsonProperty("destinationFolder") NodeRef destinationFolder) { + @JsonProperty("destinationFolder") NodeRef destinationFolder) { this.original = original; this.destinationFolder = destinationFolder; } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/WorkingcopiesWebscript1.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/WorkingcopiesWebscript1.java index 536b4d81..31ab6b5b 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/WorkingcopiesWebscript1.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v1/workingcopies/WorkingcopiesWebscript1.java @@ -1,5 +1,6 @@ package eu.xenit.apix.rest.v1.workingcopies; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.node.INodeService; import eu.xenit.apix.rest.v1.ApixV1Webscript; @@ -12,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -@RestController("eu.xenit.apix.rest.v1.WorkingcopiesWebscript1") +@RestController public class WorkingcopiesWebscript1 extends ApixV1Webscript { private final INodeService nodeService; @@ -21,6 +22,7 @@ public WorkingcopiesWebscript1(INodeService nodeService) { this.nodeService = nodeService; } + @AlfrescoTransaction @PostMapping(value = "/v1/workingcopies") public ResponseEntity createWorkingcopy(@RequestBody CheckoutBody checkoutBody) { final NodeRef originalRef = checkoutBody.getOriginal(); @@ -38,6 +40,7 @@ public ResponseEntity createWorkingcopy(@RequestBody CheckoutBody checkoutBod return respondDoesNotExist(destinationRef); } + @AlfrescoTransaction @PostMapping(value = "/v1/workingcopies/{space}/{store}/{guid}/checkin") public ResponseEntity checkinWorkingcopy(@PathVariable final String space, @PathVariable final String store, @PathVariable final String guid, @@ -50,6 +53,7 @@ public ResponseEntity checkinWorkingcopy(@PathVariable final String space, @P return respondDoesNotExist(nodeRef); } + @AlfrescoTransaction @DeleteMapping(value = "/v1/workingcopies/{space}/{store}/{guid}") public ResponseEntity cancelWorkingcopy(@PathVariable final String space, @PathVariable final String store, @PathVariable final String guid) { @@ -60,7 +64,7 @@ public ResponseEntity cancelWorkingcopy(@PathVariable final String space, @Pa } return respondDoesNotExist(workingCopyRef); } - + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v1/workingcopies/{space}/{store}/{guid}/original") public ResponseEntity getWorkingCopySource(@PathVariable final String space, @PathVariable final String store, @PathVariable final String guid) { diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/GroupsWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/GroupsWebscript.java index d30b0cd8..2cc6d795 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/GroupsWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/GroupsWebscript.java @@ -1,14 +1,12 @@ package eu.xenit.apix.rest.v2.groups; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.groups.Group; import eu.xenit.apix.people.IPeopleService; import eu.xenit.apix.people.Person; import eu.xenit.apix.rest.v2.ApixV2Webscript; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import org.apache.http.HttpStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,9 +18,13 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v2.groups.GroupsWebscript") +@RestController public class GroupsWebscript extends ApixV2Webscript { private static final Logger logger = LoggerFactory.getLogger(GroupsWebscript.class); @@ -32,11 +34,13 @@ public GroupsWebscript(IPeopleService personService) { this.personService = personService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/groups") public ResponseEntity> GetAllGroups() { return writeJsonResponse(personService.GetGroups()); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/groups/{name}/people") public ResponseEntity GetPeopleOfGroup(@PathVariable final String name, @RequestParam(required = false) Boolean immediate) { @@ -50,9 +54,10 @@ public ResponseEntity GetPeopleOfGroup(@PathVariable final String name, return ResponseEntity.ok(people); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/groups/{name}/groups") public ResponseEntity GetGroupsOfGroup(@PathVariable final String name, - @RequestParam(required = false) Boolean immediate) { + @RequestParam(required = false) Boolean immediate) { if (immediate == null) { immediate = false; } @@ -64,9 +69,10 @@ public ResponseEntity GetGroupsOfGroup(@PathVariable final String name, return writeJsonResponse(groups); } + @AlfrescoTransaction @PutMapping(value = "/v2/groups/{name}/people") public ResponseEntity SetPeopleInGroup(@PathVariable final String name, - @RequestBody SetUsersInGroupOptions options) { + @RequestBody SetUsersInGroupOptions options) { // We want to replace all of the users in group {name} by a new list of users // We're going to avoid unlinking and re-linking the same user, because iterating over the list to check for // duplicates is going to be cheaper than unnecessarily invoking all of Alfresco's internal safety checking @@ -88,10 +94,10 @@ public ResponseEntity SetPeopleInGroup(@PathVariable final String name, return ResponseEntity.ok().build(); } - + @AlfrescoTransaction @PutMapping(value = "/v2/groups/{name}/groups") public ResponseEntity SetGroupsOfGroup(@PathVariable final String name, - @RequestBody SetSubgroupOptions options) { + @RequestBody SetSubgroupOptions options) { // We want to replace all of the subgroups of {name} by a new list of subgroups // We're going to avoid unlinking and re-linking the same group, because iterating over the list to check for // duplicates is going to be cheaper than unnecessarily invoking all of Alfresco's internal safety checking diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetSubgroupOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetSubgroupOptions.java index d449283e..891ced1f 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetSubgroupOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetSubgroupOptions.java @@ -12,8 +12,10 @@ public SetSubgroupOptions(@JsonProperty("subgroups") String[] subgroups) { this.subgroups = subgroups; } + public SetSubgroupOptions() { + } + public String[] getSubgroups() { return subgroups; } - } diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetUsersInGroupOptions.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetUsersInGroupOptions.java index 7aff12a5..25be3c3b 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetUsersInGroupOptions.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/groups/SetUsersInGroupOptions.java @@ -7,6 +7,9 @@ class SetUsersInGroupOptions { private String[] users; + public SetUsersInGroupOptions() { + } + @JsonCreator public SetUsersInGroupOptions(@JsonProperty("users") String[] users) { this.users = users; diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/nodes/NodesWebscriptV2.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/nodes/NodesWebscriptV2.java index 8740e68a..9f0effbe 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/nodes/NodesWebscriptV2.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/nodes/NodesWebscriptV2.java @@ -1,6 +1,7 @@ package eu.xenit.apix.rest.v2.nodes; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import eu.xenit.apix.data.NodeRef; import eu.xenit.apix.data.QName; import eu.xenit.apix.filefolder.IFileFolderService; @@ -29,7 +30,7 @@ import java.util.concurrent.atomic.AtomicInteger; @AlfrescoAuthentication -@RestController("eu.xenit.apix.rest.v2.NodesWebscript") +@RestController public class NodesWebscriptV2 extends ApixV2Webscript { private static final Logger logger = LoggerFactory.getLogger(NodesWebscriptV2.class); @@ -50,6 +51,7 @@ public NodesWebscriptV2(INodeService nodeService, IPermissionService permissionS this.serviceRegistry = serviceRegistry; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/nodes/{space}/{store}/{guid}") public ResponseEntity getAllInfo(@PathVariable String space, @PathVariable String store, @@ -62,6 +64,7 @@ public ResponseEntity getAllInfo(@PathVariable String space, return writeJsonResponse(nodeInfo); } + @AlfrescoTransaction @PostMapping(value = "/v2/nodes/nodeInfo") public ResponseEntity> getAllInfos(@RequestBody final NodeInfoRequest nodeInfoRequest) throws JSONException { List nodeInfoList = this.nodeRefToNodeInfo( @@ -72,6 +75,7 @@ public ResponseEntity> getAllInfos(@RequestBody final NodeInfoReq return writeJsonResponse(nodeInfoList); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/nodes/{space}/{store}/{guid}/permissions") public ResponseEntity> getPermissions(@PathVariable String space, @PathVariable String store, @@ -82,6 +86,7 @@ public ResponseEntity> getPermissions(@PathVariable ); } + @AlfrescoTransaction @PostMapping(value = "/v2/nodes") public ResponseEntity createNode(@RequestBody final CreateNodeOptions createNodeOptions) { final StringBuilder errorMessage = new StringBuilder(); @@ -117,7 +122,7 @@ public ResponseEntity createNode(@RequestBody final CreateNodeOptions createN if (createNodeOptions.getType() != null) { type = new QName(createNodeOptions.getType()); } else if (createNodeOptions.getCopyFrom() != null) { - type = nodeService.getMetadata(copyFrom).type; + type = nodeService.getMetadata(copyFrom).getType(); } else { errorCode.addAndGet(HttpStatus.SC_BAD_REQUEST); errorMessage.append( diff --git a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/people/PeopleWebscript.java b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/people/PeopleWebscript.java index a62b9df5..5bebba5c 100644 --- a/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/people/PeopleWebscript.java +++ b/apix-rest-v1/src/main/java/eu/xenit/apix/rest/v2/people/PeopleWebscript.java @@ -1,14 +1,11 @@ package eu.xenit.apix.rest.v2.people; import com.gradecak.alfresco.mvc.annotation.AlfrescoAuthentication; +import com.gradecak.alfresco.mvc.annotation.AlfrescoTransaction; import com.gradecak.alfresco.mvc.annotation.AuthenticationType; import eu.xenit.apix.people.IPeopleService; import eu.xenit.apix.people.Person; import eu.xenit.apix.rest.v2.ApixV2Webscript; -import java.util.ArrayList; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; @@ -16,8 +13,13 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Set; + @AlfrescoAuthentication(AuthenticationType.USER) -@RestController("eu.xenit.apix.rest.v2.people.PeopleWebscript") +@RestController public class PeopleWebscript extends ApixV2Webscript { private static final Logger logger = LoggerFactory.getLogger(PeopleWebscript.class); @@ -27,10 +29,11 @@ public PeopleWebscript(IPeopleService personService) { this.personService = personService; } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/people/id/{space}/{store}/{guid}") public ResponseEntity getPerson(@PathVariable final String space, - @PathVariable final String store, - @PathVariable final String guid) { + @PathVariable final String store, + @PathVariable final String guid) { logger.debug("Asked person with guid: {}", guid); try { return writeJsonResponse( @@ -45,22 +48,25 @@ public ResponseEntity getPerson(@PathVariable final String space, } } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/people") public ResponseEntity> getAllPeople() { return writeJsonResponse(personService.GetPeople()); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/people/-me-") public ResponseEntity getPersonCurrentUser() { return getPersonWithName("-me-"); } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/people/{name}") public ResponseEntity getPersonWithName(@PathVariable final String name) { logger.debug("Asked person with name: {}", name); - try{ + try { return writeJsonResponse( - personService.GetPerson(name) + personService.GetPerson(name) ); } catch (NoSuchElementException noSuchElementException) { return ResponseEntity.status(org.springframework.http.HttpStatus.NOT_FOUND) @@ -71,6 +77,7 @@ public ResponseEntity getPersonWithName(@PathVariable final String name) { } } + @AlfrescoTransaction(readOnly = true) @GetMapping(value = "/v2/ people/containergroups/{name}") public ResponseEntity> getContainerGroupsOf(@PathVariable final String name) { logger.debug("Asked containergroups for person with name: {}", name); diff --git a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.delete.desc.xml b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.delete.desc.xml index 767beea3..558adb88 100644 --- a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.delete.desc.xml +++ b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.delete.desc.xml @@ -2,9 +2,9 @@ Alfred API Delete /apix/{path} user - required + none - + true diff --git a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.get.desc.xml b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.get.desc.xml index a927e7d7..4fe7cea4 100644 --- a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.get.desc.xml +++ b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.get.desc.xml @@ -4,7 +4,7 @@ user none - + true diff --git a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.post.desc.xml b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.post.desc.xml index 71b5f35a..4bc20aa2 100644 --- a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.post.desc.xml +++ b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.post.desc.xml @@ -2,9 +2,9 @@ Alfred API Post /apix/{path} user - required + none - + true diff --git a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.put.desc.xml b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.put.desc.xml index aa9bd4e8..d7e5611d 100644 --- a/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.put.desc.xml +++ b/apix-rest-v1/src/main/resources/alfresco/extension/templates/webscripts/alfred/api.put.desc.xml @@ -2,9 +2,9 @@ Alfred API Put /apix/{path} user - required + none - + true diff --git a/build.gradle b/build.gradle index 947c549d..2c2a5eb0 100644 --- a/build.gradle +++ b/build.gradle @@ -41,11 +41,10 @@ subprojects { // This private repository provides Xenit with Alfresco enterprise artefacts. // External developers should replace it with their own library repository. maven { - name 'Xenit artifactory libs-release' - url 'https://artifactory.xenit.eu/artifactory/libs-release' + url 'https://artifacts.alfresco.com/nexus/content/groups/private' credentials { - username System.env.XENIT_ARTIFACTORY_USERNAME ?: property("eu.xenit.artifactory.username") - password System.env.XENIT_ARTIFACTORY_PASSWORD ?: property("eu.xenit.artifactory.password") + username System.env.ALFRESCO_NEXUS_USERNAME ?: property("org.alfresco.maven.nexus.username") + password System.env.ALFRESCO_NEXUS_PASSWORD ?: property("org.alfresco.maven.nexus.password") } } }