You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/10/05 23:21:55 UTC
svn commit: r822022 [5/11] - in /labs/magma/branches/0.0.2: ./
beans-richtext/ beans-richtext/src/main/java/org/apache/magma/beans/
beans-richtext/src/main/java/org/apache/magma/beans/richtext/
beans-richtext/src/main/java/org/apache/magma/conversion/r...
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/DefaultExpectations.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/DefaultExpectations.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/DefaultExpectations.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/DefaultExpectations.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
/**
*
*/
@@ -102,4 +118,4 @@
public void assertAllOk() {
mock.assertIsSatisfied();
}
-}
\ No newline at end of file
+}
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebContextTest.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebContextTest.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebContextTest.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebContextTest.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.website;
import static org.junit.Assert.*;
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/WebHandlerCycleTest.java Mon Oct 5 21:21:39 2009
@@ -45,6 +45,27 @@
}
@Test
+ public void redirectURI() throws Exception {
+ final DefaultExpectations def = new DefaultExpectations() {{
+ one(resp).sendRedirect("http://www.google.com/");
+
+ }};
+ def.setupDefaults("/test/redirectGoogle");
+
+ def.start();
+ }
+
+ @Test
+ public void redirectInternalURI() throws Exception {
+ final DefaultExpectations def = new DefaultExpectations() {{
+ one(resp).sendRedirect("http://localhost/app/tests/redirected");
+
+ }};
+ def.setupDefaults("/test/redirectInternal");
+ def.start();
+ }
+
+ @Test
public void findAndbind() throws Exception {
final DefaultExpectations def = new DefaultExpectations();
@@ -261,7 +282,9 @@
def.setupDefaults("/test/resource.txt");
def.start();
- assertEquals("This is a sample resource", def.out.toString());
+ String resout = def.out.toString();
+
+ assertTrue("Resource not loaded correctly", resout.trim().endsWith("This is a sample resource"));
}
@Test
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/ConvertedSessionHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/ConvertedSessionHandler.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/ConvertedSessionHandler.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/ConvertedSessionHandler.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.website.teststuff;
import org.apache.magma.website.CompoundType;
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/HtmlWithLinkProducer.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/HtmlWithLinkProducer.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/HtmlWithLinkProducer.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/HtmlWithLinkProducer.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.website.teststuff;
import java.io.IOException;
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/InjectProducerFromAspect.aj
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/InjectProducerFromAspect.aj?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/InjectProducerFromAspect.aj (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/InjectProducerFromAspect.aj Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.website.teststuff;
import org.apache.magma.website.CompoundType;
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/RecallingWebHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/RecallingWebHandler.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/RecallingWebHandler.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/RecallingWebHandler.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.website.teststuff;
import java.lang.reflect.Method;
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleSecondTemplate.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleSecondTemplate.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleSecondTemplate.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleSecondTemplate.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.website.teststuff;
import org.apache.magma.website.templating.Template;
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleWebHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleWebHandler.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleWebHandler.java (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/teststuff/SimpleWebHandler.java Mon Oct 5 21:21:39 2009
@@ -99,4 +99,14 @@
public HtmlProducer doTestAspectInjection() {
return new FakeHtmlProducer();
}
+
+ public HtmlProducer doRedirectGoogle() {
+ redirect("http://www.google.com/");
+ return null;
+ }
+
+ public HtmlProducer doRedirectInternal() {
+ redirect("magma:/redirected");
+ return null;
+ }
}
Propchange: labs/magma/branches/0.0.2/foundation-website/src/test/java/org/apache/magma/website/utils/RewritingTest.java
('svn:mergeinfo' removed)
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/resources/META-INF/messages.properties
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/resources/META-INF/messages.properties?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/resources/META-INF/messages.properties (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/resources/META-INF/messages.properties Mon Oct 5 21:21:39 2009
@@ -1 +1,15 @@
-convertedsessionhandler.testmessage=i18n
\ No newline at end of file
+#Licensed to the Apache Software Foundation (ASF) under one or more
+#contributor license agreements. See the NOTICE file distributed with
+#this work for additional information regarding copyright ownership.
+#The ASF licenses this file to You 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.
+convertedsessionhandler.testmessage=i18n
Modified: labs/magma/branches/0.0.2/foundation-website/src/test/resources/org/apache/magma/website/teststuff/resource.txt
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/foundation-website/src/test/resources/org/apache/magma/website/teststuff/resource.txt?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/foundation-website/src/test/resources/org/apache/magma/website/teststuff/resource.txt (original)
+++ labs/magma/branches/0.0.2/foundation-website/src/test/resources/org/apache/magma/website/teststuff/resource.txt Mon Oct 5 21:21:39 2009
@@ -1 +1,15 @@
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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.
This is a sample resource
\ No newline at end of file
Modified: labs/magma/branches/0.0.2/fragment-content-domain/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-domain/pom.xml?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-domain/pom.xml (original)
+++ labs/magma/branches/0.0.2/fragment-content-domain/pom.xml Mon Oct 5 21:21:39 2009
@@ -1,84 +1,95 @@
-<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>
- <parent>
- <groupId>org.apache.magma</groupId>
- <artifactId>magma-parent</artifactId>
- <version>2</version>
- </parent>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-domain</artifactId>
- <name/>
- <version>0.0.2-SNAPSHOT</version>
- <packaging>magma</packaging>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-beans</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>beans-richtext</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-beans-view</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-database</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>database-openjpa</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-i18n</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-validation</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>semeru-snaps</id>
- <name>Semeru snapshots</name>
- <url>http://svn.semeru.it/maven-snaps</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>semeru-snaps</id>
- <name>Semeru snapshots</name>
- <url>http://svn.semeru.it/maven-snaps</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-
-</project>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<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>
+ <parent>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>magma-parent</artifactId>
+ <version>2</version>
+ </parent>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-domain</artifactId>
+ <name/>
+ <version>0.0.2-SNAPSHOT</version>
+ <packaging>magma</packaging>
+ <description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-beans</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>beans-richtext</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-beans-view</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-database</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-i18n</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-validation</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>semeru-snaps</id>
+ <name>Semeru snapshots</name>
+ <url>http://svn.semeru.it/maven-snaps</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>semeru-snaps</id>
+ <name>Semeru snapshots</name>
+ <url>http://svn.semeru.it/maven-snaps</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+</project>
Modified: labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/Content.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/Content.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/Content.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/Content.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.domain.content;
import java.util.Date;
@@ -8,12 +24,14 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
+import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.apache.magma.beans.Consider;
import org.apache.magma.beans.MagmaBean;
import org.apache.magma.beans.RichTextString;
+import org.apache.magma.database.LogicallyNamed;
import org.apache.magma.i18n.Format;
import org.apache.magma.validation.validators.Length;
import org.apache.magma.validation.validators.Required;
@@ -27,23 +45,13 @@
@Entity
@MagmaBean
-public class Content {
- private long id;
+public class Content implements LogicallyNamed {
private ContentCategory category;
private String title;
private String content;
private Date date = new Date();
private boolean archived;
- @Id
- @GeneratedValue
- public long getId() {
- return id;
- }
- protected void setId(long id) {
- this.id = id;
- }
-
@ManyToOne
@View
@Order(1)
@@ -84,6 +92,7 @@
@View
@Order(3)
@Required
+ @Lob
@Column(length=50000)
@RichText(permitScripts=false)
@Consider(RichTextString.class)
@@ -107,4 +116,8 @@
if (this.title != null) sb.append(this.title);
return sb.toString();
}
+
+ public String computeLogicalName() {
+ return this.getTitle();
+ }
}
Modified: labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentCategory.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentCategory.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentCategory.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentCategory.java Mon Oct 5 21:21:39 2009
@@ -1,78 +1,89 @@
-package org.apache.magma.domain.content;
-
-
-import java.util.List;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-
-import org.apache.magma.beans.MagmaBean;
-import org.apache.magma.database.Database;
-import org.apache.magma.validation.validators.Length;
-import org.apache.magma.validation.validators.Required;
-import org.apache.magma.view.Listed;
-import org.apache.magma.view.Order;
-import org.apache.magma.view.View;
-
-@MagmaBean
-@Entity
-public class ContentCategory {
- private long id;
- private String name;
- private List<Content> contents;
- private List<ContentImage> images;
-
- @Id
- @GeneratedValue
- public long getId() {
- return id;
- }
- protected void setId(long id) {
- this.id = id;
- }
-
- @View
- @Order(1)
- @Listed
- @Required
- @Length(min=2, max=50)
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
-
- @OneToMany
- public List<Content> getContents() {
- return contents;
- }
- public void setContents(List<Content> contents) {
- this.contents = contents;
- }
-
- @OneToMany
- public List<ContentImage> getImages() {
- return images;
- }
- public void setImages(List<ContentImage> images) {
- this.images = images;
- }
-
- public static ContentCategory byName(String name) {
- Database db = new Database();
- List<ContentCategory> result = db.query(ContentCategory.class, 0, 1, "where x.name=?1", name);
- if (result.size() == 0) return null;
- return result.get(0);
- }
-
- public String toUser() {
- StringBuilder sb = new StringBuilder();
- if (this.name != null) sb.append(this.name);
- return sb.toString();
- }
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.domain.content;
+
+
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.apache.magma.beans.MagmaBean;
+import org.apache.magma.database.Database;
+import org.apache.magma.database.LogicallyNamed;
+import org.apache.magma.validation.validators.Length;
+import org.apache.magma.validation.validators.Required;
+import org.apache.magma.view.Listed;
+import org.apache.magma.view.Order;
+import org.apache.magma.view.View;
+
+@MagmaBean
+@Entity
+public class ContentCategory implements LogicallyNamed {
+ private String name;
+ private List<Content> contents;
+ private List<ContentImage> images;
+
+ @View
+ @Order(1)
+ @Listed
+ @Required
+ @Length(min=2, max=50)
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @OneToMany
+ public List<Content> getContents() {
+ return contents;
+ }
+ public void setContents(List<Content> contents) {
+ this.contents = contents;
+ }
+
+ @OneToMany
+ public List<ContentImage> getImages() {
+ return images;
+ }
+ public void setImages(List<ContentImage> images) {
+ this.images = images;
+ }
+
+ public static ContentCategory byName(String name) {
+ Database db = new Database();
+ List<ContentCategory> result = db.query(ContentCategory.class, 0, 1, "where x.name=?1", name);
+ if (result.size() == 0) return null;
+ return result.get(0);
+ }
+
+ public String toUser() {
+ StringBuilder sb = new StringBuilder();
+ if (this.name != null) sb.append(this.name);
+ return sb.toString();
+ }
+
+ public String computeLogicalName() {
+ return this.getName();
+ }
+
+
+}
Modified: labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentImage.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentImage.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentImage.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-domain/src/main/java/org/apache/magma/domain/content/ContentImage.java Mon Oct 5 21:21:39 2009
@@ -1,122 +1,134 @@
-package org.apache.magma.domain.content;
-
-import java.io.InputStream;
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-
-import org.apache.magma.beans.MagmaBean;
-import org.apache.magma.i18n.Format;
-
-import org.apache.magma.validation.validators.Length;
-import org.apache.magma.validation.validators.Required;
-import org.apache.magma.view.ListOrder;
-import org.apache.magma.view.Listed;
-import org.apache.magma.view.Order;
-import org.apache.magma.view.Side;
-import org.apache.magma.view.View;
-import org.apache.magma.view.Zone;
-import org.apache.openjpa.persistence.Persistent;
-
-@Entity
-@MagmaBean
-public class ContentImage{
- private long id;
- private ContentCategory category;
- private String title;
- private Date date = new Date();
- private boolean archived;
- private String link = new String("http://");
- private InputStream image;
- private boolean uploadedImage;
-
- @Id
- @GeneratedValue
- public long getId() {
- return id;
- }
- protected void setId(long id) {
- this.id = id;
- }
-
- @ManyToOne
- @View
- @Order(1)
- @Listed
- @ListOrder(3)
- @Required
- public ContentCategory getCategory() {
- return category;
- }
- public void setCategory(ContentCategory category) {
- this.category = category;
- }
-
- @View
- @Order(2)
- @Listed
- @ListOrder(1)
- @Length(min=2, max=50)
- public String getTitle() {
- return title;
- }
- public void setTitle(String title) {
- this.title = title;
- }
-
- @View
- @Zone(side=Side.OutsideRight, of="archived")
- @Listed
- @ListOrder(2)
- @Format(format="short,short")
- public Date getDate() {
- return date;
- }
- public void setDate(Date date) {
- this.date = date;
- }
-
- @View
- @Order(3)
- public String getLink() {
- return link;
- }
- public void setLink(String link) {
- this.link = link;
- }
-
- @Persistent
- @Column(length=10485760)
- public InputStream getImage() {
- return image;
- }
- public void setImage(InputStream image) {
- this.image = image;
- }
-
- public boolean isUploadedImage() {
- return uploadedImage;
- }
- public void setUploadedImage(boolean uploadedImage) {
- this.uploadedImage = uploadedImage;
- }
-
- @View
- @Order(4)
- public boolean isArchived() {
- return archived;
- }
- public void setArchived(boolean archived) {
- this.archived = archived;
- }
- public String toUser() {
- StringBuilder sb = new StringBuilder();
- if (this.title != null) sb.append(this.title);
- return sb.toString();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.domain.content;
+
+
+import java.io.InputStream;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+
+import org.apache.magma.beans.MagmaBean;
+import org.apache.magma.database.LogicallyNamed;
+import org.apache.magma.database.MagPersistent;
+import org.apache.magma.i18n.Format;
+
+import org.apache.magma.validation.validators.Length;
+import org.apache.magma.validation.validators.Required;
+import org.apache.magma.view.ListOrder;
+import org.apache.magma.view.Listed;
+import org.apache.magma.view.Order;
+import org.apache.magma.view.Side;
+import org.apache.magma.view.View;
+import org.apache.magma.view.Zone;
+
+@Entity
+@MagmaBean
+public class ContentImage implements LogicallyNamed {
+ private ContentCategory category;
+ private String title;
+ private Date date = new Date();
+ private boolean archived;
+ private String link = new String("http://");
+ private InputStream image;
+ private boolean uploadedImage;
+
+ @ManyToOne
+ @View
+ @Order(1)
+ @Listed
+ @ListOrder(3)
+ @Required
+ public ContentCategory getCategory() {
+ return category;
+ }
+ public void setCategory(ContentCategory category) {
+ this.category = category;
+ }
+
+ @View
+ @Order(2)
+ @Listed
+ @ListOrder(1)
+ @Length(min=2, max=50)
+ public String getTitle() {
+ return title;
+ }
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ @View
+ @Zone(side=Side.OutsideRight, of="archived")
+ @Listed
+ @ListOrder(2)
+ @Format(format="short,short")
+ public Date getDate() {
+ return date;
+ }
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ @View
+ @Order(3)
+ public String getLink() {
+ return link;
+ }
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ @MagPersistent
+ @Column(length=10485760)
+ public InputStream getImage() {
+ return image;
+ }
+ public void setImage(InputStream image) {
+ this.image = image;
+ }
+
+ public boolean isUploadedImage() {
+ return uploadedImage;
+ }
+ public void setUploadedImage(boolean uploadedImage) {
+ this.uploadedImage = uploadedImage;
+ }
+
+ @View
+ @Order(4)
+ public boolean isArchived() {
+ return archived;
+ }
+ public void setArchived(boolean archived) {
+ this.archived = archived;
+ }
+ public String toUser() {
+ StringBuilder sb = new StringBuilder();
+ if (this.title != null) sb.append(this.title);
+ return sb.toString();
+ }
+
+ public String computeLogicalName() {
+ return this.getTitle();
+ }
+}
Modified: labs/magma/branches/0.0.2/fragment-content-main-domain/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-main-domain/pom.xml?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-main-domain/pom.xml (original)
+++ labs/magma/branches/0.0.2/fragment-content-main-domain/pom.xml Mon Oct 5 21:21:39 2009
@@ -1,21 +1,37 @@
-<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>
- <parent>
- <artifactId>magma-parent</artifactId>
- <groupId>org.apache.magma</groupId>
- <version>2</version>
- </parent>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-main-domain</artifactId>
- <packaging>magma</packaging>
- <name/>
- <version>0.0.2-SNAPSHOT</version>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-domain</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<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>
+ <parent>
+ <artifactId>magma-parent</artifactId>
+ <groupId>org.apache.magma</groupId>
+ <version>2</version>
+ </parent>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-main-domain</artifactId>
+ <packaging>magma</packaging>
+ <name/>
+ <version>0.0.2-SNAPSHOT</version>
+ <description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-domain</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: labs/magma/branches/0.0.2/fragment-content-main-domain/src/main/java/org/apache/magma/domain/content/AddMainContent.aj
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-main-domain/src/main/java/org/apache/magma/domain/content/AddMainContent.aj?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-main-domain/src/main/java/org/apache/magma/domain/content/AddMainContent.aj (original)
+++ labs/magma/branches/0.0.2/fragment-content-main-domain/src/main/java/org/apache/magma/domain/content/AddMainContent.aj Mon Oct 5 21:21:39 2009
@@ -1,21 +1,37 @@
-package org.apache.magma.domain.content;
-
-import javax.persistence.OneToOne;
-
-import org.apache.magma.view.Listed;
-import org.apache.magma.view.View;
-
-public aspect AddMainContent {
- private Content ContentCategory.mainContent;
-
- @View
- @Listed
- @OneToOne
- public Content ContentCategory.getMainContent(){
- return this.mainContent;
- }
- public void ContentCategory.setMainContent(Content mainContent){
- this.mainContent = mainContent;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.domain.content;
+
+import javax.persistence.OneToOne;
+
+import org.apache.magma.view.Listed;
+import org.apache.magma.view.View;
+
+public aspect AddMainContent {
+ private Content ContentCategory.mainContent;
+
+ @View
+ @Listed
+ @OneToOne
+ public Content ContentCategory.getMainContent(){
+ return this.mainContent;
+ }
+ public void ContentCategory.setMainContent(Content mainContent){
+ this.mainContent = mainContent;
+ }
+
+}
Modified: labs/magma/branches/0.0.2/fragment-content-main-web/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-main-web/pom.xml?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-main-web/pom.xml (original)
+++ labs/magma/branches/0.0.2/fragment-content-main-web/pom.xml Mon Oct 5 21:21:39 2009
@@ -1,26 +1,42 @@
-<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>
- <parent>
- <artifactId>magma-parent</artifactId>
- <groupId>org.apache.magma</groupId>
- <version>2</version>
- </parent>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-main-web</artifactId>
- <packaging>magma</packaging>
- <name/>
- <version>0.0.2-SNAPSHOT</version>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-web</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-main-domain</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<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>
+ <parent>
+ <artifactId>magma-parent</artifactId>
+ <groupId>org.apache.magma</groupId>
+ <version>2</version>
+ </parent>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-main-web</artifactId>
+ <packaging>magma</packaging>
+ <name/>
+ <version>0.0.2-SNAPSHOT</version>
+ <description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-web</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-main-domain</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: labs/magma/branches/0.0.2/fragment-content-main-web/src/main/java/org/apache/magma/web/content/AddMainContentToContentWebHandler.aj
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-main-web/src/main/java/org/apache/magma/web/content/AddMainContentToContentWebHandler.aj?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-main-web/src/main/java/org/apache/magma/web/content/AddMainContentToContentWebHandler.aj (original)
+++ labs/magma/branches/0.0.2/fragment-content-main-web/src/main/java/org/apache/magma/web/content/AddMainContentToContentWebHandler.aj Mon Oct 5 21:21:39 2009
@@ -1,16 +1,32 @@
-package org.apache.magma.web.content;
-
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.producers.TemplatingProducer;
-import org.apache.magma.website.velocity.VelocityHtmlProducer;
-import org.apache.magma.domain.content.Content;
-import org.apache.magma.domain.content.ContentCategory;
-
-public aspect AddMainContentToContentWebHandler {
- public HtmlProducer ContentWebHandler.doMainContent(ContentCategory category){
- if(category == null || category.getMainContent() == null) return null;
- Content mainContent = category.getMainContent();
- HtmlProducer main = new TemplatingProducer().addParameter("main", mainContent);
- return main;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.web.content;
+
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.producers.TemplatingProducer;
+import org.apache.magma.website.velocity.VelocityHtmlProducer;
+import org.apache.magma.domain.content.Content;
+import org.apache.magma.domain.content.ContentCategory;
+
+public aspect AddMainContentToContentWebHandler {
+ public HtmlProducer ContentWebHandler.doMainContent(ContentCategory category){
+ if(category == null || category.getMainContent() == null) return null;
+ Content mainContent = category.getMainContent();
+ HtmlProducer main = new TemplatingProducer().addParameter("main", mainContent);
+ return main;
+ }
+}
Modified: labs/magma/branches/0.0.2/fragment-content-main-web/src/main/resources/org/apache/magma/web/content/mainContent.vm
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-main-web/src/main/resources/org/apache/magma/web/content/mainContent.vm?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-main-web/src/main/resources/org/apache/magma/web/content/mainContent.vm (original)
+++ labs/magma/branches/0.0.2/fragment-content-main-web/src/main/resources/org/apache/magma/web/content/mainContent.vm Mon Oct 5 21:21:39 2009
@@ -1,4 +1,18 @@
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You 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.
<h1 >
$main.title
</h1>
-<p> $main.content </p>
\ No newline at end of file
+<p> $main.content </p>
Modified: labs/magma/branches/0.0.2/fragment-content-order-domain/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-order-domain/pom.xml?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-order-domain/pom.xml (original)
+++ labs/magma/branches/0.0.2/fragment-content-order-domain/pom.xml Mon Oct 5 21:21:39 2009
@@ -1,21 +1,37 @@
-<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">
- <parent>
- <artifactId>magma-parent</artifactId>
- <groupId>org.apache.magma</groupId>
- <version>2</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-order-domain</artifactId>
- <packaging>magma</packaging>
- <name/>
- <version>0.0.2-SNAPSHOT</version>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-domain</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<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">
+ <parent>
+ <artifactId>magma-parent</artifactId>
+ <groupId>org.apache.magma</groupId>
+ <version>2</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-order-domain</artifactId>
+ <packaging>magma</packaging>
+ <name/>
+ <version>0.0.2-SNAPSHOT</version>
+ <description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-domain</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: labs/magma/branches/0.0.2/fragment-content-order-domain/src/main/java/org/apache/magma/domain/content/AddOrder.aj
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-order-domain/src/main/java/org/apache/magma/domain/content/AddOrder.aj?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-order-domain/src/main/java/org/apache/magma/domain/content/AddOrder.aj (original)
+++ labs/magma/branches/0.0.2/fragment-content-order-domain/src/main/java/org/apache/magma/domain/content/AddOrder.aj Mon Oct 5 21:21:39 2009
@@ -1,34 +1,50 @@
-package org.apache.magma.domain.content;
-
-import javax.persistence.Column;
-
-import org.apache.magma.domain.content.Content;
-import org.apache.magma.domain.content.ContentImage;
-import org.apache.magma.view.Listed;
-import org.apache.magma.view.View;
-
-public aspect AddOrder {
- private double Content.position;
- private double ContentImage.position;
-
- @View
- @Listed
- @Column
- public double Content.getPosition() {
- return this.position;
- }
- public void Content.setPosition(double position){
- this.position = position;
- }
-
- @View
- @Listed
- @Column
- public double ContentImage.getPosition() {
- return this.position;
- }
- public void ContentImage.setPosition(double position){
- this.position = position;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.domain.content;
+
+import javax.persistence.Column;
+
+import org.apache.magma.domain.content.Content;
+import org.apache.magma.domain.content.ContentImage;
+import org.apache.magma.view.Listed;
+import org.apache.magma.view.View;
+
+public aspect AddOrder {
+ private double Content.position;
+ private double ContentImage.position;
+
+ @View
+ @Listed
+ @Column
+ public double Content.getPosition() {
+ return this.position;
+ }
+ public void Content.setPosition(double position){
+ this.position = position;
+ }
+
+ @View
+ @Listed
+ @Column
+ public double ContentImage.getPosition() {
+ return this.position;
+ }
+ public void ContentImage.setPosition(double position){
+ this.position = position;
+ }
+
+}
Modified: labs/magma/branches/0.0.2/fragment-content-order-web/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-order-web/pom.xml?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-order-web/pom.xml (original)
+++ labs/magma/branches/0.0.2/fragment-content-order-web/pom.xml Mon Oct 5 21:21:39 2009
@@ -1,21 +1,37 @@
-<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">
- <parent>
- <artifactId>magma-parent</artifactId>
- <groupId>org.apache.magma</groupId>
- <version>2</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-order-web</artifactId>
- <packaging>magma</packaging>
- <name/>
- <version>0.0.2-SNAPSHOT</version>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-web</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<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">
+ <parent>
+ <artifactId>magma-parent</artifactId>
+ <groupId>org.apache.magma</groupId>
+ <version>2</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-order-web</artifactId>
+ <packaging>magma</packaging>
+ <name/>
+ <version>0.0.2-SNAPSHOT</version>
+ <description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-web</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: labs/magma/branches/0.0.2/fragment-content-order-web/src/main/java/org/apache/magma/web/content/AddOrderedMethodsToContentWebHandler.aj
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-order-web/src/main/java/org/apache/magma/web/content/AddOrderedMethodsToContentWebHandler.aj?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-order-web/src/main/java/org/apache/magma/web/content/AddOrderedMethodsToContentWebHandler.aj (original)
+++ labs/magma/branches/0.0.2/fragment-content-order-web/src/main/java/org/apache/magma/web/content/AddOrderedMethodsToContentWebHandler.aj Mon Oct 5 21:21:39 2009
@@ -1,25 +1,41 @@
-package org.apache.magma.web.content;
-
-import java.util.List;
-
-import org.apache.magma.basics.LocalizableString;
-import org.apache.magma.database.Database;
-import org.apache.magma.domain.content.Content;
-import org.apache.magma.domain.content.ContentCategory;
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.beansview.SmartList;
-import org.apache.magma.website.velocity.VelocityHtmlProducer;
-
-public aspect AddOrderedMethodsToContentWebHandler {
- public SmartList ContentWebHandler.handleOrderedList(ContentCategory category) {
- if(category == null) return null;
- HtmlProducer header = new VelocityHtmlProducer("listHeader").addParameter(new LocalizableString("List All " + category.getName()).toString());
- SmartList sl = new SmartList(Content.class, "where x.category=?1", category).setFilter(listAll);
- sl.addSortable("order");
- sl.addSortable("date").addSortable("title");
- sl.setSortingField("date", false);
- sl.setHeader(header);
- sl.setLink("doShow");
- return sl;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.web.content;
+
+import java.util.List;
+
+import org.apache.magma.basics.LocalizableString;
+import org.apache.magma.database.Database;
+import org.apache.magma.domain.content.Content;
+import org.apache.magma.domain.content.ContentCategory;
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.beansview.SmartList;
+import org.apache.magma.website.velocity.VelocityHtmlProducer;
+
+public aspect AddOrderedMethodsToContentWebHandler {
+ public SmartList ContentWebHandler.handleOrderedList(ContentCategory category) {
+ if(category == null) return null;
+ HtmlProducer header = new VelocityHtmlProducer("listHeader").addParameter(new LocalizableString("List All " + category.getName()).toString());
+ SmartList sl = new SmartList(Content.class, "where x.category=?1", category).setFilter(listAll);
+ sl.addSortable("order");
+ sl.addSortable("date").addSortable("title");
+ sl.setSortingField("date", false);
+ sl.setHeader(header);
+ sl.setLink("doShow");
+ return sl;
+ }
+}
Modified: labs/magma/branches/0.0.2/fragment-content-web/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-web/pom.xml?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-web/pom.xml (original)
+++ labs/magma/branches/0.0.2/fragment-content-web/pom.xml Mon Oct 5 21:21:39 2009
@@ -1,51 +1,72 @@
-<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>
- <parent>
- <groupId>org.apache.magma</groupId>
- <artifactId>magma-parent</artifactId>
- <version>2</version>
- </parent>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-web</artifactId>
- <name/>
- <version>0.0.2-SNAPSHOT</version>
- <packaging>magma</packaging>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>fragment-content-domain</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-website</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-beans-view</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>foundation-database</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>website-beansview</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>website-velocity</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.magma</groupId>
- <artifactId>website-administration</artifactId>
- <version>0.0.2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<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>
+ <parent>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>magma-parent</artifactId>
+ <version>2</version>
+ </parent>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-web</artifactId>
+ <name/>
+ <version>0.0.2-SNAPSHOT</version>
+ <packaging>magma</packaging>
+ <description/>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-content-domain</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-website</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-beans-view</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>foundation-database</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>website-beansview</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>website-velocity</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>website-administration</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.magma</groupId>
+ <artifactId>fragment-init</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/ContentWebHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/ContentWebHandler.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/ContentWebHandler.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/ContentWebHandler.java Mon Oct 5 21:21:39 2009
@@ -1,97 +1,113 @@
-package org.apache.magma.web.content;
-
-
-import java.util.List;
-
-import org.apache.magma.basics.LocalizableString;
-import org.apache.magma.database.Database;
-import org.apache.magma.domain.content.Content;
-import org.apache.magma.domain.content.ContentCategory;
-import org.apache.magma.domain.content.ContentImage;
-import org.apache.magma.view.tree.SimpleViewFilter;
-import org.apache.magma.view.tree.ViewCustomizer;
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.Producer;
-import org.apache.magma.website.StreamProducer;
-import org.apache.magma.website.WebHandler;
-import org.apache.magma.website.beansview.SmartList;
-import org.apache.magma.website.producers.TemplatingProducer;
-
-public class ContentWebHandler extends WebHandler{
-protected ViewCustomizer listAll = new SimpleViewFilter("-category");
-
- public HtmlProducer doLastBoxWithDate(int limit, ContentCategory category){
- if (category == null) return null;
- List<Content> query = new Database().query(Content.class, 0, limit, "where x.category=?1 order by x.date desc", category);
- HtmlProducer box = new TemplatingProducer()
- .addParameter("query", query)
- .addParameter("title", new LocalizableString(category.getName()).toString());
- return box;
- }
-
- public HtmlProducer doLastBox(int limit, ContentCategory category){
- if (category == null) return null;
- List<Content> query = new Database().query(Content.class, 0, limit, "where x.category=?1 order by x.date desc", category);
- HtmlProducer box = new TemplatingProducer()
- .addParameter("query", query)
- .addParameter("title", new LocalizableString(category.getName()).toString());
- return box;
- }
-
- public HtmlProducer doContentBox(ContentCategory category){
- if (category == null) return null;
- List<Content> query = new Database().query(Content.class, "where x.category=?1 order by x.date desc", category);
- HtmlProducer box = new TemplatingProducer()
- .addParameter("query", query)
- .addParameter("title", new LocalizableString(category.getName()).toString());
- return box;
- }
-
- public HtmlProducer doShow(Content content){
- return new TemplatingProducer("content").addParameter(content);
- }
-
- public HtmlProducer doShowLast(ContentCategory category){
- if (category == null) return null;
- List<Content> query = new Database().query(Content.class, 0, 1, "where x.category=?1 order by x.date desc", category);
- Content content = null;
- if (query.size() > 0) content = query.get(0);
- return new TemplatingProducer("lastcontent")
- .addParameter("content",content);
- }
-
- public HtmlProducer doShowLastElement(ContentCategory category){
- if (category == null) return null;
- List<Content> query = new Database().query(Content.class, 0, 1, "where x.category=?1 order by x.date desc", category);
- Content content = null;
- if (query.size() > 0) content = query.get(0);
- return new TemplatingProducer("lastelement")
- .addParameter("title", new LocalizableString(category.getName()).toString())
- .addParameter("content",content);
- }
-
- public HtmlProducer doImageBox(ContentCategory category){
- if(category == null) return null;
- List<ContentImage> query = new Database().query(ContentImage.class, 0, 1,"where x.category=?1 order by x.date desc" , category);
- ContentImage pic = null;
- if(query.size()>0) pic = query.get(0);
- HtmlProducer imgDiv = new TemplatingProducer("image").addParameter(pic);
- return imgDiv;
- }
-
- public Producer doDownload(ContentImage pic) {
- return new StreamProducer(pic.getTitle(), pic.getImage());
- }
-
- public SmartList handleListAll(ContentCategory c) {
- HtmlProducer header = new TemplatingProducer("listHeader").addParameter(new LocalizableString("List All " + c.getName()).toString());
- SmartList sl = new SmartList(Content.class, "where x.category=?1", c).setFilter(listAll);
- sl.addSortable("date").addSortable("title");
- sl.setSortingField("date", false);
- sl.setHeader(header);
- sl.setLink("doShow");
- return sl;
- }
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.web.content;
+
+
+import java.util.List;
+
+import org.apache.magma.basics.LocalizableString;
+import org.apache.magma.database.Database;
+import org.apache.magma.domain.content.Content;
+import org.apache.magma.domain.content.ContentCategory;
+import org.apache.magma.domain.content.ContentImage;
+import org.apache.magma.view.tree.SimpleViewFilter;
+import org.apache.magma.view.tree.ViewCustomizer;
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.Producer;
+import org.apache.magma.website.StreamProducer;
+import org.apache.magma.website.WebHandler;
+import org.apache.magma.website.beansview.SmartList;
+import org.apache.magma.website.producers.TemplatingProducer;
+
+public class ContentWebHandler extends WebHandler{
+protected ViewCustomizer listAll = new SimpleViewFilter("-category");
+
+ public HtmlProducer doLastBoxWithDate(int limit, ContentCategory category){
+ if (category == null) return null;
+ List<Content> query = new Database().query(Content.class, 0, limit, "where x.category=?1 order by x.date desc", category);
+ HtmlProducer box = new TemplatingProducer()
+ .addParameter("query", query)
+ .addParameter("title", new LocalizableString(category.getName()).toString());
+ return box;
+ }
+
+ public HtmlProducer doLastBox(int limit, ContentCategory category){
+ if (category == null) return null;
+ List<Content> query = new Database().query(Content.class, 0, limit, "where x.category=?1 order by x.date desc", category);
+ HtmlProducer box = new TemplatingProducer()
+ .addParameter("query", query)
+ .addParameter("title", new LocalizableString(category.getName()).toString());
+ return box;
+ }
+
+ public HtmlProducer doContentBox(ContentCategory category){
+ if (category == null) return null;
+ List<Content> query = new Database().query(Content.class, "where x.category=?1 order by x.date desc", category);
+ HtmlProducer box = new TemplatingProducer()
+ .addParameter("query", query)
+ .addParameter("title", new LocalizableString(category.getName()).toString());
+ return box;
+ }
+
+ public HtmlProducer doShow(Content content){
+ return new TemplatingProducer("content").addParameter(content);
+ }
+
+ public HtmlProducer doShowLast(ContentCategory category){
+ if (category == null) return null;
+ List<Content> query = new Database().query(Content.class, 0, 1, "where x.category=?1 order by x.date desc", category);
+ Content content = null;
+ if (query.size() > 0) content = query.get(0);
+ return new TemplatingProducer("lastcontent")
+ .addParameter("content",content);
+ }
+
+ public HtmlProducer doShowLastElement(ContentCategory category){
+ if (category == null) return null;
+ List<Content> query = new Database().query(Content.class, 0, 1, "where x.category=?1 order by x.date desc", category);
+ Content content = null;
+ if (query.size() > 0) content = query.get(0);
+ return new TemplatingProducer("lastelement")
+ .addParameter("title", new LocalizableString(category.getName()).toString())
+ .addParameter("content",content);
+ }
+
+ public HtmlProducer doImageBox(ContentCategory category){
+ if(category == null) return null;
+ List<ContentImage> query = new Database().query(ContentImage.class, 0, 1,"where x.category=?1 order by x.date desc" , category);
+ ContentImage pic = null;
+ if(query.size()>0) pic = query.get(0);
+ HtmlProducer imgDiv = new TemplatingProducer("image").addParameter(pic);
+ return imgDiv;
+ }
+
+ public Producer doDownload(ContentImage pic) {
+ return new StreamProducer(pic.getTitle(), pic.getImage());
+ }
+
+ public SmartList handleListAll(ContentCategory c) {
+ HtmlProducer header = new TemplatingProducer("listHeader").addParameter(new LocalizableString("List All " + c.getName()).toString());
+ SmartList sl = new SmartList(Content.class, "where x.category=?1", c).setFilter(listAll);
+ sl.addSortable("date").addSortable("title");
+ sl.setSortingField("date", false);
+ sl.setHeader(header);
+ sl.setLink("doShow");
+ return sl;
+ }
+
+
+}
Modified: labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContent.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContent.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContent.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContent.java Mon Oct 5 21:21:39 2009
@@ -1,18 +1,34 @@
-package org.apache.magma.web.content;
-
-
-
-import org.apache.magma.domain.content.Content;
-import org.apache.magma.website.admin.CompleteCrudHandler;
-import org.apache.magma.website.beansview.SmartForm;
-
-public class CrudContent extends CompleteCrudHandler<Content>{
- public CrudContent(){
- super(Content.class);
- }
- @Override
- public SmartForm handleEdit(Content bean) {
- //bean.setDate(new Date());
- return super.handleEdit(bean);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.web.content;
+
+
+
+import org.apache.magma.domain.content.Content;
+import org.apache.magma.website.admin.CompleteCrudHandler;
+import org.apache.magma.website.beansview.SmartForm;
+
+public class CrudContent extends CompleteCrudHandler<Content>{
+ public CrudContent(){
+ super(Content.class);
+ }
+ @Override
+ public SmartForm handleEdit(Content bean) {
+ //bean.setDate(new Date());
+ return super.handleEdit(bean);
+ }
+}
Modified: labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentCategory.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentCategory.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentCategory.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentCategory.java Mon Oct 5 21:21:39 2009
@@ -1,12 +1,28 @@
-package org.apache.magma.web.content;
-
-
-
-import org.apache.magma.domain.content.ContentCategory;
-import org.apache.magma.website.admin.CompleteCrudHandler;
-
-public class CrudContentCategory extends CompleteCrudHandler<ContentCategory>{
- public CrudContentCategory(){
- super(ContentCategory.class);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.web.content;
+
+
+
+import org.apache.magma.domain.content.ContentCategory;
+import org.apache.magma.website.admin.CompleteCrudHandler;
+
+public class CrudContentCategory extends CompleteCrudHandler<ContentCategory>{
+ public CrudContentCategory(){
+ super(ContentCategory.class);
+ }
+}
Modified: labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentImage.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentImage.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentImage.java (original)
+++ labs/magma/branches/0.0.2/fragment-content-web/src/main/java/org/apache/magma/web/content/CrudContentImage.java Mon Oct 5 21:21:39 2009
@@ -1,48 +1,64 @@
-package org.apache.magma.web.content;
-
-
-
-import java.io.IOException;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.magma.basics.LocalizableString;
-import org.apache.magma.database.Database;
-import org.apache.magma.domain.content.ContentImage;
-import org.apache.magma.website.CompoundType;
-import org.apache.magma.website.HtmlProducer;
-import org.apache.magma.website.admin.CompleteCrudHandler;
-import org.apache.magma.website.producers.TemplatingProducer;
-
-public class CrudContentImage extends CompleteCrudHandler<ContentImage>{
- public CrudContentImage(){
- super(ContentImage.class);
- }
- private FileItem paramFile;
-
-
- public void setParamFile(FileItem paramFile) {
- this.paramFile = paramFile;
- }
- @Override
- public HtmlProducer doShow(ContentImage pic){
- HtmlProducer footer = new TemplatingProducer("displaybanner").addParameter("bean", pic);
- return (HtmlProducer) super.doShow(pic).compoundWith(footer, CompoundType.AFTER);
- }
- public HtmlProducer doSelectImage(ContentImage pic) throws IOException {
- String message = "";
- if (paramFile != null) {
- if (paramFile != null && paramFile.getSize() > 0) {
- pic.setImage(paramFile.getInputStream());
- pic.setUploadedImage(true);
- }
- new Database().save(pic);
- if (paramFile != null) {
- message = new LocalizableString("File {0} saved correctly", paramFile.getName()).toString();
- }
- } else {
- message = new LocalizableString("Select a file").toString();
- }
- return new TemplatingProducer("pic").addParameter("message", message).addParameter("bean", pic);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.magma.web.content;
+
+
+
+import java.io.IOException;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.magma.basics.LocalizableString;
+import org.apache.magma.database.Database;
+import org.apache.magma.domain.content.ContentImage;
+import org.apache.magma.website.CompoundType;
+import org.apache.magma.website.HtmlProducer;
+import org.apache.magma.website.admin.CompleteCrudHandler;
+import org.apache.magma.website.producers.TemplatingProducer;
+
+public class CrudContentImage extends CompleteCrudHandler<ContentImage>{
+ public CrudContentImage(){
+ super(ContentImage.class);
+ }
+ private FileItem paramFile;
+
+
+ public void setParamFile(FileItem paramFile) {
+ this.paramFile = paramFile;
+ }
+ @Override
+ public HtmlProducer doShow(ContentImage pic){
+ HtmlProducer footer = new TemplatingProducer("displaybanner").addParameter("bean", pic);
+ return (HtmlProducer) super.doShow(pic).compoundWith(footer, CompoundType.AFTER);
+ }
+ public HtmlProducer doSelectImage(ContentImage pic) throws IOException {
+ String message = "";
+ if (paramFile != null) {
+ if (paramFile != null && paramFile.getSize() > 0) {
+ pic.setImage(paramFile.getInputStream());
+ pic.setUploadedImage(true);
+ }
+ new Database().save(pic);
+ if (paramFile != null) {
+ message = new LocalizableString("File {0} saved correctly", paramFile.getName()).toString();
+ }
+ } else {
+ message = new LocalizableString("Select a file").toString();
+ }
+ return new TemplatingProducer("pic").addParameter("message", message).addParameter("bean", pic);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org