made server gui work and auto generate xml imports
This commit is contained in:
parent
01b3b5cc54
commit
c259e28e44
4
pom.xml
4
pom.xml
|
@ -36,6 +36,7 @@
|
||||||
<module>vasc-lib</module>
|
<module>vasc-lib</module>
|
||||||
<module>vasc-core-ejb3-client</module>
|
<module>vasc-core-ejb3-client</module>
|
||||||
<module>vasc-core-ejb3-server</module>
|
<module>vasc-core-ejb3-server</module>
|
||||||
|
<module>vasc-export</module>
|
||||||
</modules>
|
</modules>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -90,6 +91,9 @@
|
||||||
<!-- vasc-backend-mongo -->
|
<!-- vasc-backend-mongo -->
|
||||||
<mongo-java-driver.version>2.7.3</mongo-java-driver.version>
|
<mongo-java-driver.version>2.7.3</mongo-java-driver.version>
|
||||||
|
|
||||||
|
<!-- vasc-export-json -->
|
||||||
|
<json-simple.version>1.1</json-simple.version>
|
||||||
|
|
||||||
<!-- vasc-frontend-cxf -->
|
<!-- vasc-frontend-cxf -->
|
||||||
<cxf-rt.version>2.6.0</cxf-rt.version>
|
<cxf-rt.version>2.6.0</cxf-rt.version>
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import net.forwardfire.vasc.core.VascController;
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.VascEntryAccessType;
|
import net.forwardfire.vasc.core.VascEntryAccessType;
|
||||||
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
import net.forwardfire.vasc.core.VascEntryControllerLocal;
|
||||||
|
import net.forwardfire.vasc.core.VascEntryField;
|
||||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||||
import net.forwardfire.vasc.core.VascEntryGroupLocal;
|
import net.forwardfire.vasc.core.VascEntryGroupLocal;
|
||||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||||
|
@ -297,6 +298,39 @@ public class MetaModelSchemaAutoEntry {
|
||||||
ve.setDisplayNameFieldId(c.getName());
|
ve.setDisplayNameFieldId(c.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some auto detection on fields so default imported list view looks oke on 8++ columns.
|
||||||
|
if (ve.getVascEntryFields().size()>8) {
|
||||||
|
List<String> vefListIds = new ArrayList<String>(20);
|
||||||
|
for (VascEntryField vef:ve.getVascEntryFields()) {
|
||||||
|
String id = vef.getId().toLowerCase();
|
||||||
|
if ( id.contains("create") |
|
||||||
|
id.contains("update") |
|
||||||
|
id.contains("delete") |
|
||||||
|
id.contains("classname") |
|
||||||
|
id.contains("description")
|
||||||
|
) {
|
||||||
|
vef.setList(false);
|
||||||
|
}
|
||||||
|
if (ve.getDisplayNameFieldId()!=null && ve.getDisplayNameFieldId().equals(vef.getId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ve.getPrimaryKeyFieldId()!=null && ve.getPrimaryKeyFieldId().equals(vef.getId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (vef.getList()!=null && vef.getList()==false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vefListIds.add(vef.getId());
|
||||||
|
}
|
||||||
|
if (vefListIds.size()<8) {
|
||||||
|
List<String> vefListFalseIds = vefListIds.subList(8-1, vefListIds.size());
|
||||||
|
for (String key:vefListFalseIds) {
|
||||||
|
VascEntryField vef = ve.getVascEntryFieldById(key);
|
||||||
|
vef.setList(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,32 +5,25 @@
|
||||||
<groupId>net.forwardfire.vasc</groupId>
|
<groupId>net.forwardfire.vasc</groupId>
|
||||||
<version>0.4.1-SNAPSHOT</version>
|
<version>0.4.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>net.forwardfire.vasc</groupId>
|
|
||||||
<artifactId>vasc-core</artifactId>
|
<artifactId>vasc-core</artifactId>
|
||||||
<version>0.4.1-SNAPSHOT</version>
|
|
||||||
<name>vasc-core</name>
|
<name>vasc-core</name>
|
||||||
<description>vasc-core</description>
|
<description>vasc-core</description>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.x4o</groupId>
|
<groupId>org.x4o</groupId>
|
||||||
<artifactId>x4o-core</artifactId>
|
<artifactId>x4o-core</artifactId>
|
||||||
<version>${x4o.version}</version>
|
<version>${x4o.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.x4o</groupId>
|
<groupId>org.x4o</groupId>
|
||||||
<artifactId>x4o-meta</artifactId>
|
<artifactId>x4o-meta</artifactId>
|
||||||
<version>${x4o.version}</version>
|
<version>${x4o.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.forwardfire.vasc</groupId>
|
<groupId>net.forwardfire.vasc</groupId>
|
||||||
<artifactId>vasc-xpql</artifactId>
|
<artifactId>vasc-xpql</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
|
||||||
<artifactId>vasc-lib-jr4o</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.persistence</groupId>
|
<groupId>javax.persistence</groupId>
|
||||||
<artifactId>persistence-api</artifactId>
|
<artifactId>persistence-api</artifactId>
|
||||||
|
@ -38,16 +31,16 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-validator</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
<version>${hibernate-validator.version}</version>
|
<version>${hibernate-validator.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.odysseus.juel</groupId>
|
<groupId>de.odysseus.juel</groupId>
|
||||||
<artifactId>juel</artifactId>
|
<artifactId>juel</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.1.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -25,7 +25,7 @@ package net.forwardfire.vasc.core;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.forwardfire.vasc.backend.VascBackend;
|
import net.forwardfire.vasc.backend.VascBackend;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ public interface VascEntryConfigController {
|
||||||
|
|
||||||
public List<String> getVascEntryExporterIds();
|
public List<String> getVascEntryExporterIds();
|
||||||
|
|
||||||
public VascEntryExporter getVascEntryExporterById(String exporterId);
|
public VascEntryExport getVascEntryExporterById(String exporterId);
|
||||||
|
|
||||||
public void configVascFrontendController(VascController vascController,VascEntryLocal entry) throws VascException;
|
public void configVascFrontendController(VascController vascController,VascEntryLocal entry) throws VascException;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||||
|
|
||||||
import net.forwardfire.vasc.backend.VascBackendState;
|
import net.forwardfire.vasc.backend.VascBackendState;
|
||||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxy;
|
import net.forwardfire.vasc.backend.proxy.VascBackendProxy;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,9 +58,9 @@ public interface VascEntryConfigControllerLocal extends VascEntryConfigControlle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void addVascEntryExporter(VascEntryExporter exporter);
|
public void addVascEntryExporter(VascEntryExport exporter);
|
||||||
|
|
||||||
public void removeVascEntryExporter(VascEntryExporter exporter);
|
public void removeVascEntryExporter(VascEntryExport exporter);
|
||||||
|
|
||||||
|
|
||||||
public VascBackendState getMasterVascBackendState();
|
public VascBackendState getMasterVascBackendState();
|
||||||
|
|
|
@ -20,31 +20,31 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.forwardfire.vasc.impl.entry.export;
|
package net.forwardfire.vasc.core.entry;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VascEntryExporterXmlTree exports the data as xml tree.
|
* VascEntryExporter handles the export of data to an stream.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 May 9, 2012
|
* @version 1.0 May 19, 2007
|
||||||
*/
|
*/
|
||||||
public class VascEntryExporterXmlTree extends VascEntryExporterXml {
|
public interface VascEntryExport extends Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 179434457857022828L;
|
|
||||||
static public final String EXPORT_TYPE = "xmltree";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an VascEntryExporterXmlTree
|
|
||||||
*/
|
|
||||||
public VascEntryExporterXmlTree() {
|
|
||||||
setXmlTree(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// move ?
|
||||||
* @see net.forwardfire.vasc.impl.entry.export.VascEntryExporterXml#getId()
|
public VascEntryExportWriter createExportWriter() throws VascException;
|
||||||
*/
|
|
||||||
@Override
|
public String getId();
|
||||||
public String getId() {
|
|
||||||
return EXPORT_TYPE;
|
public String getRolesExport();
|
||||||
}
|
|
||||||
|
public String getExportWriterClass();
|
||||||
|
|
||||||
|
public void addWriterParameter(String key,String value);
|
||||||
|
public String getWriterParameter(String key);
|
||||||
|
public Set<String> getWriterParameterKeys();
|
||||||
}
|
}
|
|
@ -22,24 +22,24 @@
|
||||||
|
|
||||||
package net.forwardfire.vasc.core.entry;
|
package net.forwardfire.vasc.core.entry;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* VascEntryExportWriter handles the export of data to an stream.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 May 19, 2007
|
* @version 1.0 May 19, 2007
|
||||||
*/
|
*/
|
||||||
public interface VascEntryExporter extends Serializable {
|
public interface VascEntryExportWriter extends Serializable {
|
||||||
|
|
||||||
public String getId();
|
public void doInit(VascEntryExport export,VascEntry vascEntry) throws VascException;
|
||||||
|
|
||||||
public void doExport(OutputStream out,VascEntry vascEntry) throws VascException;
|
public void doExport(OutputStream out) throws IOException,VascException;
|
||||||
|
|
||||||
public String getMineType();
|
public String getMineType();
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
package net.forwardfire.vasc.frontend;
|
package net.forwardfire.vasc.frontend;
|
||||||
|
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,5 +47,5 @@ public interface VascFrontend {
|
||||||
|
|
||||||
public void renderDelete() throws VascFrontendException;
|
public void renderDelete() throws VascFrontendException;
|
||||||
|
|
||||||
public void renderExport(VascEntryExporter exporter) throws VascFrontendException;
|
public void renderExport(VascEntryExport exporter) throws VascFrontendException;
|
||||||
}
|
}
|
|
@ -43,7 +43,7 @@ import net.forwardfire.vasc.core.VascEntryState;
|
||||||
import net.forwardfire.vasc.core.VascInterfaceKey;
|
import net.forwardfire.vasc.core.VascInterfaceKey;
|
||||||
import net.forwardfire.vasc.core.VascInterfaceKeyFrontend;
|
import net.forwardfire.vasc.core.VascInterfaceKeyFrontend;
|
||||||
import net.forwardfire.vasc.core.VascInterfaceLoader;
|
import net.forwardfire.vasc.core.VascInterfaceLoader;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
@ -62,7 +62,7 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
|
||||||
|
|
||||||
private List<VascEntryConfigFinalizer> configFinalizers = null;
|
private List<VascEntryConfigFinalizer> configFinalizers = null;
|
||||||
private List<VascBackendProxy> backendProxies = null;
|
private List<VascBackendProxy> backendProxies = null;
|
||||||
private Map<String,VascEntryExporter> dataExporters = null;
|
private Map<String,VascEntryExport> dataExporters = null;
|
||||||
private List<VascEntryFieldValidatorService> fieldValidators = null;
|
private List<VascEntryFieldValidatorService> fieldValidators = null;
|
||||||
private Map<VascInterfaceKey,Class<?>> vascInterfaceImpls = null;
|
private Map<VascInterfaceKey,Class<?>> vascInterfaceImpls = null;
|
||||||
private Map<VascInterfaceKeyFrontend,Class<?>> vascInterfaceImplFrontends = null;
|
private Map<VascInterfaceKeyFrontend,Class<?>> vascInterfaceImplFrontends = null;
|
||||||
|
@ -73,7 +73,7 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
|
||||||
public DefaultVascEntryConfigController() {
|
public DefaultVascEntryConfigController() {
|
||||||
configFinalizers = new ArrayList<VascEntryConfigFinalizer>(10);
|
configFinalizers = new ArrayList<VascEntryConfigFinalizer>(10);
|
||||||
backendProxies = new ArrayList<VascBackendProxy>(10);
|
backendProxies = new ArrayList<VascBackendProxy>(10);
|
||||||
dataExporters = new HashMap<String,VascEntryExporter>(10);
|
dataExporters = new HashMap<String,VascEntryExport>(10);
|
||||||
fieldValidators = new ArrayList<VascEntryFieldValidatorService>(5);
|
fieldValidators = new ArrayList<VascEntryFieldValidatorService>(5);
|
||||||
vascInterfaceImpls = new HashMap<VascInterfaceKey,Class<?>>(VascInterfaceKey.values().length);
|
vascInterfaceImpls = new HashMap<VascInterfaceKey,Class<?>>(VascInterfaceKey.values().length);
|
||||||
vascInterfaceImplFrontends = new HashMap<VascInterfaceKeyFrontend,Class<?>>(VascInterfaceKeyFrontend.values().length);
|
vascInterfaceImplFrontends = new HashMap<VascInterfaceKeyFrontend,Class<?>>(VascInterfaceKeyFrontend.values().length);
|
||||||
|
@ -332,21 +332,21 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryExporterById(java.lang.String)
|
* @see net.forwardfire.vasc.core.VascEntryConfigController#getVascEntryExporterById(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public VascEntryExporter getVascEntryExporterById(String exporterId) {
|
public VascEntryExport getVascEntryExporterById(String exporterId) {
|
||||||
return dataExporters.get(exporterId);
|
return dataExporters.get(exporterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
* @see net.forwardfire.vasc.core.VascEntryConfigController#addVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExport)
|
||||||
*/
|
*/
|
||||||
public void addVascEntryExporter(VascEntryExporter exporter) {
|
public void addVascEntryExporter(VascEntryExport exporter) {
|
||||||
dataExporters.put(exporter.getId(),exporter);
|
dataExporters.put(exporter.getId(),exporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
* @see net.forwardfire.vasc.core.VascEntryConfigController#removeVascEntryExporter(net.forwardfire.vasc.core.entry.VascEntryExport)
|
||||||
*/
|
*/
|
||||||
public void removeVascEntryExporter(VascEntryExporter exporter) {
|
public void removeVascEntryExporter(VascEntryExport exporter) {
|
||||||
dataExporters.remove(exporter.getId());
|
dataExporters.remove(exporter.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,6 @@ import net.forwardfire.vasc.impl.entry.config.VascHelpIdFinalizer;
|
||||||
import net.forwardfire.vasc.impl.entry.config.VascI18nFinalizer;
|
import net.forwardfire.vasc.impl.entry.config.VascI18nFinalizer;
|
||||||
import net.forwardfire.vasc.impl.entry.config.VascIdAutoFinalizer;
|
import net.forwardfire.vasc.impl.entry.config.VascIdAutoFinalizer;
|
||||||
import net.forwardfire.vasc.impl.entry.config.VascIdCheckFinalizer;
|
import net.forwardfire.vasc.impl.entry.config.VascIdCheckFinalizer;
|
||||||
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterCsv;
|
|
||||||
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterXml;
|
|
||||||
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterXmlTree;
|
|
||||||
import net.forwardfire.vasc.impl.frontend.DefaultVascFrontendActions;
|
import net.forwardfire.vasc.impl.frontend.DefaultVascFrontendActions;
|
||||||
import net.forwardfire.vasc.impl.frontend.DefaultVascFrontendController;
|
import net.forwardfire.vasc.impl.frontend.DefaultVascFrontendController;
|
||||||
import net.forwardfire.vasc.impl.frontend.DefaultVascFrontendDataSelector;
|
import net.forwardfire.vasc.impl.frontend.DefaultVascFrontendDataSelector;
|
||||||
|
@ -101,11 +98,6 @@ public class DefaultVascFactory {
|
||||||
vascConfig.addVascEntryConfigFinalizer(new VascHelpIdFinalizer());
|
vascConfig.addVascEntryConfigFinalizer(new VascHelpIdFinalizer());
|
||||||
vascConfig.addVascEntryConfigFinalizer(new VascDefaultsFinalizer());
|
vascConfig.addVascEntryConfigFinalizer(new VascDefaultsFinalizer());
|
||||||
|
|
||||||
// Add all exporters in reverse ORDER
|
|
||||||
vascConfig.addVascEntryExporter(new VascEntryExporterXmlTree());
|
|
||||||
vascConfig.addVascEntryExporter(new VascEntryExporterXml());
|
|
||||||
vascConfig.addVascEntryExporter(new VascEntryExporterCsv());
|
|
||||||
|
|
||||||
// Add only the default internal vasc validator.
|
// Add only the default internal vasc validator.
|
||||||
vascConfig.addVascEntryFieldValidatorService(new VascValidatorsValidatorService());
|
vascConfig.addVascEntryFieldValidatorService(new VascValidatorsValidatorService());
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ package net.forwardfire.vasc.impl.actions;
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
import net.forwardfire.vasc.core.actions.AbstractVascGlobalActionLocal;
|
import net.forwardfire.vasc.core.actions.AbstractVascGlobalActionLocal;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ExportDataGlobalAction is action per exporter.
|
* ExportDataGlobalAction is action per exporter.
|
||||||
|
@ -53,7 +53,7 @@ public class ExportDataGlobalAction extends AbstractVascGlobalActionLocal {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doGlobalAction(VascEntry entry) throws VascException {
|
public void doGlobalAction(VascEntry entry) throws VascException {
|
||||||
VascEntryExporter exporter = entry.getVascFrontendController().getVascController().getVascEntryConfigController().getVascEntryExporterById(exporterId);
|
VascEntryExport exporter = entry.getVascFrontendController().getVascController().getVascEntryConfigController().getVascEntryExporterById(exporterId);
|
||||||
entry.getVascFrontendController().getVascFrontend().renderExport(exporter);
|
entry.getVascFrontendController().getVascFrontend().renderExport(exporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,8 @@ import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* BeanVascEntryRecordCreator creates an new instance Object from a defined objectClass.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Mar 21, 2007
|
* @version 1.0 Mar 21, 2007
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.forwardfire.vasc.impl.entry;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DefaultVascEntryExport holds the id and roles for the export writer.
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Nov 23, 2012
|
||||||
|
*/
|
||||||
|
public class DefaultVascEntryExport implements VascEntryExport {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4949926724589747264L;
|
||||||
|
private String id = null;
|
||||||
|
private String rolesExport = null;
|
||||||
|
private String exportWriterClass = null;
|
||||||
|
private Map<String,String> writerParameters = null;
|
||||||
|
|
||||||
|
public DefaultVascEntryExport() {
|
||||||
|
writerParameters = new HashMap<String,String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public VascEntryExportWriter createExportWriter() throws VascException {
|
||||||
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
|
if (cl == null) {
|
||||||
|
cl = DefaultVascEntryExport.class.getClassLoader();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Class<?> clazz = cl.loadClass(getExportWriterClass());
|
||||||
|
Object instance = clazz.newInstance();
|
||||||
|
VascEntryExportWriter writer = (VascEntryExportWriter)instance;
|
||||||
|
return writer;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new VascException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addWriterParameter(String key,String value) {
|
||||||
|
writerParameters.put(key,value);
|
||||||
|
}
|
||||||
|
public String getWriterParameter(String key) {
|
||||||
|
return writerParameters.get(key);
|
||||||
|
}
|
||||||
|
public Set<String> getWriterParameterKeys() {
|
||||||
|
return writerParameters.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id the id to set
|
||||||
|
*/
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the rolesExport
|
||||||
|
*/
|
||||||
|
public String getRolesExport() {
|
||||||
|
return rolesExport;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rolesExport the rolesExport to set
|
||||||
|
*/
|
||||||
|
public void setRolesExport(String rolesExport) {
|
||||||
|
this.rolesExport = rolesExport;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the exportWriterClass
|
||||||
|
*/
|
||||||
|
public String getExportWriterClass() {
|
||||||
|
return exportWriterClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param exportWriterClass the exportWriterClass to set
|
||||||
|
*/
|
||||||
|
public void setExportWriterClass(String exportWriterClass) {
|
||||||
|
this.exportWriterClass = exportWriterClass;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,117 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
|
||||||
* that the following conditions are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
|
||||||
* following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
|
||||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
||||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
||||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
||||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.forwardfire.vasc.impl.entry.export;
|
|
||||||
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
|
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
|
||||||
import net.forwardfire.vasc.core.VascEntryField;
|
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
|
||||||
import net.forwardfire.vasc.core.VascException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VascEntryExporterXml writes entry data to xml format.
|
|
||||||
*
|
|
||||||
* @author Willem Cazander
|
|
||||||
* @version 1.0 Mar 30, 2007
|
|
||||||
*/
|
|
||||||
public class VascEntryExporterXml implements VascEntryExporter {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 3719424578585760828L;
|
|
||||||
static public final String EXPORT_TYPE = "xml";
|
|
||||||
private boolean xmlTree = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId()
|
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return EXPORT_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
|
|
||||||
*/
|
|
||||||
public void doExport(OutputStream out, VascEntry entry) throws VascException {
|
|
||||||
PrintWriter p = new PrintWriter(out);
|
|
||||||
p.write("<?xml version=\"1.0\"?>\n");
|
|
||||||
p.write("<data>\n");
|
|
||||||
|
|
||||||
int oldIndex = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex();
|
|
||||||
Long total = entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords();
|
|
||||||
int pages = total.intValue()/entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageSize();
|
|
||||||
for (int page=0;page<=pages;page++) {
|
|
||||||
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(page);
|
|
||||||
entry.getVascFrontendController().getVascFrontendActions().refreshData();
|
|
||||||
for (Object o:entry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
|
||||||
p.write("\t<row>\n");
|
|
||||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
|
||||||
if (xmlTree) {
|
|
||||||
p.write("\t\t<"+c.getId()+"><![CDATA[");
|
|
||||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
|
||||||
p.write("]]></"+c.getId()+">\n");
|
|
||||||
} else {
|
|
||||||
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
|
|
||||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
|
||||||
p.write("]]></column>\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p.write("\t</row>\n");
|
|
||||||
p.flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p.write("</data>\n");
|
|
||||||
p.flush();
|
|
||||||
|
|
||||||
// restore old page size
|
|
||||||
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType()
|
|
||||||
*/
|
|
||||||
public String getMineType() {
|
|
||||||
return "text/xml";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType()
|
|
||||||
*/
|
|
||||||
public String getFileType() {
|
|
||||||
return EXPORT_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the xmlTree
|
|
||||||
*/
|
|
||||||
public boolean isXmlTree() {
|
|
||||||
return xmlTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param xmlTree the xmlTree to set
|
|
||||||
*/
|
|
||||||
public void setXmlTree(boolean xmlTree) {
|
|
||||||
this.xmlTree = xmlTree;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -208,7 +208,9 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
||||||
backendState.removeDataParameterAll();
|
backendState.removeDataParameterAll();
|
||||||
for (String key:entry.getEntryParameterKeys()) {
|
for (String key:entry.getEntryParameterKeys()) {
|
||||||
Object value = entry.getEntryParameter(key);
|
Object value = entry.getEntryParameter(key);
|
||||||
backendState.setDataParameter(key, value);
|
if (value!=null) {
|
||||||
|
backendState.setDataParameter(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update total every time first
|
// Update total every time first
|
||||||
|
|
|
@ -4,10 +4,7 @@
|
||||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||||
>
|
>
|
||||||
|
|
||||||
<v:entryGroup
|
<v:entryGroup id="demo-csv" rolesView=""/>
|
||||||
id="demo-csv"
|
|
||||||
rolesView="login"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<mm:csvDataContext
|
<mm:csvDataContext
|
||||||
el.id="metaPeopleDS"
|
el.id="metaPeopleDS"
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
<v:field id="sitemap" backendName="SITEMAP" vascEntryFieldType="BooleanField"/>
|
<v:field id="sitemap" backendName="SITEMAP" vascEntryFieldType="BooleanField"/>
|
||||||
<v:field id="part_order" backendName="PART_ORDER" vascEntryFieldType="IntegerField"/>
|
<v:field id="part_order" backendName="PART_ORDER" vascEntryFieldType="IntegerField"/>
|
||||||
<v:field id="part_type" backendName="PART_TYPE" vascEntryFieldType="ListField">
|
<v:field id="part_type" backendName="PART_TYPE" vascEntryFieldType="ListField">
|
||||||
<v:vascSelectItemModelString data="HTML,WIKI"/>
|
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.web.pages.model.VascPagePartType"/>
|
||||||
</v:field>
|
</v:field>
|
||||||
</v:entry>
|
</v:entry>
|
||||||
|
|
||||||
|
@ -84,9 +84,9 @@
|
||||||
<mm:metaModelBackend id="AdminVascMenuWebBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU_WEB" tableId="ID" />
|
<mm:metaModelBackend id="AdminVascMenuWebBackend" dataContextProvider="${DemoManagerDataDC}" table="VASC_MENU_WEB" tableId="ID" />
|
||||||
<v:entry id="AdminVascMenuWeb" backendId="AdminVascMenuWebBackend" vascGroupId="tech-admin">
|
<v:entry id="AdminVascMenuWeb" backendId="AdminVascMenuWebBackend" vascGroupId="tech-admin">
|
||||||
<v:listOption id="menu_type" backendName="MENU_TYPE" vascEntryFieldType="ListField" optional="true">
|
<v:listOption id="menu_type" backendName="MENU_TYPE" vascEntryFieldType="ListField" optional="true">
|
||||||
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType"/>
|
<v:vascSelectItemModelEnum enumClass="net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType" nullLabel="All"/>
|
||||||
</v:listOption>
|
</v:listOption>
|
||||||
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true" defaultValue="FALSE">
|
<v:listOption id="active" backendName="ACTIVE" vascEntryFieldType="ListField" optional="true">
|
||||||
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
<v:vascSelectItemModelString nullLabel="All" data="TRUE,FALSE"/>
|
||||||
</v:listOption>
|
</v:listOption>
|
||||||
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
<v:field id="id" backendName="ID" list="false" editReadOnly="true" create="false"/>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<v:entryGroup
|
<v:entryGroup
|
||||||
id="tech-server"
|
id="tech-server"
|
||||||
rolesView="admin"
|
rolesView="admin-server"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Load jndi factories into tomcat. -->
|
<!-- Load jndi factories into tomcat. -->
|
||||||
|
|
|
@ -76,6 +76,16 @@
|
||||||
<artifactId>vasc-backend-jdbc</artifactId>
|
<artifactId>vasc-backend-jdbc</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export-jr4o</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export-json</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||||
<artifactId>vasc-lib-i18n</artifactId>
|
<artifactId>vasc-lib-i18n</artifactId>
|
||||||
|
|
|
@ -26,9 +26,12 @@ import net.forwardfire.vasc.core.VascController;
|
||||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||||
import net.forwardfire.vasc.core.VascEntryConfigControllerLocal;
|
import net.forwardfire.vasc.core.VascEntryConfigControllerLocal;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
import net.forwardfire.vasc.export.generic.VascEntryExportWriterCsv;
|
||||||
|
import net.forwardfire.vasc.export.generic.VascEntryExportWriterXml;
|
||||||
|
import net.forwardfire.vasc.export.jr4o.VascEntryExportWriterJR4O;
|
||||||
|
import net.forwardfire.vasc.export.json.VascEntryExportWriterJson;
|
||||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||||
import net.forwardfire.vasc.impl.entry.export.VascEntryExporterJR4O;
|
import net.forwardfire.vasc.impl.entry.DefaultVascEntryExport;
|
||||||
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DemoVascControllerProvider gets the static local jvm vasc controller for this tech demo.
|
* DemoVascControllerProvider gets the static local jvm vasc controller for this tech demo.
|
||||||
|
@ -49,12 +52,78 @@ public class VascTechDemoControllerConfig implements VascControllerProvider {
|
||||||
VascEntryConfigControllerLocal vecc = (VascEntryConfigControllerLocal)vascController.getVascEntryConfigController();
|
VascEntryConfigControllerLocal vecc = (VascEntryConfigControllerLocal)vascController.getVascEntryConfigController();
|
||||||
|
|
||||||
// Config all report export engines for demo.
|
// Config all report export engines for demo.
|
||||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfLandscape",JRExportType.PDF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
// Add all exporters in reverse ORDER
|
||||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrPdfPortrait",JRExportType.PDF,"generic-portrait","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
|
||||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrRtf",JRExportType.RTF,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
DefaultVascEntryExport export;
|
||||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXls",JRExportType.XLS,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
|
||||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrXml",JRExportType.XML,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
export = new DefaultVascEntryExport();
|
||||||
vecc.addVascEntryExporter(new VascEntryExporterJR4O("jrCsv",JRExportType.CSV,"generic-landscape","net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml"));
|
export.setExportWriterClass(VascEntryExportWriterXml.class.getName());
|
||||||
|
export.setId("xml");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterXml.class.getName());
|
||||||
|
export.addWriterParameter("xmltree", "true");
|
||||||
|
export.setId("xmltree");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterCsv.class.getName());
|
||||||
|
export.setId("csv");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJR4O.class.getName());
|
||||||
|
export.addWriterParameter("reportType", "PDF");
|
||||||
|
export.addWriterParameter("reportName", "generic-landscape");
|
||||||
|
export.addWriterParameter("reportResource", "net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml");
|
||||||
|
export.setId("jrPdfLandscape");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJR4O.class.getName());
|
||||||
|
export.addWriterParameter("reportType", "PDF");
|
||||||
|
export.addWriterParameter("reportName", "generic-portrait");
|
||||||
|
export.addWriterParameter("reportResource", "net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml");
|
||||||
|
export.setId("jrPdfPortrait");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJR4O.class.getName());
|
||||||
|
export.addWriterParameter("reportType", "RTF");
|
||||||
|
export.addWriterParameter("reportName", "generic-landscape");
|
||||||
|
export.addWriterParameter("reportResource", "net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml");
|
||||||
|
export.setId("jrRtf");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJR4O.class.getName());
|
||||||
|
export.addWriterParameter("reportType", "XLS");
|
||||||
|
export.addWriterParameter("reportName", "generic-landscape");
|
||||||
|
export.addWriterParameter("reportResource", "net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml");
|
||||||
|
export.setId("jrXls");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJR4O.class.getName());
|
||||||
|
export.addWriterParameter("reportType", "XML");
|
||||||
|
export.addWriterParameter("reportName", "generic-landscape");
|
||||||
|
export.addWriterParameter("reportResource", "net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml");
|
||||||
|
export.setId("jrXml");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJR4O.class.getName());
|
||||||
|
export.addWriterParameter("reportType", "CSV");
|
||||||
|
export.addWriterParameter("reportName", "generic-landscape");
|
||||||
|
export.addWriterParameter("reportResource", "net/forwardfire/vasc/lib/jr4o/reports/dynamic-reports.xml");
|
||||||
|
export.setId("jrCsv");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
|
export = new DefaultVascEntryExport();
|
||||||
|
export.setExportWriterClass(VascEntryExportWriterJson.class.getName());
|
||||||
|
export.setId("json");
|
||||||
|
vecc.addVascEntryExporter(export);
|
||||||
|
|
||||||
// Config root bundle to load all resources.
|
// Config root bundle to load all resources.
|
||||||
vecc.setResourceBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle");
|
vecc.setResourceBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle");
|
||||||
|
|
|
@ -43,7 +43,7 @@ import net.forwardfire.vasc.demo.server.tomcat.TomcatService;
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 May 3, 2012
|
* @version 1.0 May 3, 2012
|
||||||
*/
|
*/
|
||||||
public class VascTechDemoStartup {
|
public class VascTechDemoStartup {
|
||||||
|
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
|
|
|
@ -24,22 +24,16 @@ package net.forwardfire.vasc.demo.server.tomcat;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
import net.forwardfire.vasc.demo.server.core.VascTechDemoStartup;
|
||||||
|
|
||||||
import org.apache.catalina.Container;
|
|
||||||
import org.apache.catalina.Context;
|
import org.apache.catalina.Context;
|
||||||
import org.apache.catalina.Host;
|
import org.apache.catalina.Host;
|
||||||
import org.apache.catalina.Server;
|
import org.apache.catalina.Server;
|
||||||
|
@ -48,24 +42,8 @@ import org.apache.catalina.Wrapper;
|
||||||
import org.apache.catalina.core.StandardContext;
|
import org.apache.catalina.core.StandardContext;
|
||||||
import org.apache.catalina.startup.Bootstrap;
|
import org.apache.catalina.startup.Bootstrap;
|
||||||
import org.apache.catalina.startup.ContextConfig;
|
import org.apache.catalina.startup.ContextConfig;
|
||||||
import org.apache.naming.NamingContext;
|
|
||||||
import org.apache.naming.resources.VirtualDirContext;
|
import org.apache.naming.resources.VirtualDirContext;
|
||||||
import org.apache.openejb.assembler.Deployer;
|
|
||||||
import org.apache.openejb.assembler.DeployerEjb;
|
|
||||||
import org.apache.openejb.assembler.classic.AppInfo;
|
|
||||||
import org.apache.openejb.config.AppModule;
|
|
||||||
import org.apache.openejb.config.ConfigurationFactory;
|
|
||||||
import org.apache.openejb.config.DeploymentsResolver;
|
|
||||||
import org.apache.openejb.config.sys.AdditionalDeployments;
|
|
||||||
import org.apache.openejb.config.sys.Deployments;
|
|
||||||
import org.apache.openejb.config.sys.JaxbOpenejb;
|
|
||||||
import org.apache.openejb.loader.FileUtils;
|
|
||||||
import org.apache.openejb.loader.IO;
|
|
||||||
import org.apache.openejb.loader.Options;
|
|
||||||
import org.apache.openejb.loader.SystemInstance;
|
|
||||||
import org.apache.openejb.server.ejbd.EjbServer;
|
|
||||||
import org.apache.openejb.spi.ContainerSystem;
|
|
||||||
import org.apache.openejb.util.URLs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TomcatService config and starts Tomcat in semi embedded mode.
|
* TomcatService config and starts Tomcat in semi embedded mode.
|
||||||
|
@ -95,17 +73,8 @@ public class TomcatService {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//org.apache.tomee.catalina.ServerListener
|
//we use org.apache.tomee.catalina.ServerListener
|
||||||
System.setProperty("openejb.servicemanager.enabled", "true");
|
System.setProperty("openejb.servicemanager.enabled", "true");
|
||||||
System.setProperty("openejb.embedded.remotable", "true");
|
|
||||||
System.setProperty("openejb.validation.output.level", "VERBOSE");
|
|
||||||
|
|
||||||
// System.setProperty("openejb.deployments.classpath", "true");
|
|
||||||
// System.setProperty("openejb.deployments.classpath.ear", "true");
|
|
||||||
//System.setProperty("openejb.deployments.classpath", "false");
|
|
||||||
//System.setProperty("openejb.deployments.classpath.ear", "false");
|
|
||||||
//System.setProperty("openejb.deployments.classpath.include", ".*");
|
|
||||||
//System.setProperty("openejb.deployments.classpath.exclude", "");
|
|
||||||
|
|
||||||
Bootstrap boot = new Bootstrap();
|
Bootstrap boot = new Bootstrap();
|
||||||
boot.setCatalinaHome(System.getProperty("user.dir"));
|
boot.setCatalinaHome(System.getProperty("user.dir"));
|
||||||
|
@ -129,78 +98,6 @@ public class TomcatService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final String ADDITIONAL_DEPLOYMENTS = "conf/deployments.xml";
|
|
||||||
private static final String CLASSPATH_AS_EAR = "openejb.deployments.classpath.ear";
|
|
||||||
|
|
||||||
private List<String> getDeclaredApps() {
|
|
||||||
// make a copy of the list because we update it
|
|
||||||
final List<Deployments> deployments = new ArrayList<Deployments>();
|
|
||||||
//if (openejb != null) {
|
|
||||||
// deployments.addAll(openejb.getDeployments());
|
|
||||||
//}
|
|
||||||
File additionalDeploymentFile;
|
|
||||||
try {
|
|
||||||
additionalDeploymentFile = SystemInstance.get().getBase().getFile(ADDITIONAL_DEPLOYMENTS, false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
additionalDeploymentFile = null;
|
|
||||||
}
|
|
||||||
if (additionalDeploymentFile.exists()) {
|
|
||||||
InputStream fis = null;
|
|
||||||
try {
|
|
||||||
fis = IO.read(additionalDeploymentFile);
|
|
||||||
final AdditionalDeployments additionalDeployments = JaxbOpenejb.unmarshal(AdditionalDeployments.class, fis);
|
|
||||||
deployments.addAll(additionalDeployments.getDeployments());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
//logger.error("can't read " + ADDITIONAL_DEPLOYMENTS, e);
|
|
||||||
} finally {
|
|
||||||
IO.close(fis);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// resolve jar locations ////////////////////////////////////// BEGIN ///////
|
|
||||||
|
|
||||||
final FileUtils base = SystemInstance.get().getBase();
|
|
||||||
|
|
||||||
final List<URL> declaredAppsUrls = new ArrayList<URL>();
|
|
||||||
try {
|
|
||||||
for (final Deployments deployment : deployments) {
|
|
||||||
DeploymentsResolver.loadFrom(deployment, base, declaredAppsUrls);
|
|
||||||
}
|
|
||||||
} catch (SecurityException ignored) {
|
|
||||||
}
|
|
||||||
return toString(declaredAppsUrls);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<File> getModulesFromClassPath(List<String> declaredApps, final ClassLoader classLoader) {
|
|
||||||
final FileUtils base = SystemInstance.get().getBase();
|
|
||||||
if (declaredApps == null) {
|
|
||||||
declaredApps = getDeclaredApps();
|
|
||||||
}
|
|
||||||
final List<URL> classpathAppsUrls = new ArrayList<URL>();
|
|
||||||
DeploymentsResolver.loadFromClasspath(base, classpathAppsUrls, classLoader);
|
|
||||||
|
|
||||||
final ArrayList<File> jarFiles = new ArrayList<File>();
|
|
||||||
for (final URL path : classpathAppsUrls) {
|
|
||||||
if (declaredApps.contains(URLs.toFilePath(path))) continue;
|
|
||||||
|
|
||||||
jarFiles.add(new File(URLs.toFilePath(path)));
|
|
||||||
}
|
|
||||||
return jarFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> toString(final List<URL> urls) {
|
|
||||||
final List<String> toReturn = new ArrayList<String>(urls.size());
|
|
||||||
for (final URL url : urls) {
|
|
||||||
try {
|
|
||||||
toReturn.add(url.toString());
|
|
||||||
} catch (Exception ignore) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deploy(String deployContext) throws Exception {
|
public void deploy(String deployContext) throws Exception {
|
||||||
Service service = server.findService("Catalina");
|
Service service = server.findService("Catalina");
|
||||||
|
@ -249,103 +146,23 @@ public class TomcatService {
|
||||||
logger.info("Deploy war path: "+deployPath);
|
logger.info("Deploy war path: "+deployPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Context ctx = new StandardContext();
|
Context ctx = new StandardContext();
|
||||||
ctx.setName(deployContext);
|
ctx.setName(deployContext);
|
||||||
ctx.setPath(deployContext);
|
ctx.setPath(deployContext);
|
||||||
ctx.setDocBase(deployPath);
|
ctx.setDocBase(deployPath);
|
||||||
//ctx.setParentClassLoader(commonLoader);
|
//ctx.setParentClassLoader(commonLoader);
|
||||||
ctx.setConfigured(true);
|
ctx.setConfigured(true);
|
||||||
|
|
||||||
ContextConfig ctxCfg = new ContextConfig();
|
|
||||||
ctx.addLifecycleListener(ctxCfg);
|
|
||||||
|
|
||||||
VirtualDirContext vDir = new VirtualDirContext();
|
|
||||||
vDir.setExtraResourcePaths("../../vasc-demo-tech/vasc-demo-tech-web/target/classes");
|
|
||||||
ctx.setResources(vDir);
|
|
||||||
|
|
||||||
//VirtualWebappLoader loader = new VirtualWebappLoader();
|
|
||||||
//String cl = System.getProperty("java.class.path").replace(":", ";");
|
|
||||||
//logger.info("Virtal class path: "+cl);
|
|
||||||
//loader.setVirtualClasspath(cl);
|
|
||||||
//loader.setSearchVirtualFirst(true);
|
|
||||||
//ctx.setLoader(loader);
|
|
||||||
|
|
||||||
//ctx.getJarScanner().scan
|
|
||||||
host.addChild(ctx);
|
|
||||||
|
|
||||||
applicationContext = ctx;
|
|
||||||
|
|
||||||
/*
|
|
||||||
ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
|
|
||||||
Deployer dep = (Deployer)containerSystem.getJNDIContext().lookup("java:global/openejb/openejb/Deployer");
|
|
||||||
for (AppInfo ai:dep.getDeployedApps()) {
|
|
||||||
System.out.println("AppInfo: "+ai.appId);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Deploy JarFile: "+deployPath);
|
ContextConfig ctxCfg = new ContextConfig();
|
||||||
Properties p = new Properties();
|
ctx.addLifecycleListener(ctxCfg);
|
||||||
p.setProperty(Deployer.FILENAME, ""+deployPath);
|
|
||||||
p.setProperty(DeployerEjb.OPENEJB_DEPLOYER_FORCED_APP_ID_PROP, deployContext);
|
|
||||||
AppInfo app = dep.deploy(p);
|
|
||||||
|
|
||||||
for (Container c:host.findChildren()) {
|
VirtualDirContext vDir = new VirtualDirContext();
|
||||||
System.out.println("Containter: "+c.getName()+" info: "+c.getInfo());
|
vDir.setExtraResourcePaths("../../vasc-demo-tech/vasc-demo-tech-web/target/classes");
|
||||||
if ("/webapp".equals(c.getName()) | deployContext.equals(c.getName())) {
|
ctx.setResources(vDir);
|
||||||
applicationContext = (Context)c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* deploy embedded ejbs .
|
|
||||||
for (AppInfo ai:dep.getDeployedApps()) {
|
|
||||||
System.out.println("AppInfo2: "+ai.appId);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<String> declaredApps = getDeclaredApps();
|
|
||||||
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
|
||||||
final ArrayList<File> jarFiles = getModulesFromClassPath(declaredApps, classLoader);
|
|
||||||
try {
|
|
||||||
for (final File jarFile : jarFiles) {
|
|
||||||
System.out.println("Deploy JarFile: "+jarFile);
|
|
||||||
|
|
||||||
boolean skip = false;
|
|
||||||
for (AppInfo ai:dep.getDeployedApps()) {
|
|
||||||
if ((""+jarFile).contains(ai.appId)) {
|
|
||||||
System.out.println("Skip deplyo: "+ai.appId);
|
|
||||||
skip = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((""+jarFile).contains("vasc-core-ejb3-server")) {
|
|
||||||
System.out.println("Skip vasc-core-ejb3-server");
|
|
||||||
skip = true;
|
|
||||||
}
|
|
||||||
if ((""+jarFile).contains("vasc-xpql-ejb3-server")) {
|
|
||||||
System.out.println("Skip vasc-xpql-ejb3-server");
|
|
||||||
skip = true;
|
|
||||||
}
|
|
||||||
if ((""+jarFile).contains("vasc-demo-tech-ejb3")) {
|
|
||||||
System.out.println("Skip vasc-demo-tech-ejb3");
|
|
||||||
skip = true;
|
|
||||||
}
|
|
||||||
if (skip) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = new Properties();
|
|
||||||
p.setProperty(Deployer.FILENAME, ""+jarFile);
|
|
||||||
p.setProperty(DeployerEjb.OPENEJB_DEPLOYER_FORCED_APP_ID_PROP, "webapp");
|
|
||||||
dep.deploy(p);
|
|
||||||
}
|
|
||||||
if (jarFiles.size() == 0) {
|
|
||||||
logger.warning("config.noModulesFoundToDeploy");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
host.addChild(ctx);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
applicationContext = ctx;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deployDebug() throws Exception {
|
public void deployDebug() throws Exception {
|
||||||
|
|
|
@ -32,8 +32,6 @@ import java.awt.SystemTray;
|
||||||
import java.awt.TrayIcon;
|
import java.awt.TrayIcon;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.WindowAdapter;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -61,6 +59,7 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
||||||
private Logger logger = null;
|
private Logger logger = null;
|
||||||
private JStatusPanel statusPanel = null;
|
private JStatusPanel statusPanel = null;
|
||||||
private ImageIcon serverIcon = null;
|
private ImageIcon serverIcon = null;
|
||||||
|
private UpdateInfoTask updateInfoTask = null;
|
||||||
|
|
||||||
public ServerGuiApplication() {
|
public ServerGuiApplication() {
|
||||||
logger = Logger.getLogger(ServerGuiApplication.class.getName());
|
logger = Logger.getLogger(ServerGuiApplication.class.getName());
|
||||||
|
@ -75,31 +74,45 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
||||||
mainView.setComponent(statusPanel);
|
mainView.setComponent(statusPanel);
|
||||||
mainView.getFrame().setMinimumSize(new Dimension(640,480));
|
mainView.getFrame().setMinimumSize(new Dimension(640,480));
|
||||||
mainView.getFrame().setMaximumSize(new Dimension(800,600));
|
mainView.getFrame().setMaximumSize(new Dimension(800,600));
|
||||||
mainView.getFrame().addWindowListener(new UpdateInfoListener());
|
|
||||||
|
|
||||||
show(mainView);
|
show(mainView);
|
||||||
startSystemTray();
|
startSystemTray();
|
||||||
|
|
||||||
|
updateInfoTask = new UpdateInfoTask();
|
||||||
|
Thread t = new Thread(updateInfoTask);
|
||||||
|
t.setName(UpdateInfoTask.class.getSimpleName());
|
||||||
|
t.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateInfoListener extends WindowAdapter {
|
class UpdateInfoTask implements Runnable {
|
||||||
|
volatile public boolean run = true;
|
||||||
|
volatile public boolean doUpdate = true;
|
||||||
@Override
|
@Override
|
||||||
public void windowActivated(WindowEvent e) {
|
public void run() {
|
||||||
System.out.println("vis: opened -ac");
|
logger.finest("Updating thread started.");
|
||||||
statusPanel.updateInfo();
|
while(run) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
if (doUpdate) {
|
||||||
|
statusPanel.updateInfo();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.finest("Updating thread stopped.");
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public void windowDeactivated(WindowEvent e) {
|
|
||||||
System.out.println("vis: closed - ac");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CloseWindowExitListener implements ExitListener {
|
class CloseWindowExitListener implements ExitListener {
|
||||||
@Override
|
@Override
|
||||||
public boolean canExit(EventObject event) {
|
public boolean canExit(EventObject event) {
|
||||||
if (event!=null && event.getSource().equals(ServerGuiApplication.this)) {
|
if (event!=null && event.getSource().equals(ServerGuiApplication.this)) {
|
||||||
|
updateInfoTask.run=false; // app will exit so stop update
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
logger.finer("Closing application window.");
|
||||||
|
updateInfoTask.doUpdate=false; // close window
|
||||||
ServerGuiApplication.getInstance().getMainFrame().setVisible(false);
|
ServerGuiApplication.getInstance().getMainFrame().setVisible(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -142,6 +155,7 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
||||||
aboutItem.addActionListener(new ActionListener() {
|
aboutItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
logger.finer("Systray show about.");
|
||||||
JOptionPane.showMessageDialog(ServerGuiApplication.getInstance().getMainFrame(), "Vasc Demo Tech Server:\nIs build to test and demo different parts of the vasc package.", "About Vasc Demo", JOptionPane.PLAIN_MESSAGE);
|
JOptionPane.showMessageDialog(ServerGuiApplication.getInstance().getMainFrame(), "Vasc Demo Tech Server:\nIs build to test and demo different parts of the vasc package.", "About Vasc Demo", JOptionPane.PLAIN_MESSAGE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -149,6 +163,8 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
||||||
statusItem.addActionListener(new ActionListener() {
|
statusItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
logger.finer("Systray open status window.");
|
||||||
|
updateInfoTask.doUpdate=true;
|
||||||
getMainFrame().setVisible(true);
|
getMainFrame().setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,6 +172,7 @@ public class ServerGuiApplication extends SingleFrameApplication {
|
||||||
exitItem.addActionListener(new ActionListener() {
|
exitItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
logger.finer("Systray exit application.");
|
||||||
VascTechDemoStartup.getInstance().shutdown();
|
VascTechDemoStartup.getInstance().shutdown();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
@ -93,25 +94,23 @@ public class JLoadStepWriteFile extends JPanel implements LoadStep,ActionListene
|
||||||
text.setText(out.getBuffer().toString());
|
text.setText(out.getBuffer().toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
JOptionPane.showMessageDialog(null, "Fatal error:\n"+e.getMessage(), "Generate xml error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean performStep(LoadStepData model) {
|
public boolean performStep(LoadStepData model) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
VascController vc = VascTechDemoStartup.getInstance().getVascControllerService().getVascController();
|
File writeFile = new File("conf/vasc.d/"+model.filename);
|
||||||
File tmpFile = new File("conf/vasc.d/"+model.filename);// File.createTempFile("vasc","xml");
|
System.out.println("write to : "+writeFile);
|
||||||
System.out.println("write to : "+tmpFile);
|
Writer out = new OutputStreamWriter(new FileOutputStream(writeFile));
|
||||||
Writer out = new OutputStreamWriter(new FileOutputStream(tmpFile));
|
out.append(text.getText());
|
||||||
XMLWriter outXml = new XMLWriter(out);
|
out.flush();
|
||||||
LoadVascXmlWriter writer = new LoadVascXmlWriter(outXml,vc);
|
out.close();
|
||||||
writer.writeXml(model);
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
JOptionPane.showMessageDialog(null, "Fatal error:\n"+e.getMessage(), "Write file error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ CREATE TABLE vasc_page (
|
||||||
id IDENTITY not null primary key,
|
id IDENTITY not null primary key,
|
||||||
slug varchar not null,
|
slug varchar not null,
|
||||||
title varchar not null,
|
title varchar not null,
|
||||||
i18n_key boolean not null,
|
|
||||||
active boolean not null,
|
active boolean not null,
|
||||||
sitemap boolean not null,
|
sitemap boolean not null,
|
||||||
roles varchar not null
|
roles varchar not null
|
||||||
|
@ -52,7 +51,6 @@ CREATE TABLE vasc_page_part (
|
||||||
page_id integer not null,
|
page_id integer not null,
|
||||||
title varchar not null,
|
title varchar not null,
|
||||||
text varchar not null,
|
text varchar not null,
|
||||||
i18n_key boolean not null,
|
|
||||||
active boolean not null,
|
active boolean not null,
|
||||||
sitemap boolean not null,
|
sitemap boolean not null,
|
||||||
part_order integer not null,
|
part_order integer not null,
|
||||||
|
@ -92,45 +90,51 @@ INSERT INTO vasc_user_change_field VALUES(2,'Password', 'password', TRUE);
|
||||||
INSERT INTO vasc_user_change_field VALUES(3,'Description', 'description', TRUE);
|
INSERT INTO vasc_user_change_field VALUES(3,'Description', 'description', TRUE);
|
||||||
INSERT INTO vasc_user_change_field VALUES(4,'Birthdate', 'date_age', TRUE);
|
INSERT INTO vasc_user_change_field VALUES(4,'Birthdate', 'date_age', TRUE);
|
||||||
|
|
||||||
-- ID SLUG TITLE I18N ACTIVE SITEMAP
|
-- ID SLUG TITLE ATIVE SITEMAP
|
||||||
INSERT INTO vasc_page VALUES(4, 'debug', 'Debug', FALSE, TRUE, FALSE, '');
|
INSERT INTO vasc_page VALUES(1, 'contact', 'Contact', TRUE, TRUE, '');
|
||||||
INSERT INTO vasc_page VALUES(5, 'contact', '', TRUE, TRUE, TRUE, '');
|
INSERT INTO vasc_page VALUES(2, 'techno', 'Techno', TRUE, TRUE, '');
|
||||||
INSERT INTO vasc_page VALUES(6, 'help', '', TRUE, TRUE, TRUE, '');
|
INSERT INTO vasc_page VALUES(3, 'help', 'Help', TRUE, TRUE, '');
|
||||||
|
INSERT INTO vasc_page VALUES(4, 'config', 'Config', TRUE, FALSE, '');
|
||||||
|
|
||||||
INSERT INTO vasc_page_part VALUES(1, 4, 'vasc', '', TRUE,TRUE,TRUE,1,'HTML', '');
|
INSERT INTO vasc_page_part VALUES(1, 1, 'Project', 'The vasc project is build for amazing ease of editing data.', TRUE,TRUE,1,'HTML', '');
|
||||||
INSERT INTO vasc_page_part VALUES(2, 4, 'jdbc', '', TRUE,TRUE,TRUE,2,'HTML', '');
|
INSERT INTO vasc_page_part VALUES(2, 1, 'Website', 'VASC: <a href="http://vasc.forwardfire.net">Website</a>', TRUE,TRUE,2,'HTML', '');
|
||||||
INSERT INTO vasc_page_part VALUES(3, 4, 'jndi', '', TRUE,TRUE,TRUE,3,'HTML', '');
|
|
||||||
INSERT INTO vasc_page_part VALUES(4, 4, 'logback', '', TRUE,TRUE,TRUE,3,'HTML', '');
|
|
||||||
|
|
||||||
INSERT INTO vasc_page_part VALUES(5, 5, 'project', '', TRUE,TRUE,TRUE,1,'WIKI', '');
|
INSERT INTO vasc_page_part VALUES(3, 2, 'Used technologies.', 'Example: XML,JSF,JDBC,etc', TRUE,TRUE,1,'HTML', '');
|
||||||
INSERT INTO vasc_page_part VALUES(6, 5, 'support', '', TRUE,TRUE,TRUE,2,'WIKI', '');
|
INSERT INTO vasc_page_part VALUES(4, 2, 'Used liberies', 'Todo make long list ?', TRUE,TRUE,2,'HTML', '');
|
||||||
INSERT INTO vasc_page_part VALUES(7, 5, 'location', '', TRUE,TRUE,TRUE,3,'HTML', '');
|
|
||||||
|
|
||||||
INSERT INTO vasc_page_part VALUES(8, 6, 'server', '', TRUE,TRUE,TRUE,1,'WIKI', '');
|
INSERT INTO vasc_page_part VALUES(5, 3, 'Documenation.', 'See docs directory.', TRUE,TRUE,1,'HTML', '');
|
||||||
INSERT INTO vasc_page_part VALUES(9, 6, 'vasc', '', TRUE,TRUE,TRUE,2,'WIKI', '');
|
INSERT INTO vasc_page_part VALUES(6, 3, 'Mailing list.', 'Goto some page to see.', TRUE,TRUE,2,'HTML', '');
|
||||||
INSERT INTO vasc_page_part VALUES(10,6, 'metamodel','', TRUE,TRUE,TRUE,3,'WIKI', '');
|
|
||||||
|
INSERT INTO vasc_page_part VALUES(10, 4, 'Vasc', 'Config entries in conf/vasc.d directory.', TRUE,TRUE,1,'HTML', '');
|
||||||
|
INSERT INTO vasc_page_part VALUES(11, 4, 'Jdbc', 'Config in vasc xml or context.xml', TRUE,TRUE,2,'HTML', '');
|
||||||
|
INSERT INTO vasc_page_part VALUES(12, 4, 'Jndi', 'Example of data source.', TRUE,TRUE,3,'HTML', '');
|
||||||
|
INSERT INTO vasc_page_part VALUES(13, 4, 'Logback', 'Change logging options.', TRUE,TRUE,3,'HTML', '');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- INSERT INTO vasc_page VALUES(1, 'home','home','Welcome to the vasc demo, please login as admin to view all stuff.');
|
-- INSERT INTO vasc_page VALUES(1, 'home','home','Welcome to the vasc demo, please login as admin to view all stuff.');
|
||||||
|
|
||||||
INSERT INTO vasc_menu_web VALUES(1, '/html/index.jsf','Home', '',true,'',1,'BAR_RIGHT');
|
INSERT INTO vasc_menu_web VALUES(1, '/html/index.jsf','Home', '',true,'' ,1,'BAR_LEFT');
|
||||||
INSERT INTO vasc_menu_web VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin',2,'BAR_RIGHT');
|
INSERT INTO vasc_menu_web VALUES(2, '/html/admin/debug.jsf','Debug','',true,'admin' ,2,'BAR_LEFT');
|
||||||
INSERT INTO vasc_menu_web VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin',3,'BAR_RIGHT');
|
INSERT INTO vasc_menu_web VALUES(3, '/html/admin/index.jsf','Admin','',true,'admin' ,3,'BAR_LEFT');
|
||||||
|
|
||||||
INSERT INTO vasc_menu_web VALUES(4, '/html/index.jsf','Home', '',true,'',1,'BAR_BOTTOM');
|
INSERT INTO vasc_menu_web VALUES(4, '/html/index.jsf', 'Home', '',true,'' ,1,'BAR_BOTTOM');
|
||||||
INSERT INTO vasc_menu_web VALUES(5, '/html/index.jsf','Contact', '',true,'',2,'BAR_BOTTOM');
|
INSERT INTO vasc_menu_web VALUES(5, '/page/contact', 'Contact', '',true,'' ,2,'BAR_BOTTOM');
|
||||||
INSERT INTO vasc_menu_web VALUES(6, '/html/index.jsf','Help', '',true,'',3,'BAR_BOTTOM');
|
INSERT INTO vasc_menu_web VALUES(6, '/page/help', 'Help', '',true,'' ,3,'BAR_BOTTOM');
|
||||||
INSERT INTO vasc_menu_web VALUES(7, '/html/index.jsf','Techno', '',true,'',3,'BAR_BOTTOM');
|
INSERT INTO vasc_menu_web VALUES(7, '/page/techno', 'Techno', '',true,'' ,4,'BAR_BOTTOM');
|
||||||
INSERT INTO vasc_menu_web VALUES(8, '/html/index.jsf','Licences', '',true,'',3,'BAR_BOTTOM');
|
|
||||||
|
|
||||||
INSERT INTO vasc_menu_web VALUES(10, '/vasc/AdminVascUser/list.jsf', 'Users', '',true,'admin',4,'PAGE_ADMIN');
|
INSERT INTO vasc_menu_web VALUES(8, '/page/contact', 'Contact', '',true,'' ,1,'BAR_RIGHT');
|
||||||
INSERT INTO vasc_menu_web VALUES(11, '/vasc/AdminVascUserRole/list.jsf', 'UserRoles', '',true,'admin',5,'PAGE_ADMIN');
|
INSERT INTO vasc_menu_web VALUES(9, '/page/help', 'Help', '',true,'' ,2,'BAR_RIGHT');
|
||||||
INSERT INTO vasc_menu_web VALUES(12, '/vasc/AdminVascUserChangeField/list.jsf', 'ChangeField', '',true,'admin',5,'PAGE_ADMIN');
|
|
||||||
INSERT INTO vasc_menu_web VALUES(13, '/vasc/AdminVascUserChangeLog/list.jsf', 'ChangeFieldLog', '',true,'admin',5,'PAGE_ADMIN');
|
|
||||||
|
|
||||||
INSERT INTO vasc_menu_web VALUES(14, '/vasc/AdminVascPage/list.jsf', 'Pages', '',true,'admin',5,'PAGE_ADMIN');
|
INSERT INTO vasc_menu_web VALUES(10, '/html/user/profile.jsf', 'Profile', '',true,'login',4,'MAIN_MENU_0');
|
||||||
INSERT INTO vasc_menu_web VALUES(15, '/vasc/AdminVascPagePart/list.jsf', 'PageParts', '',true,'admin',5,'PAGE_ADMIN');
|
INSERT INTO vasc_menu_web VALUES(11, '/vasc/VascEntry/list.jsf', 'VascEntries', '',true,'admin',5,'MAIN_MENU_0');
|
||||||
INSERT INTO vasc_menu_web VALUES(16, '/vasc/AdminVascMenu/list.jsf', 'Menu', '',true,'admin',4,'PAGE_ADMIN');
|
|
||||||
|
INSERT INTO vasc_menu_web VALUES(20, '/vasc/AdminVascUser/list.jsf', 'Users', '',true,'admin',4,'PAGE_ADMIN');
|
||||||
|
INSERT INTO vasc_menu_web VALUES(21, '/vasc/AdminVascUserRole/list.jsf', 'UserRoles', '',true,'admin',5,'PAGE_ADMIN');
|
||||||
|
INSERT INTO vasc_menu_web VALUES(22, '/vasc/AdminVascUserChangeField/list.jsf', 'ChangeField', '',true,'admin',5,'PAGE_ADMIN');
|
||||||
|
INSERT INTO vasc_menu_web VALUES(23, '/vasc/AdminVascUserChangeLog/list.jsf', 'ChangeFieldLog', '',true,'admin',5,'PAGE_ADMIN');
|
||||||
|
INSERT INTO vasc_menu_web VALUES(24, '/vasc/AdminVascPage/list.jsf', 'Pages', '',true,'admin',5,'PAGE_ADMIN');
|
||||||
|
INSERT INTO vasc_menu_web VALUES(25, '/vasc/AdminVascPagePart/list.jsf', 'PageParts', '',true,'admin',5,'PAGE_ADMIN');
|
||||||
|
INSERT INTO vasc_menu_web VALUES(26, '/vasc/AdminVascMenu/list.jsf', 'Menu', '',true,'admin',4,'PAGE_ADMIN');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ Application.web.footer.center = Vasc Tech Demo Web Based on JSF and Faclets and
|
||||||
Application.web.footer.left = Copyright © 2012
|
Application.web.footer.left = Copyright © 2012
|
||||||
Application.web.footer.right = Version 0.4.x<i>(beta)</i>
|
Application.web.footer.right = Version 0.4.x<i>(beta)</i>
|
||||||
|
|
||||||
|
generic.all = All
|
||||||
generic.active.labelText = active
|
generic.active.labelText = active
|
||||||
generic.active.toolTipText = active
|
generic.active.toolTipText = active
|
||||||
generic.createdDate.labelText = createdDate
|
generic.createdDate.labelText = createdDate
|
||||||
|
@ -58,6 +59,10 @@ generic.name.toolTipText = name
|
||||||
generic.orderNumber.labelText = orderNumber
|
generic.orderNumber.labelText = orderNumber
|
||||||
generic.orderNumber.toolTipText = orderNumber
|
generic.orderNumber.toolTipText = orderNumber
|
||||||
|
|
||||||
|
menu.mainMenu0.title = Menu
|
||||||
|
menu.mainMenu1.title = Menu
|
||||||
|
menu.mainMenu2.title = Menu
|
||||||
|
|
||||||
# hibernate validators
|
# hibernate validators
|
||||||
validator.assertFalse=assertion failed
|
validator.assertFalse=assertion failed
|
||||||
validator.assertTrue=assertion failed
|
validator.assertTrue=assertion failed
|
||||||
|
@ -112,7 +117,8 @@ vasc.action.jrXmlExportAction.description = JR-XML
|
||||||
vasc.action.jrXmlExportAction.name = JR-XML
|
vasc.action.jrXmlExportAction.name = JR-XML
|
||||||
vasc.action.jrCsvExportAction.description = JR-CSV
|
vasc.action.jrCsvExportAction.description = JR-CSV
|
||||||
vasc.action.jrCsvExportAction.name = JR-CSV
|
vasc.action.jrCsvExportAction.name = JR-CSV
|
||||||
|
vasc.action.jsonExportAction.description = JSON
|
||||||
|
vasc.action.jsonExportAction.name = JSON
|
||||||
|
|
||||||
# Temp jsf
|
# Temp jsf
|
||||||
generic.vasc.jsf.listOption.header = Searchoptions
|
generic.vasc.jsf.listOption.header = Searchoptions
|
||||||
|
|
|
@ -208,36 +208,4 @@ public class VascMenuControllerImpl implements VascMenuControllerLocal,VascMenuC
|
||||||
Collections.sort(result,vascMenuWebComparator);
|
Collections.sort(result,vascMenuWebComparator);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<VascMenuWeb> getMenuFiltered(VascMenuWebType type) {
|
|
||||||
return getFilteredMenuWeb(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuBarLeft() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.BAR_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuBarRight() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.BAR_RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuBarBottom() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.BAR_BOTTOM);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuPageIndex() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.PAGE_INDEX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuPageUserLeft() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.PAGE_USER_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuPageUserRight() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.PAGE_USER_RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenuWeb> getMenuPageAdmin() {
|
|
||||||
return getMenuFiltered(VascMenuWebType.PAGE_ADMIN);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -34,6 +34,10 @@ public enum VascMenuWebType {
|
||||||
BAR_RIGHT,
|
BAR_RIGHT,
|
||||||
BAR_BOTTOM,
|
BAR_BOTTOM,
|
||||||
|
|
||||||
|
MAIN_MENU_0,
|
||||||
|
MAIN_MENU_1,
|
||||||
|
MAIN_MENU_2,
|
||||||
|
|
||||||
PAGE_INDEX,
|
PAGE_INDEX,
|
||||||
PAGE_USER_LEFT,
|
PAGE_USER_LEFT,
|
||||||
PAGE_USER_RIGHT,
|
PAGE_USER_RIGHT,
|
||||||
|
|
|
@ -23,23 +23,13 @@
|
||||||
package net.forwardfire.vasc.demo.tech.web.beans;
|
package net.forwardfire.vasc.demo.tech.web.beans;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.naming.Context;
|
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
import net.forwardfire.vasc.demo.tech.ejb3.menu.VascMenuController;
|
||||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuGroup;
|
||||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebComparator;
|
|
||||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWeb;
|
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWeb;
|
||||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
||||||
|
|
||||||
|
@ -52,7 +42,6 @@ import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebType;
|
||||||
public class MenuController implements Serializable {
|
public class MenuController implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6820749860984575869L;
|
private static final long serialVersionUID = -6820749860984575869L;
|
||||||
private List<VascMenuWeb> userVascMenu = null;
|
|
||||||
private UserController userController = null;
|
private UserController userController = null;
|
||||||
private VascMenuController vascMenuController = null;
|
private VascMenuController vascMenuController = null;
|
||||||
|
|
||||||
|
@ -108,6 +97,17 @@ public class MenuController implements Serializable {
|
||||||
return getMenuFiltered(VascMenuWebType.PAGE_ADMIN);
|
return getMenuFiltered(VascMenuWebType.PAGE_ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<VascMenuWeb> getMainMenu0() {
|
||||||
|
return getMenuFiltered(VascMenuWebType.MAIN_MENU_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VascMenuWeb> getMainMenu1() {
|
||||||
|
return getMenuFiltered(VascMenuWebType.MAIN_MENU_1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<VascMenuWeb> getMainMenu2() {
|
||||||
|
return getMenuFiltered(VascMenuWebType.MAIN_MENU_2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the userController
|
* @return the userController
|
||||||
|
|
|
@ -23,24 +23,34 @@
|
||||||
package net.forwardfire.vasc.demo.tech.web.pages;
|
package net.forwardfire.vasc.demo.tech.web.pages;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
import javax.naming.NamingException;
|
import javax.naming.NamingException;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import net.forwardfire.vasc.demo.tech.ejb3.menu.model.VascMenuWebComparator;
|
import de.tudarmstadt.ukp.wikipedia.parser.ParsedPage;
|
||||||
|
import de.tudarmstadt.ukp.wikipedia.parser.Section;
|
||||||
|
import de.tudarmstadt.ukp.wikipedia.parser.html.HtmlWriter;
|
||||||
|
import de.tudarmstadt.ukp.wikipedia.parser.mediawiki.MediaWikiParser;
|
||||||
|
import de.tudarmstadt.ukp.wikipedia.parser.mediawiki.MediaWikiParserFactory;
|
||||||
|
|
||||||
import net.forwardfire.vasc.demo.tech.web.beans.UserController;
|
import net.forwardfire.vasc.demo.tech.web.beans.UserController;
|
||||||
|
import net.forwardfire.vasc.demo.tech.web.pages.model.VascPage;
|
||||||
|
import net.forwardfire.vasc.demo.tech.web.pages.model.VascPagePart;
|
||||||
|
import net.forwardfire.vasc.demo.tech.web.pages.model.VascPagePartType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MenuController Shows the menu for the user.
|
* VascPageController very hacky page context controller.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 May 19, 2012
|
* @version 1.0 May 19, 2012
|
||||||
|
@ -48,40 +58,32 @@ import net.forwardfire.vasc.demo.tech.web.beans.UserController;
|
||||||
public class VascPageController implements Serializable {
|
public class VascPageController implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6820749860984575869L;
|
private static final long serialVersionUID = -6820749860984575869L;
|
||||||
//private List<VascMenu> userVascMenu = null;
|
|
||||||
//private VascMenuComparator vascMenuComparator = null;
|
|
||||||
private UserController userController = null;
|
private UserController userController = null;
|
||||||
|
private VascPage page = null;
|
||||||
|
|
||||||
/*
|
public VascPage fetchVascPage(String slug) {
|
||||||
public List<VascMenu> fetchVascPage() {
|
VascPage result = null;
|
||||||
|
|
||||||
vascMenuComparator = new VascMenuComparator();
|
|
||||||
userVascMenu = new ArrayList<VascMenu>(50);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
try {
|
try {
|
||||||
DataSource ds = getDataSource("java:comp/env/jdbc/DemoManagerDataDS");
|
DataSource ds = getDataSource("java:comp/env/jdbc/DemoManagerDataDS");
|
||||||
connection = ds.getConnection();
|
connection = ds.getConnection();
|
||||||
Statement s = connection.createStatement();
|
Statement s = connection.createStatement();
|
||||||
s.execute("SELECT * FROM VASC_MENU");
|
s.execute("SELECT * FROM VASC_PAGE WHERE SLUG='"+slug+"'"); // bad so redo ..
|
||||||
ResultSet rs = s.getResultSet();
|
ResultSet rs = s.getResultSet();
|
||||||
//int cols = rs.getMetaData().getColumnCount();
|
if (rs.next()) {
|
||||||
while (rs.next()) {
|
result = new VascPage();
|
||||||
VascMenu menu = new VascMenu();
|
result.setId(rs.getInt(1));
|
||||||
menu.setId(rs.getInt(1));
|
result.setSlug(rs.getString(2));
|
||||||
menu.setHref(rs.getString(2));
|
result.setTitle(rs.getString(3));
|
||||||
menu.setTitle(rs.getString(3));
|
result.setActive(rs.getBoolean(4));
|
||||||
menu.setTarget(rs.getString(4));
|
result.setSitemap(rs.getBoolean(5));
|
||||||
menu.setActive(rs.getBoolean(5));
|
result.setRoles(rs.getString(6));
|
||||||
menu.setRoles(rs.getString(6));
|
/*
|
||||||
menu.setMenuOrder(rs.getInt(7));
|
menu.setMenuOrder(rs.getInt(7));
|
||||||
menu.setMenuType(VascMenuType.valueOf(rs.getString(8)));
|
menu.setMenuType(VascMenuType.valueOf(rs.getString(8)));
|
||||||
if (filterVascMenuRoles(menu)==false) {
|
if (filterVascMenuRoles(menu)==false) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
userVascMenu.add(menu);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -93,8 +95,48 @@ public class VascPageController implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
return userVascMenu;
|
}
|
||||||
|
|
||||||
|
public List<VascPagePart> fetchVascPageParts(int pageId) {
|
||||||
|
List<VascPagePart> result = new ArrayList<VascPagePart>(50);
|
||||||
|
Connection connection = null;
|
||||||
|
try {
|
||||||
|
DataSource ds = getDataSource("java:comp/env/jdbc/DemoManagerDataDS");
|
||||||
|
connection = ds.getConnection();
|
||||||
|
Statement s = connection.createStatement();
|
||||||
|
s.execute("SELECT * FROM VASC_PAGE_PART WHERE PAGE_ID="+pageId); // bad
|
||||||
|
ResultSet rs = s.getResultSet();
|
||||||
|
while (rs.next()) {
|
||||||
|
VascPagePart menu = new VascPagePart();
|
||||||
|
menu.setId(rs.getInt(1));
|
||||||
|
menu.setPageId(rs.getInt(2));
|
||||||
|
menu.setTitle(rs.getString(3));
|
||||||
|
menu.setText(rs.getString(4));
|
||||||
|
menu.setActive(rs.getBoolean(5));
|
||||||
|
menu.setSitemap(rs.getBoolean(6));
|
||||||
|
menu.setPartOrder(rs.getInt(7));
|
||||||
|
menu.setPartType(VascPagePartType.valueOf(rs.getString(8)));
|
||||||
|
menu.setRoles(rs.getString(9));
|
||||||
|
/*
|
||||||
|
menu.setMenuOrder(rs.getInt(7));
|
||||||
|
menu.setMenuType(VascMenuType.valueOf(rs.getString(8)));
|
||||||
|
if (filterVascMenuRoles(menu)==false) {
|
||||||
|
continue;
|
||||||
|
}*/
|
||||||
|
result.add(menu);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (connection!=null) {
|
||||||
|
try {
|
||||||
|
connection.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataSource getDataSource(String name) throws SQLException {
|
private DataSource getDataSource(String name) throws SQLException {
|
||||||
|
@ -110,6 +152,7 @@ public class VascPageController implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private boolean filterVascMenuRoles(VascMenu menu) {
|
private boolean filterVascMenuRoles(VascMenu menu) {
|
||||||
if (menu.getActive()!=null && menu.getActive()==false) {
|
if (menu.getActive()!=null && menu.getActive()==false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -127,30 +170,100 @@ public class VascPageController implements Serializable {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private List<VascMenu> getMenuFiltered(VascMenuType type) {
|
public VascPage getPage() {
|
||||||
if (type==null) {
|
|
||||||
throw new NullPointerException("Can't filter on null type.");
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
|
String pageId = (String)((ServletRequest)context.getExternalContext().getRequest()).getAttribute("pageId");
|
||||||
|
|
||||||
|
if (pageId==null) {
|
||||||
|
return null; // todo send somewhere
|
||||||
}
|
}
|
||||||
List<VascMenu> result = new ArrayList<VascMenu>(15);
|
if (page!=null && page.getSlug().equals(pageId)) {
|
||||||
for (VascMenu menu:fetchVascMenu()) {
|
return page;
|
||||||
if (type.equals(menu.getMenuType())) {
|
}
|
||||||
result.add(menu);
|
|
||||||
|
page = fetchVascPage(pageId);
|
||||||
|
page.getPageParts().addAll(fetchVascPageParts(page.getId()));
|
||||||
|
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String renderContent(VascPagePart part) {
|
||||||
|
if (part==null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (VascPagePartType.HTML.equals(part.getPartType())) {
|
||||||
|
return part.getText();
|
||||||
|
} else if (VascPagePartType.PRE.equals(part.getPartType())) {
|
||||||
|
return "<pre>"+part.getText()+"</pre>\n";
|
||||||
|
} else {
|
||||||
|
MediaWikiParserFactory pf = new MediaWikiParserFactory();
|
||||||
|
MediaWikiParser parser = pf.createParser();
|
||||||
|
ParsedPage page = parser.parse(part.getText());
|
||||||
|
String result = FixedHtmlWriter.parsedPageToHtml(page);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class FixedHtmlWriter extends HtmlWriter {
|
||||||
|
public static String parsedPageToHtml( ParsedPage pp ){
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
|
||||||
|
if( pp != null ) {
|
||||||
|
//Title
|
||||||
|
result.append(
|
||||||
|
"<table class=\"ParsedPage\">\n"+
|
||||||
|
"<tr><th class=\"ParsedPage\">ParsedPage: \n" +
|
||||||
|
pp.getName()+
|
||||||
|
"</th></tr>\n");
|
||||||
|
|
||||||
|
//Sections
|
||||||
|
result.append(
|
||||||
|
"<tr><td class=\"ParsedPage\">\n" );
|
||||||
|
for( Section s: pp.getSections() ) {
|
||||||
|
result.append( invokePrivate("sectionToHtml",s));
|
||||||
|
}
|
||||||
|
result.append(
|
||||||
|
"</td></tr>\n");
|
||||||
|
|
||||||
|
//Categories
|
||||||
|
if( pp.getCategoryElement()!= null ){
|
||||||
|
result.append("<tr><td class=\"ParsedPage\">\n");
|
||||||
|
result.append("Categories:\n" + invokePrivate("contentElementToHtml",pp.getCategoryElement() ));
|
||||||
|
result.append("</td></tr>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Languages
|
||||||
|
if( pp.getLanguagesElement()!= null ){
|
||||||
|
result.append("<tr><td class=\"ParsedPage\">\n");
|
||||||
|
result.append("Languages:\n" + invokePrivate("contentElementToHtml",pp.getLanguagesElement() ));
|
||||||
|
result.append("</td></tr>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Finalize
|
||||||
|
result.append("</table>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static private String invokePrivate(String method,Object arg) {
|
||||||
|
for (Method m:FixedHtmlWriter.class.getDeclaredMethods()) {
|
||||||
|
if (m.getName().equals(method)) {
|
||||||
|
m.setAccessible(true);
|
||||||
|
try {
|
||||||
|
return (String)m.invoke(null, arg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
Collections.sort(result,vascMenuComparator);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<VascMenu> getMenuBarLeft() {
|
|
||||||
return getMenuFiltered(VascMenuType.BAR_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VascMenu> getMenuBarRight() {
|
|
||||||
return getMenuFiltered(VascMenuType.BAR_RIGHT);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the userController
|
* @return the userController
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009-2012 forwardfire.net All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.forwardfire.vasc.demo.tech.web.pages;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.faces.FactoryFinder;
|
||||||
|
import javax.faces.application.ViewExpiredException;
|
||||||
|
import javax.faces.component.UIViewRoot;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.faces.context.FacesContextFactory;
|
||||||
|
import javax.faces.lifecycle.Lifecycle;
|
||||||
|
import javax.faces.lifecycle.LifecycleFactory;
|
||||||
|
import javax.servlet.Filter;
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
|
import javax.servlet.FilterConfig;
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.ServletResponse;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VascPageServket
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Nov 29, 2012
|
||||||
|
*/
|
||||||
|
public class VascPageFilter implements Filter {
|
||||||
|
|
||||||
|
|
||||||
|
private Logger logger = null;
|
||||||
|
private String templateFile = null;
|
||||||
|
private ServletContext servletContext = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.servlet.Filter#destroy()
|
||||||
|
*/
|
||||||
|
public void destroy() {
|
||||||
|
servletContext = null;
|
||||||
|
templateFile = null;
|
||||||
|
logger = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
|
||||||
|
*/
|
||||||
|
public void init(FilterConfig config) throws ServletException {
|
||||||
|
logger = Logger.getLogger(VascPageFilter.class.getName());
|
||||||
|
servletContext = config.getServletContext();
|
||||||
|
templateFile = config.getInitParameter("templateFile");
|
||||||
|
if (templateFile==null) {
|
||||||
|
throw new ServletException("No templateFile init-param found.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
|
||||||
|
*/
|
||||||
|
public void doFilter(ServletRequest servletRequest,ServletResponse servletResponse,FilterChain chain) throws IOException, ServletException {
|
||||||
|
|
||||||
|
HttpServletRequest request = (HttpServletRequest)servletRequest;
|
||||||
|
HttpServletResponse response = (HttpServletResponse)servletResponse;
|
||||||
|
|
||||||
|
// request info
|
||||||
|
String path = request.getRequestURI();
|
||||||
|
String v = "/page/";
|
||||||
|
if (path.contains(v)) {
|
||||||
|
path = path.substring(path.indexOf(v)+v.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
// stuff to fill
|
||||||
|
String pageId = null;
|
||||||
|
String actionName = null;
|
||||||
|
String actionRecordId = null;
|
||||||
|
|
||||||
|
// parse request info
|
||||||
|
//path = path.substring(1); // rm /
|
||||||
|
int index = path.indexOf("/"); // check next /
|
||||||
|
String actionString = null;
|
||||||
|
if (index>0) {
|
||||||
|
actionString = path.substring(index+1);
|
||||||
|
pageId = path.substring(0,index);
|
||||||
|
} else {
|
||||||
|
pageId = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actionString!=null) {
|
||||||
|
index = actionString.indexOf("/");
|
||||||
|
String recordString = null;
|
||||||
|
if (index>0) {
|
||||||
|
recordString = actionString.substring(index+1);
|
||||||
|
actionName = actionString.substring(0,index);
|
||||||
|
} else {
|
||||||
|
actionName = actionString;
|
||||||
|
}
|
||||||
|
if (recordString!=null) {
|
||||||
|
actionRecordId = recordString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//log
|
||||||
|
if (logger.isLoggable(Level.FINE)) {
|
||||||
|
logger.log(Level.FINE,"pageId="+pageId+" actionName="+actionName+" actionRecordId="+actionRecordId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Acquire the FacesContext instance for this request
|
||||||
|
FacesContext facesContext = FacesContext.getCurrentInstance();
|
||||||
|
if (facesContext == null) {
|
||||||
|
FacesContextFactory facesContextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
|
||||||
|
LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
|
||||||
|
Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
|
||||||
|
|
||||||
|
facesContext = facesContextFactory.getFacesContext(servletContext, request, response, lifecycle);
|
||||||
|
ProtectedFacesContext.setFacesContextAsCurrentInstance(facesContext);
|
||||||
|
|
||||||
|
UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext,pageId+actionName);
|
||||||
|
facesContext.setViewRoot(viewRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add to request attributes
|
||||||
|
request.setAttribute("pageId", pageId);
|
||||||
|
|
||||||
|
// And dispatch to the vasc template file.
|
||||||
|
try {
|
||||||
|
request.getRequestDispatcher(templateFile).forward(request, response);
|
||||||
|
} catch (ViewExpiredException e) {
|
||||||
|
response.sendRedirect(request.getRequestURL().toString()); // lets try again
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private abstract static class ProtectedFacesContext extends FacesContext {
|
||||||
|
protected static void setFacesContextAsCurrentInstance(FacesContext facesContext) {
|
||||||
|
FacesContext.setCurrentInstance(facesContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
package net.forwardfire.vasc.demo.tech.web.pages.model;
|
package net.forwardfire.vasc.demo.tech.web.pages.model;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,10 +38,10 @@ public class VascPage {
|
||||||
private Integer id = null;
|
private Integer id = null;
|
||||||
private String slug = null;
|
private String slug = null;
|
||||||
private String title = null;
|
private String title = null;
|
||||||
private Boolean i18nKey = null;
|
|
||||||
private Boolean active = null;
|
private Boolean active = null;
|
||||||
private Boolean sitemap = null;
|
private Boolean sitemap = null;
|
||||||
private String roles = null;
|
private String roles = null;
|
||||||
|
private List<VascPagePart> pageParts = new ArrayList<VascPagePart>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the id
|
||||||
|
@ -81,20 +84,6 @@ public class VascPage {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the i18nKey
|
|
||||||
*/
|
|
||||||
public Boolean getI18nKey() {
|
|
||||||
return i18nKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param i18nKey the i18nKey to set
|
|
||||||
*/
|
|
||||||
public void setI18nKey(Boolean i18nKey) {
|
|
||||||
this.i18nKey = i18nKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the active
|
* @return the active
|
||||||
*/
|
*/
|
||||||
|
@ -119,7 +108,7 @@ public class VascPage {
|
||||||
/**
|
/**
|
||||||
* @param sitemap the sitemap to set
|
* @param sitemap the sitemap to set
|
||||||
*/
|
*/
|
||||||
public void setSiteMap(Boolean sitemap) {
|
public void setSitemap(Boolean sitemap) {
|
||||||
this.sitemap = sitemap;
|
this.sitemap = sitemap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,5 +124,19 @@ public class VascPage {
|
||||||
*/
|
*/
|
||||||
public void setRoles(String roles) {
|
public void setRoles(String roles) {
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the pageParts
|
||||||
|
*/
|
||||||
|
public List<VascPagePart> getPageParts() {
|
||||||
|
return pageParts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pageParts the pageParts to set
|
||||||
|
*/
|
||||||
|
public void setPageParts(List<VascPagePart> pageParts) {
|
||||||
|
this.pageParts = pageParts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,9 @@ package net.forwardfire.vasc.demo.tech.web.pages.model;
|
||||||
public class VascPagePart {
|
public class VascPagePart {
|
||||||
|
|
||||||
private Integer id = null;
|
private Integer id = null;
|
||||||
private VascPage vascPage = null;
|
private Integer pageId = null;
|
||||||
private String title = null;
|
private String title = null;
|
||||||
private String text = null;
|
private String text = null;
|
||||||
private Boolean i18nKey = null;
|
|
||||||
private Boolean active = null;
|
private Boolean active = null;
|
||||||
private Boolean sitemap = null;
|
private Boolean sitemap = null;
|
||||||
private Integer partOrder = null;
|
private Integer partOrder = null;
|
||||||
|
@ -58,19 +57,19 @@ public class VascPagePart {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the vascPage
|
* @return the pageId
|
||||||
*/
|
*/
|
||||||
public VascPage getVascPage() {
|
public Integer getPageId() {
|
||||||
return vascPage;
|
return pageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param vascPage the vascPage to set
|
* @param pageId the pageId to set
|
||||||
*/
|
*/
|
||||||
public void setVascPage(VascPage vascPage) {
|
public void setPageId(Integer pageId) {
|
||||||
this.vascPage = vascPage;
|
this.pageId = pageId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the title
|
* @return the title
|
||||||
*/
|
*/
|
||||||
|
@ -99,20 +98,6 @@ public class VascPagePart {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the i18nKey
|
|
||||||
*/
|
|
||||||
public Boolean getI18nKey() {
|
|
||||||
return i18nKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param i18nKey the i18nKey to set
|
|
||||||
*/
|
|
||||||
public void setI18nKey(Boolean i18nKey) {
|
|
||||||
this.i18nKey = i18nKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the active
|
* @return the active
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,6 +45,17 @@
|
||||||
</managed-property>
|
</managed-property>
|
||||||
</managed-bean>
|
</managed-bean>
|
||||||
|
|
||||||
|
<managed-bean>
|
||||||
|
<description>Controls the Pages</description>
|
||||||
|
<managed-bean-name>pageController</managed-bean-name>
|
||||||
|
<managed-bean-class>net.forwardfire.vasc.demo.tech.web.pages.VascPageController</managed-bean-class>
|
||||||
|
<managed-bean-scope>session</managed-bean-scope>
|
||||||
|
<managed-property>
|
||||||
|
<property-name>userController</property-name>
|
||||||
|
<value>#{userController}</value>
|
||||||
|
</managed-property>
|
||||||
|
</managed-bean>
|
||||||
|
|
||||||
<managed-bean>
|
<managed-bean>
|
||||||
<description>Controls Vasc Export Url Generator</description>
|
<description>Controls Vasc Export Url Generator</description>
|
||||||
<managed-bean-name>exportController</managed-bean-name>
|
<managed-bean-name>exportController</managed-bean-name>
|
||||||
|
|
|
@ -4,15 +4,17 @@
|
||||||
xmlns:jawr="https://jawr.dev.java.net/jsf/facelets"
|
xmlns:jawr="https://jawr.dev.java.net/jsf/facelets"
|
||||||
>
|
>
|
||||||
<ui:define name="page_title">
|
<ui:define name="page_title">
|
||||||
<h:outputText value="#{vascPageController.pageTitle}" />
|
<h:outputText value="#{pageController.page.title}" />
|
||||||
</ui:define>
|
</ui:define>
|
||||||
<ui:insert name="main_head_js">
|
<ui:insert name="main_head_js">
|
||||||
<jawr:script src="/jawr/wiki.js" />
|
<jawr:script src="/jawr/wiki.js" />
|
||||||
</ui:insert>
|
</ui:insert>
|
||||||
<ui:define name="page_content">
|
<ui:define name="page_content">
|
||||||
<ui:repeat var="part" value="#{vascPageController.pageParts}">
|
<ui:repeat var="part" value="#{pageController.page.pageParts}">
|
||||||
<h2><h:outputText value="#{part.title}"/></h2>
|
<h2><h:outputText value="#{part.title}"/></h2>
|
||||||
<h:outputText value="#{vascPageController.renderContent(part)}" escape="false"/>
|
<p>
|
||||||
|
<h:outputText value="#{pageController.renderContent(part)}" escape="false"/>
|
||||||
|
</p>
|
||||||
</ui:repeat>
|
</ui:repeat>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
@ -5,22 +5,24 @@
|
||||||
xmlns:f="http://java.sun.com/jsf/core"
|
xmlns:f="http://java.sun.com/jsf/core"
|
||||||
>
|
>
|
||||||
<div id="body-footer">
|
<div id="body-footer">
|
||||||
<div id="body-footer-text">
|
<div id="body-footer-content">
|
||||||
<span><h:outputText value="#{i18n['Application.web.footer.center']}"/></span>
|
<div id="body-footer-text">
|
||||||
</div>
|
<span><h:outputText value="#{i18n['Application.web.footer.center']}"/></span>
|
||||||
<div id="body-footer-menu">
|
</div>
|
||||||
<span>
|
<div id="body-footer-menu">
|
||||||
<h:outputText value="- "/>
|
<span>
|
||||||
<ui:repeat var="menuEntry" value="#{menuController.menuBarBottom}">
|
<h:outputText value="- "/>
|
||||||
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a><h:outputText value=" - "/>
|
<ui:repeat var="menuEntry" value="#{menuController.menuBarBottom}">
|
||||||
</ui:repeat>
|
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a><h:outputText value=" - "/>
|
||||||
</span>
|
</ui:repeat>
|
||||||
</div>
|
</span>
|
||||||
<div id="body-footer-copyright">
|
</div>
|
||||||
<span><h:outputText escape="false" value="#{i18n['Application.web.footer.left']}"/></span>
|
<div id="body-footer-copyright">
|
||||||
</div>
|
<span><h:outputText escape="false" value="#{i18n['Application.web.footer.left']}"/></span>
|
||||||
<div id="body-footer-version">
|
</div>
|
||||||
<span><h:outputText escape="false" value="#{i18n['Application.web.footer.right']}"/></span>
|
<div id="body-footer-version">
|
||||||
|
<span><h:outputText escape="false" value="#{i18n['Application.web.footer.right']}"/></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
@ -15,21 +15,5 @@
|
||||||
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a>
|
<a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a>
|
||||||
</ui:repeat>
|
</ui:repeat>
|
||||||
</div>
|
</div>
|
||||||
<div id="page-header-info">
|
|
||||||
<div id="page-header-info-body">
|
|
||||||
<h:form>
|
|
||||||
<h:outputLink rendered="#{facesContext.externalContext.isUserInRole('login') == false}" value="#{contextPathController.rootPath}/html/user/index.jsf">
|
|
||||||
<h:outputText value="#{i18n['Application.web.header.login']}"/>
|
|
||||||
</h:outputLink>
|
|
||||||
<h:panelGroup rendered="#{facesContext.externalContext.isUserInRole('login') == true}">
|
|
||||||
<h:commandLink actionListener="#{userController.logoutAction}">
|
|
||||||
<h:outputText value="#{i18n['Application.web.header.logout']}"/>
|
|
||||||
</h:commandLink>
|
|
||||||
<h:outputText value=" - "/>
|
|
||||||
<h:outputText value="#{userController.webUserName}"/>
|
|
||||||
</h:panelGroup>
|
|
||||||
</h:form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<ui:composition
|
||||||
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||||
|
xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:f="http://java.sun.com/jsf/core"
|
||||||
|
>
|
||||||
|
<div id="page-body-login">
|
||||||
|
<h:form>
|
||||||
|
<h:outputLink rendered="#{facesContext.externalContext.isUserInRole('login') == false}" value="#{contextPathController.rootPath}/html/user/index.jsf">
|
||||||
|
<h:outputText value="#{i18n['Application.web.header.login']}"/>
|
||||||
|
</h:outputLink>
|
||||||
|
<h:panelGroup rendered="#{facesContext.externalContext.isUserInRole('login') == true}">
|
||||||
|
<h:commandLink actionListener="#{userController.logoutAction}">
|
||||||
|
<h:outputText value="#{i18n['Application.web.header.logout']}"/>
|
||||||
|
</h:commandLink>
|
||||||
|
<h:outputText value=" - "/>
|
||||||
|
<h:outputText value="#{userController.webUserName}"/>
|
||||||
|
</h:panelGroup>
|
||||||
|
</h:form>
|
||||||
|
</div>
|
||||||
|
</ui:composition>
|
|
@ -5,17 +5,53 @@
|
||||||
xmlns:f="http://java.sun.com/jsf/core"
|
xmlns:f="http://java.sun.com/jsf/core"
|
||||||
>
|
>
|
||||||
<div id="body-deco-menu">
|
<div id="body-deco-menu">
|
||||||
|
<h:panelGroup rendered="#{not empty menuController.mainMenu0}">
|
||||||
|
<div class="body-deco-menu-group">
|
||||||
|
<h4>
|
||||||
|
<span><h:outputText value="#{i18n['menu.mainMenu0.title']}"/></span>
|
||||||
|
</h4>
|
||||||
|
<ul>
|
||||||
|
<ui:repeat var="menu" value="#{menuController.mainMenu0}">
|
||||||
|
<li><a href="#{contextPathController.rootPath}#{menu.href}" target="#{menu.target}" title="#{menu.title}">#{menu.title}</a></li>
|
||||||
|
</ui:repeat>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</h:panelGroup>
|
||||||
|
<h:panelGroup rendered="#{not empty menuController.mainMenu1}">
|
||||||
|
<div class="body-deco-menu-group">
|
||||||
|
<h4>
|
||||||
|
<span><h:outputText value="#{i18n['menu.mainMenu1.title']}"/></span>
|
||||||
|
</h4>
|
||||||
|
<ul>
|
||||||
|
<ui:repeat var="menu" value="#{menuController.mainMenu1}">
|
||||||
|
<li><a href="#{contextPathController.rootPath}#{menu.href}" target="#{menu.target}" title="#{menu.title}">#{menu.title}</a></li>
|
||||||
|
</ui:repeat>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</h:panelGroup>
|
||||||
|
<h:panelGroup rendered="#{not empty menuController.mainMenu2}">
|
||||||
|
<div class="body-deco-menu-group">
|
||||||
|
<h4>
|
||||||
|
<span><h:outputText value="#{i18n['menu.mainMenu2.title']}"/></span>
|
||||||
|
</h4>
|
||||||
|
<ul>
|
||||||
|
<ui:repeat var="menu" value="#{menuController.mainMenu2}">
|
||||||
|
<li><a href="#{contextPathController.rootPath}#{menu.href}" target="#{menu.target}" title="#{menu.title}">#{menu.title}</a></li>
|
||||||
|
</ui:repeat>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</h:panelGroup>
|
||||||
<ui:repeat var="menuGroup" value="#{menuController.vascMenuGroup}">
|
<ui:repeat var="menuGroup" value="#{menuController.vascMenuGroup}">
|
||||||
<div id="body-deco-menu-group">
|
<div class="body-deco-menu-group">
|
||||||
<h4>
|
<h4>
|
||||||
<span><h:outputText value="#{i18n[menuGroup.titleKey]}"/></span>
|
<span><h:outputText value="#{i18n[menuGroup.titleKey]}"/></span>
|
||||||
</h4>
|
</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<ui:repeat var="menu" value="#{menuGroup.menus}">
|
<ui:repeat var="menu" value="#{menuGroup.menus}">
|
||||||
<li><a href="#{contextPathController.rootPath}/vasc/#{menu.vascEntryId}/list,jsf" title="#{i18n[menu.titleKey]}">#{i18n[menu.titleKey]}</a></li>
|
<li><a href="#{contextPathController.rootPath}/vasc/#{menu.vascEntryId}/list.jsf" title="#{i18n[menu.titleKey]}">#{i18n[menu.titleKey]}</a></li>
|
||||||
</ui:repeat>
|
</ui:repeat>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</ui:repeat>
|
</ui:repeat>
|
||||||
</div>
|
</div>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
>
|
>
|
||||||
<f:view>
|
<f:view>
|
||||||
<div id="body-view">
|
<div id="body-view">
|
||||||
|
<ui:insert name="main_body_login">
|
||||||
|
<ui:include src="/WEB-INF/template/structure/main-body-login.xhtml"/>
|
||||||
|
</ui:insert>
|
||||||
<ui:insert name="main_body_header">
|
<ui:insert name="main_body_header">
|
||||||
<ui:include src="/WEB-INF/template/structure/main-body-header.xhtml"/>
|
<ui:include src="/WEB-INF/template/structure/main-body-header.xhtml"/>
|
||||||
</ui:insert>
|
</ui:insert>
|
||||||
|
@ -21,10 +24,10 @@
|
||||||
<h1><ui:insert name="page_title"/></h1>
|
<h1><ui:insert name="page_title"/></h1>
|
||||||
<h:messages globalOnly="true" />
|
<h:messages globalOnly="true" />
|
||||||
<ui:insert name="page_content"/>
|
<ui:insert name="page_content"/>
|
||||||
<ui:insert name="main_body_footer">
|
|
||||||
<ui:include src="/WEB-INF/template/structure/main-body-footer.xhtml"/>
|
|
||||||
</ui:insert>
|
|
||||||
</div>
|
</div>
|
||||||
|
<ui:insert name="main_body_footer">
|
||||||
|
<ui:include src="/WEB-INF/template/structure/main-body-footer.xhtml"/>
|
||||||
|
</ui:insert>
|
||||||
</div>
|
</div>
|
||||||
</ui:insert>
|
</ui:insert>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -212,27 +212,6 @@
|
||||||
<filter-name>vascFilter</filter-name>
|
<filter-name>vascFilter</filter-name>
|
||||||
<url-pattern>/vasc/*</url-pattern>
|
<url-pattern>/vasc/*</url-pattern>
|
||||||
<dispatcher>REQUEST</dispatcher>
|
<dispatcher>REQUEST</dispatcher>
|
||||||
<!-- <dispatcher>FORWARD</dispatcher> -->
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
<filter>
|
|
||||||
<display-name>VASC Filter</display-name>
|
|
||||||
<filter-name>vascFilterServerAdmin</filter-name>
|
|
||||||
<filter-class>net.forwardfire.vasc.frontend.web.jsf.VascRequestFacesFilter</filter-class>
|
|
||||||
<init-param>
|
|
||||||
<param-name>templateFile</param-name>
|
|
||||||
<param-value>/WEB-INF/template/page-vasc.jsf</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<param-name>vascControllerProvider</param-name>
|
|
||||||
<param-value>java:comp/env/vasc/server-admin@net.forwardfire.vasc.impl.jndi.JndiVascControllerProvider</param-value>
|
|
||||||
</init-param>
|
|
||||||
</filter>
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>vascFilterServerAdmin</filter-name>
|
|
||||||
<url-pattern>/server-admin/*</url-pattern>
|
|
||||||
<dispatcher>REQUEST</dispatcher>
|
|
||||||
<!-- <dispatcher>FORWARD</dispatcher> -->
|
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
|
@ -267,6 +246,23 @@
|
||||||
<url-pattern>/cxf/*</url-pattern>
|
<url-pattern>/cxf/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Page Filter -->
|
||||||
|
<filter>
|
||||||
|
<display-name>Page Filter</display-name>
|
||||||
|
<filter-name>pageFilter</filter-name>
|
||||||
|
<filter-class>net.forwardfire.vasc.demo.tech.web.pages.VascPageFilter</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>templateFile</param-name>
|
||||||
|
<param-value>/WEB-INF/template/page-wiki.jsf</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>pageFilter</filter-name>
|
||||||
|
<url-pattern>/page/*</url-pattern>
|
||||||
|
<dispatcher>REQUEST</dispatcher>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
<!-- Add header tags -->
|
<!-- Add header tags -->
|
||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
|
@ -297,14 +293,13 @@
|
||||||
|
|
||||||
<!-- Remote ejb -->
|
<!-- Remote ejb -->
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>EjbServerServlet</servlet-name>
|
<servlet-name>EjbServerServlet</servlet-name>
|
||||||
<servlet-class>org.apache.openejb.server.httpd.ServerServlet</servlet-class>
|
<servlet-class>org.apache.openejb.server.httpd.ServerServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
<servlet-mapping>
|
<servlet-name>EjbServerServlet</servlet-name>
|
||||||
<servlet-name>EjbServerServlet</servlet-name>
|
<url-pattern>/ejb/*</url-pattern>
|
||||||
<url-pattern>/ejb/*</url-pattern>
|
</servlet-mapping>
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
|
@ -1,334 +0,0 @@
|
||||||
|
|
||||||
body {
|
|
||||||
color:#000000;
|
|
||||||
background-color:#FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size:1.2em;
|
|
||||||
font-weight:bold;
|
|
||||||
padding-bottom:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
border-radius:3px;
|
|
||||||
display:block;
|
|
||||||
font-size:1.0em;
|
|
||||||
font-weight:bold;
|
|
||||||
padding:10px 10px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin:10px 10px 10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
border:none;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
margin-left:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration:underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* DIVS */
|
|
||||||
|
|
||||||
|
|
||||||
/* MENU */
|
|
||||||
|
|
||||||
#page_menu_left,#page_menu_right {
|
|
||||||
border-color:#DDCCCC;
|
|
||||||
border-style:solid;
|
|
||||||
border-width:0 0 1px 0;
|
|
||||||
vertical-align:bottom;
|
|
||||||
display:inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page_menu_right {
|
|
||||||
position:absolute;
|
|
||||||
bottom:0;
|
|
||||||
right:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page_menu_left a,#page_menu_right a {
|
|
||||||
border:1px solid #e0e0e0;
|
|
||||||
background-color:#DDCCCC;
|
|
||||||
border-bottom-width:0px;
|
|
||||||
text-align:center;
|
|
||||||
-moz-border-radius-topleft:3xp;
|
|
||||||
-moz-border-radius-topright:3xp;
|
|
||||||
-webkit-border-top-left-radius:3px;
|
|
||||||
-webkit-border-top-right-radius:3px;
|
|
||||||
-khtml-border-radius-topleft:3px;
|
|
||||||
-khtml-border-radius-topright:3px;
|
|
||||||
color:#000;
|
|
||||||
margin:0px 5px 0px 0px;
|
|
||||||
padding:3px 15px 2px 15px;
|
|
||||||
text-decoration:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page_menu_left a:hover,#page_menu_right a:hover {
|
|
||||||
text-decoration:none;
|
|
||||||
background-color:#fff;
|
|
||||||
border-color:#e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page_menu_left a.active,#page_menu_left a.active {
|
|
||||||
background-color:#fff;
|
|
||||||
font-weight:700;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page_user_info {
|
|
||||||
padding:5px;
|
|
||||||
position:absolute;
|
|
||||||
right:0;
|
|
||||||
top:0;
|
|
||||||
font-size:11px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TABLES */
|
|
||||||
/*
|
|
||||||
#m_content table {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
table.table5, table.rating_table {
|
|
||||||
border-collapse:collapse;
|
|
||||||
font-size:11px;
|
|
||||||
width:100%;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table5 th, table.rating_table th {
|
|
||||||
padding-top:5px;
|
|
||||||
padding-bottom:5px;
|
|
||||||
font-weight:700;
|
|
||||||
text-align:left;
|
|
||||||
vertical-align:top;
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table5 td, table.rating_table td {
|
|
||||||
vertical-align:top;
|
|
||||||
padding-top:5px;
|
|
||||||
padding-bottom:5px;
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataTableHeaderRow {
|
|
||||||
border:1px solid #e0e0e0;
|
|
||||||
background-color:#e4e4e4;
|
|
||||||
border-bottom-width:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataTableHeaderRow th, td {
|
|
||||||
padding-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table input,table select {
|
|
||||||
font-size: 11px;
|
|
||||||
margin-left:6px;
|
|
||||||
margin-right:6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.table5 tr:nth-child(even) {
|
|
||||||
background-color:#f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table_options_top {
|
|
||||||
-moz-border-radius-topleft:3px;
|
|
||||||
-moz-border-radius-topright:3px;
|
|
||||||
background-color:#DDCCCC;
|
|
||||||
font-size:12px;
|
|
||||||
font-weight:700;
|
|
||||||
padding:6px 15px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table_options_bottom {
|
|
||||||
-moz-border-radius-bottomleft:3px;
|
|
||||||
-moz-border-radius-bottomright:3px;
|
|
||||||
background-color:#DDCCCC;
|
|
||||||
font-size:12px;
|
|
||||||
font-weight:700;
|
|
||||||
padding:6px 15px;
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
margin-top:5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.table_sub_header {
|
|
||||||
-moz-border-radius-topleft:5px;
|
|
||||||
-moz-border-radius-topright:5px;
|
|
||||||
background-color:#EEEEEE;
|
|
||||||
border:1px solid #BBBBBB;
|
|
||||||
display:block;
|
|
||||||
font-size:14px;
|
|
||||||
font-weight:700;
|
|
||||||
margin:0 2px;
|
|
||||||
padding:3px 6px;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* MESSAGES */
|
|
||||||
|
|
||||||
.message_info,
|
|
||||||
.message_1 {
|
|
||||||
display:block;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
border:solid 1px #a0ff7d;
|
|
||||||
-moz-border-radius:3px;
|
|
||||||
-webkit-border-radius:3px;
|
|
||||||
-khtml-border-radius:3px;
|
|
||||||
background-color: #a0ff7d;
|
|
||||||
padding: 15px 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message_warning,
|
|
||||||
.message_2 {
|
|
||||||
display:block;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
border:solid 1px #ffae4c;
|
|
||||||
-moz-border-radius:3px;
|
|
||||||
-webkit-border-radius:3px;
|
|
||||||
-khtml-border-radius:3px;
|
|
||||||
background-color: #ffae4c;
|
|
||||||
padding: 15px 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message_error,
|
|
||||||
.message_3 {
|
|
||||||
display:block;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
border:solid 1px #ff5b43;
|
|
||||||
-moz-border-radius:3px;
|
|
||||||
-webkit-border-radius:3px;
|
|
||||||
-khtml-border-radius:3px;
|
|
||||||
background-color: #ff5b43;
|
|
||||||
padding: 15px 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message_4 {
|
|
||||||
display:block;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
border:solid 1px #fc9200;
|
|
||||||
background-color: #fc9200;
|
|
||||||
-moz-border-radius-topleft:3px;
|
|
||||||
-webkit-border-top-left-radius:3px;
|
|
||||||
-khtml-border-radius-topleft:3px;
|
|
||||||
-moz-border-radius-topright:3px;
|
|
||||||
-webkit-border-top-right-radius:3px;
|
|
||||||
-khtml-border-radius-topright:3px;
|
|
||||||
padding: 5px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message_1 input, .message_1 button, .message_2 input, .message_2 button, .message_3 input, .message_3 button {
|
|
||||||
margin:0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message_4 h2 {
|
|
||||||
margin: 0px;
|
|
||||||
padding:5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message_4 input {
|
|
||||||
margin: 0px;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 2px 5px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* LOGINBOX */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** WIKI styles
|
|
||||||
*/
|
|
||||||
|
|
||||||
#toc,
|
|
||||||
.toc,
|
|
||||||
.mw-warning {
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
padding: 5px;
|
|
||||||
font-size: 95%;
|
|
||||||
}
|
|
||||||
#toc h2,
|
|
||||||
.toc h2 {
|
|
||||||
display: inline;
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
font-size: 100%;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
#toc #toctitle,
|
|
||||||
.toc #toctitle,
|
|
||||||
#toc .toctitle,
|
|
||||||
.toc .toctitle {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#toc ul,
|
|
||||||
.toc ul {
|
|
||||||
list-style-type: none;
|
|
||||||
list-style-image: none;
|
|
||||||
margin-left: 0;
|
|
||||||
padding-left: 0;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
#toc ul ul,
|
|
||||||
.toc ul ul {
|
|
||||||
margin: 0 0 0 2em;
|
|
||||||
}
|
|
||||||
#toc .toctoggle,
|
|
||||||
.toc .toctoggle {
|
|
||||||
font-size: 94%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumbcaption {
|
|
||||||
border: none;
|
|
||||||
text-align: left;
|
|
||||||
line-height: 1.4em;
|
|
||||||
padding: 3px !important;
|
|
||||||
font-size: 94%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.location-right {
|
|
||||||
clear: right;
|
|
||||||
float: right;
|
|
||||||
border-width: .5em 0 .8em 1.4em;
|
|
||||||
}
|
|
||||||
.location-left {
|
|
||||||
float: left;
|
|
||||||
clear: left;
|
|
||||||
margin-right: .5em;
|
|
||||||
border-width: .5em 1.4em .8em 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
#body-content {
|
#body-content {
|
||||||
margin-left: 200px;
|
margin-left: 210px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,38 +23,40 @@ body {
|
||||||
|
|
||||||
#page-header-left {
|
#page-header-left {
|
||||||
float:left;
|
float:left;
|
||||||
margin-left: 200px;
|
margin-left: 210px;
|
||||||
}
|
|
||||||
|
|
||||||
#page-header-info {
|
|
||||||
float:right;
|
|
||||||
padding-right: 20%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#page-header-right {
|
#page-header-right {
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|
||||||
#page-header-left,#page-header-right {
|
#page-header-left,#page-header-right {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#page-body-login {
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#body-deco-logo {
|
||||||
|
position: absolute;
|
||||||
|
right: 5px;
|
||||||
|
top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#body-deco-menu {
|
||||||
|
position: absolute;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
#body-footer {
|
#body-footer {
|
||||||
text-align: center;
|
margin-left: 210px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#body-footer-content {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin-left:20em;
|
margin-left:20em;
|
||||||
margin-right:20em;
|
margin-right:20em;
|
||||||
margin-top:1em;
|
margin-top:1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#body-deco-logo {
|
|
||||||
position: absolute;
|
|
||||||
right: 20px;
|
|
||||||
top: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#body-deco-menu {
|
|
||||||
float: left;
|
|
||||||
width: 190px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -8,28 +8,52 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
#body-content {
|
#body-content {
|
||||||
|
min-height: 400px;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
border-bottom-left-radius:3px;
|
border-bottom-left-radius:5px;
|
||||||
border-bottom-right-radius:3px;
|
border-bottom-right-radius:5px;
|
||||||
background-image: url(/demo/img/skin/default/body-view-bg.png);
|
background-image: url(/demo/img/skin/default/body-view-bg.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
#page-header-left a,#page-header-right a,#page-header-info-body {
|
#page-body-login {
|
||||||
|
text-align: center;
|
||||||
|
height: 28px;
|
||||||
|
width: 198px;
|
||||||
|
padding-top: 7px;
|
||||||
|
border: 1px solid #BBBBBB;
|
||||||
|
border-top: none;
|
||||||
|
border-bottom-left-radius:5px;
|
||||||
|
border-bottom-right-radius:5px;
|
||||||
|
background-image: url(/demo/img/skin/default/body-view-bg.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
#page-header-left a,#page-header-right a {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
padding-bottom:5px;
|
padding-bottom:5px;
|
||||||
}
|
}
|
||||||
#page-header-left a,#page-header-right a,#page-header-info-body {
|
#page-header-left a,#page-header-right a {
|
||||||
background-color:#DDCCCC;
|
background-color:#DDCCCC;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
border-top-left-radius:5px;
|
border-top-left-radius:5px;
|
||||||
border-top-right-radius:5px;
|
border-top-right-radius:5px;
|
||||||
}
|
}
|
||||||
|
#page-header-left a {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
#page-header-right a {
|
||||||
|
margin-left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
#body-footer {
|
#body-footer {
|
||||||
border-color:#e5e5e5;
|
margin-top: 10px;
|
||||||
border-style:solid;
|
border: 1px solid #BBBBBB;
|
||||||
border-width:1px 1px 1px 1px;
|
border-radius:5px;
|
||||||
border-radius:3px;
|
background-image: url(/demo/img/skin/default/body-view-bg.png);
|
||||||
|
}
|
||||||
|
|
||||||
|
#body-footer-content {
|
||||||
|
text-align:center;
|
||||||
|
font-size:80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,9 +66,7 @@ h1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
float: right;
|
|
||||||
margin-top: -45px;
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
color: #2d1100;
|
color: #2d1100;
|
||||||
}
|
}
|
||||||
|
@ -67,50 +89,22 @@ h3 span {
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.body-deco-menu-group {
|
||||||
/*
|
|
||||||
|
|
||||||
#summary {
|
|
||||||
float: left;
|
|
||||||
width: 200px;
|
|
||||||
margin-right: 15px;
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 5px;
|
|
||||||
font-family: Georgia, serif;
|
|
||||||
font-style: italic;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#body-deco-logo {
|
|
||||||
|
|
||||||
}
|
|
||||||
#body-deco-menu {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#body-deco-logo-div,#body-deco-menu0-div,#body-deco-menu1-div,#body-deco-menu2-div {
|
|
||||||
/*
|
|
||||||
font: 10px verdana, sans-serif;
|
|
||||||
padding: 10px;
|
|
||||||
margin-top: 130px;
|
|
||||||
width: 130px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
background-image: url(../../../img/skin/default/wrapper2.png);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#body-deco-menu-group {
|
|
||||||
padding:5px;
|
padding:5px;
|
||||||
|
margin-top: 5px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
border: 1px solid #BBBBBB;
|
border: 1px solid #BBBBBB;
|
||||||
background-image: url(/demo/img/skin/default/body-view-bg.png);
|
background-image: url(/demo/img/skin/default/body-view-bg.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.body-deco-menu-group ul {
|
||||||
|
margin-left: 5px;
|
||||||
|
padding-left: 0px;
|
||||||
|
list-style:none;
|
||||||
|
font-size:80%;
|
||||||
|
}
|
||||||
|
|
||||||
.rf-p {
|
.rf-p {
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
border: 1px solid #BBBBBB;
|
border: 1px solid #BBBBBB;
|
||||||
|
|
|
@ -6,15 +6,15 @@ body {
|
||||||
|
|
||||||
|
|
||||||
input:hover,textarea:hover,select:hover{
|
input:hover,textarea:hover,select:hover{
|
||||||
border: 2px solid rgba(100, 224, 64, 0.6);
|
border: 2px solid rgba(10, 224, 64, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.even {
|
.even {
|
||||||
background-color:rgba(70, 180, 60, 0.6);
|
background-color:rgba(70, 18, 60, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.odd {
|
.odd {
|
||||||
background-color:rgba(10, 230, 120, 0.6);
|
background-color:rgba(180, 230, 12, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
#page-header-left a,#page-header-right a,#page-header-info-body,.rf-dt-shdr-c a,.table_sub_header {
|
#page-header-left a,#page-header-right a,#page-header-info-body,.rf-dt-shdr-c a,.table_sub_header {
|
||||||
|
@ -26,6 +26,6 @@ input:hover,textarea:hover,select:hover{
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.actionboxtab li a:hover,#page-header-left a:hover,#page-header-right a:hover,#page-header-info-body:hover {
|
ul.actionboxtab li a:hover,#page-header-left a:hover,#page-header-right a:hover,#page-header-info-body:hover {
|
||||||
background-color:rgba(65, 182, 33, 0.6);
|
background-color:rgba(65, 18, 33, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
>
|
>
|
||||||
<ui:define name="page_title">Admin Index</ui:define>
|
<ui:define name="page_title">Admin Index</ui:define>
|
||||||
<ui:define name="page_content">
|
<ui:define name="page_content">
|
||||||
<h:panelGrid columns="4" id="grid" width="100%">
|
<h:panelGrid columns="2" id="grid" width="60%">
|
||||||
<rich:panel>
|
<rich:panel>
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText value="Vasc Admin" />
|
<h:outputText value="Vasc Admin" />
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
</h:outputLink>
|
</h:outputLink>
|
||||||
</h:panelGrid>
|
</h:panelGrid>
|
||||||
</h:form>
|
</h:form>
|
||||||
|
<br/>
|
||||||
</rich:panel>
|
</rich:panel>
|
||||||
<rich:panel>
|
<rich:panel>
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
|
|
|
@ -7,23 +7,7 @@
|
||||||
>
|
>
|
||||||
<ui:define name="page_title">Index</ui:define>
|
<ui:define name="page_title">Index</ui:define>
|
||||||
<ui:define name="page_content">
|
<ui:define name="page_content">
|
||||||
<h:panelGrid columns="2" id="grid" width="100%">
|
<p>Welcome to the vasc tech demo.</p>
|
||||||
<rich:panel rendered="#{not empty menuController.menuPageIndex}" >
|
<p>Please login to see more options.</p>
|
||||||
<f:facet name="header">
|
</ui:define>
|
||||||
<h:outputText value="Pages" />
|
|
||||||
</f:facet>
|
|
||||||
<ul>
|
|
||||||
<ui:repeat var="menuEntry" value="#{menuController.menuPageIndex}">
|
|
||||||
<li><a href="#{contextPathController.rootPath}#{menuEntry.href}" title="#{menuEntry.title}" target="#{menuEntry.target}">#{menuEntry.title}</a></li>
|
|
||||||
</ui:repeat>
|
|
||||||
</ul>
|
|
||||||
</rich:panel>
|
|
||||||
<rich:panel>
|
|
||||||
<f:facet name="header">
|
|
||||||
<h:outputText value="Welcome" />
|
|
||||||
</f:facet>
|
|
||||||
<h:outputText value="todo" />
|
|
||||||
</rich:panel>
|
|
||||||
</h:panelGrid>
|
|
||||||
</ui:define>
|
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
|
@ -16,11 +16,12 @@
|
||||||
<f:facet name="header">
|
<f:facet name="header">
|
||||||
<h:outputText value="Select skin" />
|
<h:outputText value="Select skin" />
|
||||||
</f:facet>
|
</f:facet>
|
||||||
<select name="theme" id="skinSwicther" onchange="JAWR.skin.switchToStyle(this.value);">
|
<p>Select theme</p>
|
||||||
<option value="default">Default</option>
|
<ul>
|
||||||
<option value="pink">Pink Skin</option>
|
<li><a href="/" onclick="JAWR.skin.switchToStyle('default');window.location.reload();return false;">Default</a></li>
|
||||||
<option value="green">Green Skin</option>
|
<li><a href="/" onclick="JAWR.skin.switchToStyle('notheme');window.location.reload();return false;">No Thema</a></li>
|
||||||
</select>
|
<li><a href="/" onclick="JAWR.skin.switchToStyle('green');window.location.reload();return false;">Green</a></li>
|
||||||
|
</ul>
|
||||||
</rich:panel>
|
</rich:panel>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
17
vasc-export/.project
Normal file
17
vasc-export/.project
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>vasc-export</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
18
vasc-export/pom.xml
Normal file
18
vasc-export/pom.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>net.forwardfire.vasc</groupId>
|
||||||
|
<artifactId>vasc</artifactId>
|
||||||
|
<version>0.4.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>vasc-export</artifactId>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>vasc-export</name>
|
||||||
|
<description>vasc-export</description>
|
||||||
|
<modules>
|
||||||
|
<module>vasc-export-jr4o</module>
|
||||||
|
<module>vasc-export-json</module>
|
||||||
|
<module>vasc-export-generic</module>
|
||||||
|
</modules>
|
||||||
|
</project>
|
23
vasc-export/vasc-export-generic/.project
Normal file
23
vasc-export/vasc-export-generic/.project
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>vasc-export-generic</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
18
vasc-export/vasc-export-generic/pom.xml
Normal file
18
vasc-export/vasc-export-generic/pom.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export</artifactId>
|
||||||
|
<version>0.4.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>vasc-export-generic</artifactId>
|
||||||
|
<name>vasc-export-generic</name>
|
||||||
|
<description>vasc-export-generic</description>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.forwardfire.vasc</groupId>
|
||||||
|
<artifactId>vasc-core</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -20,78 +20,89 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.forwardfire.vasc.impl.entry.export;
|
package net.forwardfire.vasc.export.generic;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.VascEntryField;
|
import net.forwardfire.vasc.core.VascEntryField;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VascEntryExporterCsv writes data to csv output format.
|
* AbstractVascEntryExportWriter make read of paged data into methods.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Mar 30, 2007
|
* @version 1.0 Nov 23, 2012
|
||||||
*/
|
*/
|
||||||
public class VascEntryExporterCsv implements VascEntryExporter {
|
@SuppressWarnings("serial")
|
||||||
|
abstract public class AbstractVascEntryExportWriter implements VascEntryExportWriter {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2770924442917617161L;
|
private VascEntryExport vascEntryExport = null;
|
||||||
static public final String EXPORT_TYPE = "csv";
|
private VascEntry vascEntry = null;
|
||||||
|
|
||||||
/**
|
public void doInit(VascEntryExport vascEntryExport,VascEntry vascEntry) throws VascException {
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId()
|
this.vascEntryExport=vascEntryExport;
|
||||||
*/
|
this.vascEntry=vascEntry;
|
||||||
public String getId() {
|
|
||||||
return EXPORT_TYPE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void doExport(OutputStream out) throws IOException,VascException {
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
|
|
||||||
*/
|
|
||||||
public void doExport(OutputStream out, VascEntry entry) throws VascException {
|
|
||||||
PrintWriter p = new PrintWriter(out);
|
|
||||||
p.write("# csv\n");
|
|
||||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
|
||||||
p.write(c.getId()+"\t");
|
|
||||||
}
|
|
||||||
p.write("\n");
|
|
||||||
|
|
||||||
|
doExportInit(out);
|
||||||
|
doExportStart();
|
||||||
|
|
||||||
|
VascEntry entry = getVascEntry();
|
||||||
int oldIndex = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex();
|
int oldIndex = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex();
|
||||||
Long total = entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords();
|
Long total = entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords();
|
||||||
int pages = total.intValue()/entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageSize();
|
int pages = total.intValue()/entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageSize();
|
||||||
for (int page=0;page<=pages;page++) {
|
for (int page=0;page<=pages;page++) {
|
||||||
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(page);
|
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(page);
|
||||||
entry.getVascFrontendController().getVascFrontendActions().refreshData();
|
entry.getVascFrontendController().getVascFrontendActions().refreshData();
|
||||||
for (Object o:entry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
|
||||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
int dataSize = entry.getVascFrontendController().getVascEntryState().getEntryDataList().size();
|
||||||
p.write(c.getVascEntryFieldValue().getDisplayValue(c, o)+"\t");
|
for (int dataIndex=0;dataIndex<dataSize;dataIndex++) {
|
||||||
}
|
Object o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
|
||||||
p.write("\n");
|
doExportRowStart(o);
|
||||||
p.flush();
|
doExportRowFields(o);
|
||||||
|
doExportRowEnd(o,(dataIndex==dataSize-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.write("# end\n");
|
doExportEnd();
|
||||||
p.flush();
|
|
||||||
|
|
||||||
// restore old page size
|
// restore old page size
|
||||||
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
|
entry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected VascEntry getVascEntry() {
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType()
|
return vascEntry;
|
||||||
*/
|
|
||||||
public String getMineType() {
|
|
||||||
return "text/csv";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
protected VascEntryExport getVascEntryExport() {
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType()
|
return vascEntryExport;
|
||||||
*/
|
|
||||||
public String getFileType() {
|
|
||||||
return EXPORT_TYPE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract protected void doExportInit(OutputStream out);
|
||||||
|
|
||||||
|
abstract protected void doExportStart() throws IOException;
|
||||||
|
abstract protected void doExportEnd() throws IOException;
|
||||||
|
|
||||||
|
abstract protected void doExportRowStart(Object row) throws IOException;
|
||||||
|
abstract protected void doExportRowEnd(Object row,boolean isLast) throws IOException;
|
||||||
|
|
||||||
|
protected void doExportRowFields(Object row) throws IOException,VascException {
|
||||||
|
// todo: rm me and use data selector
|
||||||
|
List<VascEntryField> fieldList = new ArrayList<VascEntryField>(getVascEntry().getVascEntryFields());
|
||||||
|
int fields = fieldList.size();
|
||||||
|
for (int i=0;i<fields;i++) {
|
||||||
|
VascEntryField c = fieldList.get(i);
|
||||||
|
doExportRowField(row,c,(i==fields-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascException;
|
||||||
}
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.forwardfire.vasc.export.generic;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import net.forwardfire.vasc.core.VascEntryField;
|
||||||
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VascEntryExporterCsv writes data to csv output format.
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Mar 30, 2007
|
||||||
|
*/
|
||||||
|
public class VascEntryExportWriterCsv extends AbstractVascEntryExportWriter {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2770924442917617161L;
|
||||||
|
static public final String EXPORT_TYPE = "csv";
|
||||||
|
private PrintWriter p = null;
|
||||||
|
private CsvSeparator separatorChar = CsvSeparator.SEMICOLON;
|
||||||
|
private CsvQuote quoteChar = CsvQuote.DOUBLE;
|
||||||
|
private CsvLineEnd lineEnd = CsvLineEnd.LF;
|
||||||
|
|
||||||
|
enum CsvSeparator {
|
||||||
|
TAB("\t"),
|
||||||
|
COMMA(","),
|
||||||
|
DOT("."),
|
||||||
|
COLON(":"),
|
||||||
|
SEMICOLON(";"),
|
||||||
|
EQUAL("="),
|
||||||
|
EQUALS("==");
|
||||||
|
final String charType;
|
||||||
|
CsvSeparator(String charType) {
|
||||||
|
this.charType=charType;
|
||||||
|
}
|
||||||
|
String toCharType() {
|
||||||
|
return charType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CsvQuote {
|
||||||
|
NONE(""),
|
||||||
|
SINGLE("'"),
|
||||||
|
DOUBLE("\"");
|
||||||
|
|
||||||
|
final String charType;
|
||||||
|
CsvQuote(String charType) {
|
||||||
|
this.charType=charType;
|
||||||
|
}
|
||||||
|
String toCharType() {
|
||||||
|
return charType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CsvLineEnd {
|
||||||
|
CR("\r"),
|
||||||
|
LF("\n"),
|
||||||
|
CRLF("\r\n");
|
||||||
|
|
||||||
|
final String charType;
|
||||||
|
CsvLineEnd(String charType) {
|
||||||
|
this.charType=charType;
|
||||||
|
}
|
||||||
|
String toCharType() {
|
||||||
|
return charType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportInit(OutputStream out) {
|
||||||
|
p = new PrintWriter(out);
|
||||||
|
String separatorCharString = getVascEntryExport().getWriterParameter("separatorChar");
|
||||||
|
if (separatorCharString!=null && separatorCharString.isEmpty()==false) {
|
||||||
|
separatorChar = CsvSeparator.valueOf(separatorCharString);
|
||||||
|
}
|
||||||
|
String quoteCharString = getVascEntryExport().getWriterParameter("quoteChar");
|
||||||
|
if (quoteCharString!=null && quoteCharString.isEmpty()==false) {
|
||||||
|
quoteChar = CsvQuote.valueOf(quoteCharString);
|
||||||
|
}
|
||||||
|
String lineEndString = getVascEntryExport().getWriterParameter("lineEnd");
|
||||||
|
if (lineEndString!=null && lineEndString.isEmpty()==false) {
|
||||||
|
lineEnd = CsvLineEnd.valueOf(lineEndString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportStart() {
|
||||||
|
//p.write("# csv\n");
|
||||||
|
for (VascEntryField c:getVascEntry().getVascEntryFields()) {
|
||||||
|
p.write(c.getId()+separatorChar.toCharType());
|
||||||
|
}
|
||||||
|
p.write(lineEnd.toCharType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportEnd() {
|
||||||
|
p.write("#EOF end-of-file");
|
||||||
|
p.write(lineEnd.toCharType());
|
||||||
|
p.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowStart(Object row) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowEnd(Object row,boolean isLast) {
|
||||||
|
p.write(lineEnd.toCharType());
|
||||||
|
p.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException {
|
||||||
|
p.write(quoteChar.toCharType());
|
||||||
|
p.write(c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||||
|
p.write(quoteChar.toCharType());
|
||||||
|
if (isLast==false) {
|
||||||
|
p.write(separatorChar.toCharType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#getMineType()
|
||||||
|
*/
|
||||||
|
public String getMineType() {
|
||||||
|
return "text/csv";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#getFileType()
|
||||||
|
*/
|
||||||
|
public String getFileType() {
|
||||||
|
return EXPORT_TYPE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.forwardfire.vasc.export.generic;
|
||||||
|
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import net.forwardfire.vasc.core.VascEntryField;
|
||||||
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VascEntryExportWriterXml writes entry data to xml format.
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Mar 30, 2007
|
||||||
|
*/
|
||||||
|
public class VascEntryExportWriterXml extends AbstractVascEntryExportWriter {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3719424578585760828L;
|
||||||
|
static public final String EXPORT_TYPE = "xml";
|
||||||
|
private boolean xmlTree = false;
|
||||||
|
private PrintWriter p = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportInit(OutputStream out) {
|
||||||
|
p = new PrintWriter(out);
|
||||||
|
String xmlTreeString = getVascEntryExport().getWriterParameter("xmltree");
|
||||||
|
if (xmlTreeString!=null && "true".equalsIgnoreCase(xmlTreeString)) {
|
||||||
|
xmlTree = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportStart() {
|
||||||
|
p.write("<?xml version=\"1.0\"?>\n");
|
||||||
|
p.write("<data>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportEnd() {
|
||||||
|
p.write("</data>\n");
|
||||||
|
p.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowStart(Object row) {
|
||||||
|
p.write("\t<row>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowEnd(Object row,boolean isLast) {
|
||||||
|
p.write("\t</row>\n");
|
||||||
|
p.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException {
|
||||||
|
if (xmlTree) {
|
||||||
|
p.write("\t\t<"+c.getId()+"><![CDATA[");
|
||||||
|
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||||
|
p.write("]]></"+c.getId()+">\n");
|
||||||
|
} else {
|
||||||
|
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
|
||||||
|
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||||
|
p.write("]]></column>\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#getMineType()
|
||||||
|
*/
|
||||||
|
public String getMineType() {
|
||||||
|
return "text/xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#getFileType()
|
||||||
|
*/
|
||||||
|
public String getFileType() {
|
||||||
|
return EXPORT_TYPE;
|
||||||
|
}
|
||||||
|
}
|
23
vasc-export/vasc-export-jr4o/.project
Normal file
23
vasc-export/vasc-export-jr4o/.project
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>vasc-export-jr4o</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
23
vasc-export/vasc-export-jr4o/pom.xml
Normal file
23
vasc-export/vasc-export-jr4o/pom.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export</artifactId>
|
||||||
|
<version>0.4.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>vasc-export-jr4o</artifactId>
|
||||||
|
<name>vasc-export-jr4o</name>
|
||||||
|
<description>vasc-export-jr4o</description>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export-generic</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||||
|
<artifactId>vasc-lib-jr4o</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -20,7 +20,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.forwardfire.vasc.impl.entry.export;
|
package net.forwardfire.vasc.export.jr4o;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
|
@ -20,7 +20,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.forwardfire.vasc.impl.entry.export;
|
package net.forwardfire.vasc.export.jr4o;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -28,64 +28,55 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.forwardfire.vasc.core.VascEntry;
|
import net.forwardfire.vasc.core.VascEntry;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager;
|
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager;
|
||||||
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
|
import net.forwardfire.vasc.lib.jr4o.JR4ODesignManager.JRExportType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VascEntryExporterPdf creates an pdf view of the data.
|
* VascEntryExportWriterJR4O creates an pdf view of the data.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 May 11, 2012
|
* @version 1.0 May 11, 2012
|
||||||
*/
|
*/
|
||||||
public class VascEntryExporterJR4O implements VascEntryExporter {
|
public class VascEntryExportWriterJR4O implements VascEntryExportWriter {
|
||||||
|
|
||||||
private static final long serialVersionUID = -3951608685719832654L;
|
private static final long serialVersionUID = -3951608685719832654L;
|
||||||
static public final String EXPORT_TYPE = "pdf";
|
static public final String EXPORT_TYPE = "pdf";
|
||||||
private JRExportType reportType = null;
|
private VascEntry entry = null;
|
||||||
|
private JRExportType reportType = JRExportType.PDF;
|
||||||
private String reportResource = null;
|
private String reportResource = null;
|
||||||
private String reportName = null;
|
private String reportName = null;
|
||||||
private File reportFile = null;
|
private File reportFile = null;
|
||||||
private String id = null;
|
|
||||||
|
|
||||||
private VascEntryExporterJR4O(String id,JRExportType reportType,String reportName) {
|
|
||||||
if (reportName == null) {
|
|
||||||
throw new NullPointerException("Can't export null reportName.");
|
|
||||||
}
|
|
||||||
if (reportType == null) {
|
|
||||||
throw new NullPointerException("Can't export null reportType.");
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
this.reportType = reportType;
|
|
||||||
this.reportName = reportName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VascEntryExporterJR4O(String id,JRExportType reportType,String reportName,String reportResource) {
|
|
||||||
this(id,reportType,reportName);
|
|
||||||
this.reportResource=reportResource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VascEntryExporterJR4O(String id,JRExportType reportType,String reportName,File reportFile) {
|
|
||||||
this(id,reportType,reportName);
|
|
||||||
this.reportFile=reportFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getId()
|
* @see net.forwardfire.vasc.core.entry.VascEntryExportWriter#doInit(net.forwardfire.vasc.core.entry.VascEntryExport, net.forwardfire.vasc.core.VascEntry)
|
||||||
*/
|
*/
|
||||||
public String getId() {
|
@Override
|
||||||
return id;
|
public void doInit(VascEntryExport export, VascEntry vascEntry) throws VascException {
|
||||||
|
this.entry = vascEntry;
|
||||||
|
|
||||||
|
String reportTypeString = export.getWriterParameter("reportType");
|
||||||
|
if (reportTypeString!=null && reportTypeString.isEmpty()==false) {
|
||||||
|
reportType = JRExportType.valueOf(reportTypeString);
|
||||||
|
}
|
||||||
|
reportName = export.getWriterParameter("reportName");
|
||||||
|
if (reportName==null) {
|
||||||
|
throw new NullPointerException("Can work with null reportName parameter.");
|
||||||
|
}
|
||||||
|
|
||||||
|
String reportFileString = export.getWriterParameter("reportFile");
|
||||||
|
if (reportFileString!=null && reportFileString.isEmpty()==false) {
|
||||||
|
reportFile = new File(reportFileString);
|
||||||
|
}
|
||||||
|
reportResource = export.getWriterParameter("reportResource");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id=id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#doExport(java.io.OutputStream, net.forwardfire.vasc.core.VascEntry)
|
||||||
*/
|
*/
|
||||||
public void doExport(OutputStream out, VascEntry entry) throws VascException {
|
public void doExport(OutputStream out) throws VascException {
|
||||||
|
|
||||||
Map<String,Object> parameters = new HashMap<String,Object>(5);
|
Map<String,Object> parameters = new HashMap<String,Object>(5);
|
||||||
parameters.put("title", entry.getVascFrontendController().getVascEntryResourceResolver().getTextValue(entry.getName()));
|
parameters.put("title", entry.getVascFrontendController().getVascEntryResourceResolver().getTextValue(entry.getName()));
|
||||||
|
@ -113,14 +104,14 @@ public class VascEntryExporterJR4O implements VascEntryExporter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getMineType()
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#getMineType()
|
||||||
*/
|
*/
|
||||||
public String getMineType() {
|
public String getMineType() {
|
||||||
return "text/pdf";
|
return "text/pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.entry.VascEntryExporter#getFileType()
|
* @see net.forwardfire.vasc.core.entry.VascEntryExport#getFileType()
|
||||||
*/
|
*/
|
||||||
public String getFileType() {
|
public String getFileType() {
|
||||||
return EXPORT_TYPE;
|
return EXPORT_TYPE;
|
23
vasc-export/vasc-export-json/.project
Normal file
23
vasc-export/vasc-export-json/.project
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>vasc-export-json</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
23
vasc-export/vasc-export-json/pom.xml
Normal file
23
vasc-export/vasc-export-json/pom.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<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/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export</artifactId>
|
||||||
|
<version>0.4.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>vasc-export-json</artifactId>
|
||||||
|
<name>vasc-export-json</name>
|
||||||
|
<description>vasc-export-json</description>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.forwardfire.vasc.export</groupId>
|
||||||
|
<artifactId>vasc-export-generic</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<version>${json-simple.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.forwardfire.vasc.export.json;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.JSONValue;
|
||||||
|
|
||||||
|
import net.forwardfire.vasc.core.VascEntryField;
|
||||||
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
import net.forwardfire.vasc.export.generic.AbstractVascEntryExportWriter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VascEntryExportWriterJson exports the entry data to json format.
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Nov 23, 2012
|
||||||
|
*/
|
||||||
|
public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2965474124451161061L;
|
||||||
|
private PrintWriter p = null;
|
||||||
|
private Map<String,Object> rowData = null;
|
||||||
|
|
||||||
|
public VascEntryExportWriterJson() {
|
||||||
|
rowData = new HashMap<String,Object>(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMineType() {
|
||||||
|
return "text/json";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFileType() {
|
||||||
|
return "json";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportInit(OutputStream out) {
|
||||||
|
p = new PrintWriter(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeField(String key,String value) {
|
||||||
|
p.write("\"");
|
||||||
|
p.write(key);
|
||||||
|
p.write("\": \"");
|
||||||
|
p.write(JSONValue.escape(value));
|
||||||
|
p.write("\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportStart() {
|
||||||
|
p.write("{\"entry\": {\n");
|
||||||
|
writeField("id",getVascEntry().getId());
|
||||||
|
p.write(",\n");
|
||||||
|
writeField("vascGroupId",getVascEntry().getVascGroupId());
|
||||||
|
p.write(",\n");
|
||||||
|
p.write("\"data\": [\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportEnd() {
|
||||||
|
p.write("]\n");
|
||||||
|
p.write("}}\n");
|
||||||
|
p.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowStart(Object row) {
|
||||||
|
rowData.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowEnd(Object row,boolean isLast) throws IOException {
|
||||||
|
JSONObject.writeJSONString(rowData, p);
|
||||||
|
if (isLast==false) {
|
||||||
|
p.write(",");
|
||||||
|
}
|
||||||
|
p.write("\n");
|
||||||
|
p.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascException {
|
||||||
|
String key = field.getId();
|
||||||
|
Object data = field.getVascEntryFieldValue().getValue(field, row);
|
||||||
|
rowData.put(key, data);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author willemc
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.forwardfire.vasc.export.json;
|
|
@ -66,7 +66,8 @@ import net.forwardfire.vasc.core.VascEntryField;
|
||||||
import net.forwardfire.vasc.core.VascEntryListOption;
|
import net.forwardfire.vasc.core.VascEntryListOption;
|
||||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
||||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||||
|
@ -215,40 +216,40 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.core.VascViewRenderer#renderExport(net.forwardfire.vasc.core.VascEntry, net.forwardfire.vasc.core.VascDataExporter)
|
* @see net.forwardfire.vasc.core.VascViewRenderer#renderExport(net.forwardfire.vasc.core.VascEntry, net.forwardfire.vasc.core.VascDataExporter)
|
||||||
*/
|
*/
|
||||||
public void renderExport(VascEntryExporter exporter) throws VascFrontendException {
|
public void renderExport(VascEntryExport exporter) throws VascFrontendException {
|
||||||
|
|
||||||
String fileName = null;
|
String fileName = null;
|
||||||
JFileChooser c = new JFileChooser();
|
JFileChooser c = new JFileChooser();
|
||||||
int rVal = c.showSaveDialog(null);
|
int rVal = c.showSaveDialog(null);
|
||||||
if (rVal == JFileChooser.APPROVE_OPTION) {
|
if (rVal == JFileChooser.APPROVE_OPTION) {
|
||||||
fileName = c.getSelectedFile().getAbsolutePath();
|
fileName = c.getSelectedFile().getAbsolutePath();
|
||||||
// filename.setText(c.getSelectedFile().getName());
|
}
|
||||||
//dir.setText(c.getCurrentDirectory().toString());
|
if (rVal == JFileChooser.CANCEL_OPTION) {
|
||||||
}
|
return;
|
||||||
if (rVal == JFileChooser.CANCEL_OPTION) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.fine("FileName: "+fileName);
|
logger.fine("Export fileName: "+fileName);
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
try {
|
try {
|
||||||
out = new FileOutputStream(fileName);
|
VascEntryExportWriter veew = exporter.createExportWriter();
|
||||||
exporter.doExport(out, entry);
|
veew.doInit(exporter, entry);
|
||||||
} catch (VascException e) {
|
out = new FileOutputStream(fileName);
|
||||||
throw new VascFrontendException(e);
|
veew.doExport(out);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (VascException e) {
|
||||||
throw new VascFrontendException(e);
|
throw new VascFrontendException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new VascFrontendException(e);
|
||||||
} finally {
|
} finally {
|
||||||
if (out!=null) {
|
if (out!=null) {
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ import net.forwardfire.vasc.core.VascEntryListOption;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||||
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
||||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||||
|
@ -163,7 +164,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
||||||
/** These filter extensions are used to filter which files are displayed. */
|
/** These filter extensions are used to filter which files are displayed. */
|
||||||
private static final String[] FILTER_EXTS = { "*.*","*.csv","*.xls" };
|
private static final String[] FILTER_EXTS = { "*.*","*.csv","*.xls" };
|
||||||
|
|
||||||
public void renderExport(VascEntryExporter exporter) throws VascFrontendException {
|
public void renderExport(VascEntryExport exporter) throws VascFrontendException {
|
||||||
FileDialog dlg = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
|
FileDialog dlg = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
|
||||||
dlg.setFilterNames(FILTER_NAMES);
|
dlg.setFilterNames(FILTER_NAMES);
|
||||||
dlg.setFilterExtensions(FILTER_EXTS);
|
dlg.setFilterExtensions(FILTER_EXTS);
|
||||||
|
@ -175,13 +176,15 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
||||||
}
|
}
|
||||||
OutputStream out = null;
|
OutputStream out = null;
|
||||||
try {
|
try {
|
||||||
|
VascEntryExportWriter veew = exporter.createExportWriter();
|
||||||
|
veew.doInit(exporter, entry);
|
||||||
out = new FileOutputStream(fileName);
|
out = new FileOutputStream(fileName);
|
||||||
exporter.doExport(out, entry);
|
veew.doExport(out);
|
||||||
} catch (VascException e) {
|
} catch (VascException e) {
|
||||||
//MessageDialog.openError(Display.getCurrent().getActiveShell(),crudTable.i18n("crud.event.export.error.title"),crudTable.i18n("crud.event.export.error.message"));
|
//MessageDialog.openError(Display.getCurrent().getActiveShell(),crudTable.i18n("crud.event.export.error.title"),crudTable.i18n("crud.event.export.error.message"));
|
||||||
logger.log(Level.WARNING,"Error: "+e.getMessage(),e);
|
logger.log(Level.WARNING,"Error: "+e.getMessage(),e);
|
||||||
throw new VascFrontendException(e);
|
throw new VascFrontendException(e);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (IOException e) {
|
||||||
throw new VascFrontendException(e);
|
throw new VascFrontendException(e);
|
||||||
} finally {
|
} finally {
|
||||||
if (out!=null) {
|
if (out!=null) {
|
||||||
|
|
|
@ -34,7 +34,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import net.forwardfire.vasc.core.VascController;
|
import net.forwardfire.vasc.core.VascController;
|
||||||
import net.forwardfire.vasc.core.VascControllerProvider;
|
import net.forwardfire.vasc.core.VascControllerProvider;
|
||||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,14 +177,16 @@ public class VascExportServlet extends HttpServlet {
|
||||||
// Update total every time first
|
// Update total every time first
|
||||||
Long total = ve.getVascFrontendController().getVascEntryState().getVascBackend().fetchTotalExecuteSize(ve.getVascFrontendController().getVascEntryState().getVascBackendState());
|
Long total = ve.getVascFrontendController().getVascEntryState().getVascBackend().fetchTotalExecuteSize(ve.getVascFrontendController().getVascEntryState().getVascBackendState());
|
||||||
ve.getVascFrontendController().getVascEntryState().setTotalBackendRecords(total);
|
ve.getVascFrontendController().getVascEntryState().setTotalBackendRecords(total);
|
||||||
VascEntryExporter ex = vc.getVascEntryConfigController().getVascEntryExporterById(exportId);
|
VascEntryExport ex = vc.getVascEntryConfigController().getVascEntryExporterById(exportId);
|
||||||
|
VascEntryExportWriter exw = ex.createExportWriter();
|
||||||
|
exw.doInit(ex, ve);
|
||||||
|
|
||||||
String filename = entryId+"-export."+ex.getFileType();
|
String filename = entryId+"-export."+exw.getFileType();
|
||||||
response.setHeader("Content-disposition", "attachment; filename=" + filename);
|
response.setHeader("Content-disposition", "attachment; filename=" + filename);
|
||||||
String contentType = ex.getMineType();
|
String contentType = exw.getMineType();
|
||||||
response.setContentType(contentType);
|
response.setContentType(contentType);
|
||||||
|
|
||||||
ex.doExport(out, ve);
|
exw.doExport(out);
|
||||||
} catch (VascException e) {
|
} catch (VascException e) {
|
||||||
response.setStatus(500);
|
response.setStatus(500);
|
||||||
response.setContentType("text/html");
|
response.setContentType("text/html");
|
||||||
|
|
|
@ -58,7 +58,8 @@ import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||||
import net.forwardfire.vasc.core.VascException;
|
import net.forwardfire.vasc.core.VascException;
|
||||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
|
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||||
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
||||||
|
@ -88,7 +89,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
||||||
private Boolean backendPageable = null;
|
private Boolean backendPageable = null;
|
||||||
private Boolean sortOrder = null;
|
private Boolean sortOrder = null;
|
||||||
private String sortField = null;
|
private String sortField = null;
|
||||||
private VascEntryExporter selectedExporter = null;
|
private VascEntryExport selectedExporter = null;
|
||||||
private String selectedExporterAction = "null";
|
private String selectedExporterAction = "null";
|
||||||
private String selectedDirectPage = "null";
|
private String selectedDirectPage = "null";
|
||||||
private String selectedMultiRowAction = "null";
|
private String selectedMultiRowAction = "null";
|
||||||
|
@ -723,7 +724,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
||||||
|
|
||||||
// restore normal view for next request.
|
// restore normal view for next request.
|
||||||
comp.setRenderFacetState("listView");
|
comp.setRenderFacetState("listView");
|
||||||
VascEntryExporter ex = getSelectedExporter();
|
VascEntryExport ex = getSelectedExporter();
|
||||||
|
|
||||||
if (ex==null) {
|
if (ex==null) {
|
||||||
logger.fine("No exporter selected for download.");
|
logger.fine("No exporter selected for download.");
|
||||||
|
@ -733,15 +734,17 @@ public class JSFVascEntrySupportBean implements Serializable {
|
||||||
|
|
||||||
FacesContext fc = FacesContext.getCurrentInstance();
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
try {
|
try {
|
||||||
|
VascEntryExportWriter veew = ex.createExportWriter();
|
||||||
|
veew.doInit(ex, entry);
|
||||||
|
|
||||||
HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse();
|
HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse();
|
||||||
String filename = "export-list."+ex.getFileType();
|
String filename = "export-list."+veew.getFileType();
|
||||||
response.setHeader("Content-disposition", "attachment; filename=" + filename);
|
response.setHeader("Content-disposition", "attachment; filename=" + filename);
|
||||||
String contentType = ex.getMineType();
|
String contentType = veew.getMineType();
|
||||||
response.setContentType(contentType);
|
response.setContentType(contentType);
|
||||||
ServletOutputStream out = response.getOutputStream();
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
ex.doExport(out, entry);
|
veew.doExport(out);
|
||||||
out.close();
|
out.close();
|
||||||
} catch (VascException e) {
|
} catch (VascException e) {
|
||||||
throw new VascFrontendException(e);
|
throw new VascFrontendException(e);
|
||||||
|
@ -869,14 +872,14 @@ public class JSFVascEntrySupportBean implements Serializable {
|
||||||
/**
|
/**
|
||||||
* @return the selectedExporter
|
* @return the selectedExporter
|
||||||
*/
|
*/
|
||||||
public VascEntryExporter getSelectedExporter() {
|
public VascEntryExport getSelectedExporter() {
|
||||||
return selectedExporter;
|
return selectedExporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param selectedExporter the selectedExporter to set
|
* @param selectedExporter the selectedExporter to set
|
||||||
*/
|
*/
|
||||||
public void setSelectedExporter(VascEntryExporter selectedExporter) {
|
public void setSelectedExporter(VascEntryExport selectedExporter) {
|
||||||
this.selectedExporter = selectedExporter;
|
this.selectedExporter = selectedExporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.logging.Logger;
|
||||||
import javax.faces.component.UIViewRoot;
|
import javax.faces.component.UIViewRoot;
|
||||||
import javax.faces.context.FacesContext;
|
import javax.faces.context.FacesContext;
|
||||||
|
|
||||||
import net.forwardfire.vasc.core.entry.VascEntryExporter;
|
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||||
import net.forwardfire.vasc.frontend.VascFrontendController;
|
import net.forwardfire.vasc.frontend.VascFrontendController;
|
||||||
|
@ -116,9 +116,9 @@ public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Ser
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.forwardfire.vasc.frontend.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExporter)
|
* @see net.forwardfire.vasc.frontend.VascFrontend#renderExport(net.forwardfire.vasc.core.entry.VascEntryExport)
|
||||||
*/
|
*/
|
||||||
public void renderExport(VascEntryExporter exporter) throws VascFrontendException {
|
public void renderExport(VascEntryExport exporter) throws VascFrontendException {
|
||||||
logger.finer("renderExport");
|
logger.finer("renderExport");
|
||||||
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
|
||||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
|
JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId());
|
||||||
|
|
Loading…
Reference in a new issue