Salvatore La Manna
3 anni fa
11 ha cambiato i file con 258 aggiunte e 346 eliminazioni
@ -1,186 +1,176 @@ |
|||||||
package it.tref.liferay.portos.report.shared.dto; |
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 it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportType; |
||||||
|
|
||||||
import java.util.Map; |
import java.util.Map; |
||||||
|
|
||||||
public class ReportDto { |
import com.liferay.portal.kernel.util.Validator; |
||||||
|
|
||||||
private String type; |
public class ReportDto { |
||||||
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() { |
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(); |
public ReportDto(String type, long folderId, long[] fileEntryIds, String fileName, String[] css, String portalURL, |
||||||
this.type = type; |
boolean showNumberOfPage, Object dataSource, Map<String, Object> parameters, String header, |
||||||
this.folderId = folderId; |
int headerHeight, String footer, int footerHeight) { |
||||||
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 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) { |
||||||
} |
|
||||||
|
|
||||||
/* |
this.showNumberOfPage = showNumberOfPage; |
||||||
* public Object getDataSource() { |
} |
||||||
* |
|
||||||
* return dataSource; } |
|
||||||
* |
|
||||||
* public void setDataSource(Object dataSource) { |
|
||||||
* |
|
||||||
* this.dataSource = dataSource; } |
|
||||||
*/ |
|
||||||
public Map<String, Object> getParameters() { |
|
||||||
|
|
||||||
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())) { |
public ReportType getReportType() { |
||||||
return ReportType.valueOf(getType()); |
|
||||||
} |
|
||||||
|
|
||||||
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. |
* 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. |
||||||
* The contents of this file are subject to the terms of the Liferay Enterprise Subscription License |
* You can obtain a copy of the License by contacting Liferay, Inc. See the License for the specific language governing |
||||||
* ("License"). You may not use this file except in compliance with the License. You can obtain a |
* permissions and limitations under the License, including but not limited to distribution rights of the Software. |
||||||
* 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; |
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 java.util.Map; |
||||||
|
|
||||||
import org.apache.velocity.VelocityContext; |
import org.apache.velocity.VelocityContext; |
||||||
import org.apache.velocity.app.VelocityEngine; |
import org.apache.velocity.app.VelocityEngine; |
||||||
import org.apache.velocity.runtime.RuntimeConstants; |
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 |
* @author Brian Wing Shun Chan |
||||||
*/ |
*/ |
||||||
public class VelocityUtil { |
public class VelocityUtil { |
||||||
|
|
||||||
public static String evaluate(String input) throws Exception { |
public static String evaluate(String input) throws Exception { |
||||||
|
|
||||||
return evaluate(input, null); |
return evaluate(input, null); |
||||||
} |
} |
||||||
|
|
||||||
public static String evaluate(String input, Map<String, Object> variables) throws Exception { |
public static String evaluate(String input, Map<String, Object> variables) throws Exception { |
||||||
|
|
||||||
VelocityEngine velocityEngine = new VelocityEngine(); |
VelocityEngine velocityEngine = new VelocityEngine(); |
||||||
|
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, |
||||||
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, |
com.liferay.portal.kernel.util.PropsUtil.get(PropsKeys.VELOCITY_ENGINE_LOGGER)); |
||||||
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.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM + ".log4j.category", |
velocityEngine.init(); |
||||||
com.liferay.portal.kernel.util.PropsUtil.get(PropsKeys.VELOCITY_ENGINE_LOGGER_CATEGORY)); |
VelocityContext velocityContext = new VelocityContext(); |
||||||
|
if (variables != null) { |
||||||
velocityEngine.init(); |
for (Map.Entry<String, Object> entry : variables.entrySet()) { |
||||||
|
String key = entry.getKey(); |
||||||
VelocityContext velocityContext = new VelocityContext(); |
Object value = entry.getValue(); |
||||||
|
if (Validator.isNotNull(key)) { |
||||||
if (variables != null) { |
velocityContext.put(key, value); |
||||||
for (Map.Entry<String, Object> entry : variables.entrySet()) { |
} |
||||||
String key = entry.getKey(); |
} |
||||||
Object value = entry.getValue(); |
} |
||||||
|
UnsyncStringWriter unsyncStringWriter = new UnsyncStringWriter(); |
||||||
if (Validator.isNotNull(key)) { |
velocityEngine.evaluate(velocityContext, unsyncStringWriter, VelocityUtil.class.getName(), input); |
||||||
velocityContext.put(key, value); |
return unsyncStringWriter.toString(); |
||||||
} |
} |
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
UnsyncStringWriter unsyncStringWriter = new UnsyncStringWriter(); |
|
||||||
|
|
||||||
velocityEngine.evaluate(velocityContext, unsyncStringWriter, VelocityUtil.class.getName(), input); |
|
||||||
|
|
||||||
return unsyncStringWriter.toString(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
Caricamento…
Reference in new issue