Mattia Gosetto
3 anni fa
10 ha cambiato i file con 256 aggiunte e 344 eliminazioni
@ -1,186 +1,176 @@
|
||||
package it.tref.liferay.portos.report.shared.dto; |
||||
|
||||
import com.liferay.portal.kernel.util.Validator; |
||||
|
||||
import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportType; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public class ReportDto { |
||||
import com.liferay.portal.kernel.util.Validator; |
||||
|
||||
private String type; |
||||
private long folderId; |
||||
private long[] fileEntryIds; |
||||
private String fileName; |
||||
private String[] css; |
||||
private String portalURL; |
||||
private boolean showNumberOfPage; |
||||
private Object dataSource; |
||||
private Map<String, Object> parameters; |
||||
private String header; |
||||
private int headerHeight; |
||||
private String footer; |
||||
private int footerHeight; |
||||
public class ReportDto { |
||||
|
||||
public ReportDto() { |
||||
private String type; |
||||
private long folderId; |
||||
private long[] fileEntryIds; |
||||
private String fileName; |
||||
private String[] css; |
||||
private String portalURL; |
||||
private boolean showNumberOfPage; |
||||
private Object dataSource; |
||||
private Map<String, Object> parameters; |
||||
private String header; |
||||
private int headerHeight; |
||||
private String footer; |
||||
private int footerHeight; |
||||
|
||||
} |
||||
public ReportDto() { |
||||
|
||||
public ReportDto(String type, long folderId, long[] fileEntryIds, String fileName, String[] css, String portalURL, |
||||
boolean showNumberOfPage, Object dataSource, Map<String, Object> parameters, String header, int headerHeight, |
||||
String footer, int footerHeight) { |
||||
} |
||||
|
||||
this(); |
||||
this.type = type; |
||||
this.folderId = folderId; |
||||
this.fileEntryIds = fileEntryIds; |
||||
this.fileName = fileName; |
||||
this.css = css; |
||||
this.portalURL = portalURL; |
||||
this.showNumberOfPage = showNumberOfPage; |
||||
this.dataSource = dataSource; |
||||
this.parameters = parameters; |
||||
this.header = header; |
||||
this.headerHeight = headerHeight; |
||||
this.footer = footer; |
||||
this.footerHeight = footerHeight; |
||||
} |
||||
public ReportDto(String type, long folderId, long[] fileEntryIds, String fileName, String[] css, String portalURL, |
||||
boolean showNumberOfPage, Object dataSource, Map<String, Object> parameters, String header, |
||||
int headerHeight, String footer, int footerHeight) { |
||||
|
||||
public String getType() { |
||||
this(); |
||||
this.type = type; |
||||
this.folderId = folderId; |
||||
this.fileEntryIds = fileEntryIds; |
||||
this.fileName = fileName; |
||||
this.css = css; |
||||
this.portalURL = portalURL; |
||||
this.showNumberOfPage = showNumberOfPage; |
||||
this.dataSource = dataSource; |
||||
this.parameters = parameters; |
||||
this.header = header; |
||||
this.headerHeight = headerHeight; |
||||
this.footer = footer; |
||||
this.footerHeight = footerHeight; |
||||
} |
||||
|
||||
return type; |
||||
} |
||||
public String getType() { |
||||
|
||||
public void setType(String type) { |
||||
return type; |
||||
} |
||||
|
||||
this.type = type; |
||||
} |
||||
public void setType(String type) { |
||||
|
||||
public long getFolderId() { |
||||
this.type = type; |
||||
} |
||||
|
||||
return folderId; |
||||
} |
||||
public long getFolderId() { |
||||
|
||||
public void setFolderId(long folderId) { |
||||
return folderId; |
||||
} |
||||
|
||||
this.folderId = folderId; |
||||
} |
||||
public void setFolderId(long folderId) { |
||||
|
||||
public long[] getFileEntryIds() { |
||||
this.folderId = folderId; |
||||
} |
||||
|
||||
return fileEntryIds; |
||||
} |
||||
public long[] getFileEntryIds() { |
||||
|
||||
public void setFileEntryIds(long[] fileEntryIds) { |
||||
return fileEntryIds; |
||||
} |
||||
|
||||
this.fileEntryIds = fileEntryIds; |
||||
} |
||||
public void setFileEntryIds(long[] fileEntryIds) { |
||||
|
||||
public String getFileName() { |
||||
this.fileEntryIds = fileEntryIds; |
||||
} |
||||
|
||||
return fileName; |
||||
} |
||||
public String getFileName() { |
||||
|
||||
public void setFileName(String fileName) { |
||||
return fileName; |
||||
} |
||||
|
||||
this.fileName = fileName; |
||||
} |
||||
public void setFileName(String fileName) { |
||||
|
||||
public String[] getCss() { |
||||
this.fileName = fileName; |
||||
} |
||||
|
||||
return css; |
||||
} |
||||
public String[] getCss() { |
||||
|
||||
public void setCss(String[] css) { |
||||
return css; |
||||
} |
||||
|
||||
this.css = css; |
||||
} |
||||
public void setCss(String[] css) { |
||||
|
||||
public String getPortalURL() { |
||||
this.css = css; |
||||
} |
||||
|
||||
return portalURL; |
||||
} |
||||
public String getPortalURL() { |
||||
|
||||
public void setPortalURL(String portalURL) { |
||||
return portalURL; |
||||
} |
||||
|
||||
this.portalURL = portalURL; |
||||
} |
||||
public void setPortalURL(String portalURL) { |
||||
|
||||
public boolean isShowNumberOfPage() { |
||||
this.portalURL = portalURL; |
||||
} |
||||
|
||||
return showNumberOfPage; |
||||
} |
||||
public boolean isShowNumberOfPage() { |
||||
|
||||
public void setShowNumberOfPage(boolean showNumberOfPage) { |
||||
return showNumberOfPage; |
||||
} |
||||
|
||||
this.showNumberOfPage = showNumberOfPage; |
||||
} |
||||
public void setShowNumberOfPage(boolean showNumberOfPage) { |
||||
|
||||
/* |
||||
* public Object getDataSource() { |
||||
* |
||||
* return dataSource; } |
||||
* |
||||
* public void setDataSource(Object dataSource) { |
||||
* |
||||
* this.dataSource = dataSource; } |
||||
*/ |
||||
public Map<String, Object> getParameters() { |
||||
this.showNumberOfPage = showNumberOfPage; |
||||
} |
||||
|
||||
return parameters; |
||||
} |
||||
public Map<String, Object> getParameters() { |
||||
|
||||
public void setParameters(Map<String, Object> parameters) { |
||||
return parameters; |
||||
} |
||||
|
||||
this.parameters = parameters; |
||||
} |
||||
public void setParameters(Map<String, Object> parameters) { |
||||
|
||||
public String getHeader() { |
||||
this.parameters = parameters; |
||||
} |
||||
|
||||
return header; |
||||
} |
||||
public String getHeader() { |
||||
|
||||
public void setHeader(String header) { |
||||
return header; |
||||
} |
||||
|
||||
this.header = header; |
||||
} |
||||
public void setHeader(String header) { |
||||
|
||||
public String getFooter() { |
||||
this.header = header; |
||||
} |
||||
|
||||
return footer; |
||||
} |
||||
public String getFooter() { |
||||
|
||||
public void setFooter(String footer) { |
||||
return footer; |
||||
} |
||||
|
||||
this.footer = footer; |
||||
} |
||||
public void setFooter(String footer) { |
||||
|
||||
public int getHeaderHeight() { |
||||
this.footer = footer; |
||||
} |
||||
|
||||
return headerHeight; |
||||
} |
||||
public int getHeaderHeight() { |
||||
|
||||
public void setHeaderHeight(int headerHeight) { |
||||
return headerHeight; |
||||
} |
||||
|
||||
this.headerHeight = headerHeight; |
||||
} |
||||
public void setHeaderHeight(int headerHeight) { |
||||
|
||||
public int getFooterHeight() { |
||||
this.headerHeight = headerHeight; |
||||
} |
||||
|
||||
return footerHeight; |
||||
} |
||||
public int getFooterHeight() { |
||||
|
||||
public void setFooterHeight(int footerHeight) { |
||||
return footerHeight; |
||||
} |
||||
|
||||
this.footerHeight = footerHeight; |
||||
} |
||||
public void setFooterHeight(int footerHeight) { |
||||
|
||||
public ReportType getReportType() { |
||||
this.footerHeight = footerHeight; |
||||
} |
||||
|
||||
if (Validator.isNotNull(getType())) { |
||||
return ReportType.valueOf(getType()); |
||||
} |
||||
public ReportType getReportType() { |
||||
|
||||
return null; |
||||
} |
||||
if (Validator.isNotNull(getType())) { |
||||
return ReportType.valueOf(getType()); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
@ -1,68 +1,52 @@
|
||||
/** |
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. |
||||
* |
||||
* The contents of this file are subject to the terms of the Liferay Enterprise Subscription License |
||||
* ("License"). You may not use this file except in compliance with the License. You can obtain a |
||||
* copy of the License by contacting Liferay, Inc. See the License for the specific language |
||||
* governing permissions and limitations under the License, including but not limited to |
||||
* distribution rights of the Software. |
||||
* |
||||
* |
||||
* |
||||
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. The contents of this file are subject to the terms of the |
||||
* Liferay Enterprise Subscription License ("License"). You may not use this file except in compliance with the License. |
||||
* You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing |
||||
* permissions and limitations under the License, including but not limited to distribution rights of the Software. |
||||
*/ |
||||
|
||||
package it.tref.liferay.portos.report.shared.util; |
||||
|
||||
import com.liferay.portal.kernel.io.unsync.UnsyncStringWriter; |
||||
import com.liferay.portal.kernel.util.PropsKeys; |
||||
import com.liferay.portal.kernel.util.Validator; |
||||
|
||||
import java.util.Map; |
||||
|
||||
import org.apache.velocity.VelocityContext; |
||||
import org.apache.velocity.app.VelocityEngine; |
||||
import org.apache.velocity.runtime.RuntimeConstants; |
||||
|
||||
import com.liferay.portal.kernel.io.unsync.UnsyncStringWriter; |
||||
import com.liferay.portal.kernel.util.PropsKeys; |
||||
import com.liferay.portal.kernel.util.Validator; |
||||
|
||||
/** |
||||
* @author Brian Wing Shun Chan |
||||
*/ |
||||
public class VelocityUtil { |
||||
|
||||
public static String evaluate(String input) throws Exception { |
||||
|
||||
return evaluate(input, null); |
||||
} |
||||
|
||||
public static String evaluate(String input, Map<String, Object> variables) throws Exception { |
||||
|
||||
VelocityEngine velocityEngine = new VelocityEngine(); |
||||
|
||||
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, |
||||
com.liferay.portal.kernel.util.PropsUtil.get(PropsKeys.VELOCITY_ENGINE_LOGGER)); |
||||
|
||||
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM + ".log4j.category", |
||||
com.liferay.portal.kernel.util.PropsUtil.get(PropsKeys.VELOCITY_ENGINE_LOGGER_CATEGORY)); |
||||
|
||||
velocityEngine.init(); |
||||
|
||||
VelocityContext velocityContext = new VelocityContext(); |
||||
|
||||
if (variables != null) { |
||||
for (Map.Entry<String, Object> entry : variables.entrySet()) { |
||||
String key = entry.getKey(); |
||||
Object value = entry.getValue(); |
||||
|
||||
if (Validator.isNotNull(key)) { |
||||
velocityContext.put(key, value); |
||||
} |
||||
} |
||||
} |
||||
|
||||
UnsyncStringWriter unsyncStringWriter = new UnsyncStringWriter(); |
||||
|
||||
velocityEngine.evaluate(velocityContext, unsyncStringWriter, VelocityUtil.class.getName(), input); |
||||
|
||||
return unsyncStringWriter.toString(); |
||||
} |
||||
|
||||
public static String evaluate(String input) throws Exception { |
||||
|
||||
return evaluate(input, null); |
||||
} |
||||
|
||||
public static String evaluate(String input, Map<String, Object> variables) throws Exception { |
||||
|
||||
VelocityEngine velocityEngine = new VelocityEngine(); |
||||
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, |
||||
com.liferay.portal.kernel.util.PropsUtil.get(PropsKeys.VELOCITY_ENGINE_LOGGER)); |
||||
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM + ".log4j.category", |
||||
com.liferay.portal.kernel.util.PropsUtil.get(PropsKeys.VELOCITY_ENGINE_LOGGER_CATEGORY)); |
||||
velocityEngine.init(); |
||||
VelocityContext velocityContext = new VelocityContext(); |
||||
if (variables != null) { |
||||
for (Map.Entry<String, Object> entry : variables.entrySet()) { |
||||
String key = entry.getKey(); |
||||
Object value = entry.getValue(); |
||||
if (Validator.isNotNull(key)) { |
||||
velocityContext.put(key, value); |
||||
} |
||||
} |
||||
} |
||||
UnsyncStringWriter unsyncStringWriter = new UnsyncStringWriter(); |
||||
velocityEngine.evaluate(velocityContext, unsyncStringWriter, VelocityUtil.class.getName(), input); |
||||
return unsyncStringWriter.toString(); |
||||
} |
||||
} |
||||
|
Caricamento…
Reference in new issue