Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ed3d3e
commit e5e931d
Showing
1,280 changed files
with
123,107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.classpath | ||
.project | ||
.settings | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/bin | ||
/.classpath | ||
/.project | ||
/.settings | ||
/target | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>appng-api</artifactId> | ||
<packaging>jar</packaging> | ||
<name>appNG public API</name> | ||
<description>the public API of appNG</description> | ||
|
||
<parent> | ||
<groupId>org.appng</groupId> | ||
<artifactId>appng-parent</artifactId> | ||
<version>1.14.0</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<!-- BEGIN DEPENDENCY MANAGEMENT --> | ||
<dependencies> | ||
<!-- BEGIN PROJECT DEPENDENCIES --> | ||
<dependency> | ||
<groupId>org.appng</groupId> | ||
<artifactId>appng-forms</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.appng</groupId> | ||
<artifactId>appng-xmlapi</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.appng</groupId> | ||
<artifactId>appng-tools</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.ws</groupId> | ||
<artifactId>spring-ws-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>wsdl4j</groupId> | ||
<artifactId>wsdl4j</artifactId> | ||
<version>1.6.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.validation</groupId> | ||
<artifactId>validation-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.appng</groupId> | ||
<artifactId>appng-formtags</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tomcat</groupId> | ||
<artifactId>tomcat-jasper</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-validator</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.lucene</groupId> | ||
<artifactId>lucene-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.data</groupId> | ||
<artifactId>spring-data-commons</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-collections</groupId> | ||
<artifactId>commons-collections</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet.jsp</groupId> | ||
<artifactId>jsp-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-annotations</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>xmlunit</groupId> | ||
<artifactId>xmlunit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
115 changes: 115 additions & 0 deletions
115
appng-api/src/main/java/org/appng/api/ActionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright 2011-2017 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.appng.api; | ||
|
||
import org.appng.api.model.Application; | ||
import org.appng.api.model.Site; | ||
import org.appng.xml.platform.Action; | ||
import org.appng.xml.platform.Bean; | ||
import org.appng.xml.platform.BeanOption; | ||
import org.appng.xml.platform.Datasource; | ||
import org.appng.xml.platform.FieldDef; | ||
import org.appng.xml.platform.MetaData; | ||
|
||
/** | ||
* An {@link ActionProvider} usually performs a CRUD-action on a domain object. The implementing class needs to be | ||
* defined in the application's {@code beans.xml}. This bean is then being referenced in a concrete {@link Action}: | ||
* | ||
* <pre> | ||
* <action id="update"> | ||
* <config> | ||
* <title id="issue.update" /> | ||
* <params> | ||
* <param name="form_action" /> | ||
* <param name="issueName" /> | ||
* <param name="edit" /> | ||
* </params> | ||
* </config> | ||
* <condition expression="${form_action eq 'update' and not empty issueName}" /> | ||
* <datasource id="issue"> | ||
* <params> | ||
* <param name="issueName">${issueName}</param> | ||
* <param name="edit">${edit}</param> | ||
* </params> | ||
* </datasource> | ||
* <bean id="issues"> | ||
* <option name="action" id="update" issue="${issueName}" /> | ||
* </bean> | ||
* </action> | ||
* </pre> | ||
* | ||
* There is no need to implement one {@link ActionProvider} per {@link Action}, since the {@link Bean} can be | ||
* parameterized using different {@link BeanOption}s. So for example, the above defined bean could also be used for | ||
* creating a new domain object, using another {@link BeanOption}: | ||
* | ||
* <pre> | ||
* <action id="create"> | ||
* <config> | ||
* <title id="issue.create" /> | ||
* </config> | ||
* <condition expression="${form_action eq 'create'}" /> | ||
* <datasource id="new_issue"> | ||
* <params> | ||
* <param name="form_action" /> | ||
* </params> | ||
* </datasource> | ||
* <bean id="issues"> | ||
* <option name="action" id="create" /> | ||
* </bean> | ||
* </action> | ||
* </pre> | ||
* | ||
* The distinction between create and update then can be done like this: | ||
* | ||
* <pre> | ||
* <code> | ||
* if ("create".equals(options.getOptionValue("action", "id"))) { | ||
* // create new domain object | ||
* } else if ("update".equals(options.getOptionValue("action", "id"))){ | ||
* // update existing domain object | ||
* }</code> | ||
* </pre> | ||
* | ||
* @author Matthias Müller | ||
* | ||
* @param <T> | ||
* the bean type for this {@link ActionProvider}s {@code perform(...)}-method. Must match | ||
* {@link MetaData#getBindClass()} of the {@link Datasource} used by the {@link Action} | ||
*/ | ||
public interface ActionProvider<T> { | ||
|
||
/** | ||
* Performs an action on the given {@code formBean} | ||
* | ||
* @param site | ||
* the current {@link Site} | ||
* @param application | ||
* the current {@link Application} | ||
* @param environment | ||
* the current {@link Environment} | ||
* @param options | ||
* the {@link Options} for this {@link ActionProvider} | ||
* @param request | ||
* the current {@link Request} | ||
* @param formBean | ||
* the bean which has been created | ||
* @param fieldProcessor | ||
* the {@link FieldProcessor} containing all writable {@link FieldDef}initions for this action | ||
*/ | ||
void perform(Site site, Application application, Environment environment, Options options, Request request, T formBean, | ||
FieldProcessor fieldProcessor); | ||
|
||
} |
Oops, something went wrong.