Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra functionality: #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added DIST/XLSReport_mx7_5.1.mpk
Binary file not shown.
Binary file modified XLSReport.mpr
Binary file not shown.
1,774 changes: 0 additions & 1,774 deletions javasource/com/mendix/core/Core.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Synchronise all excel columns and add/update/remove the existing columns from the template in the parameter.
* The return value is irrelevant and will be always true
*/
public class GetHeaderInformationFromExcelFile extends CustomJavaAction<Boolean>
public class GetHeaderInformationFromExcelFile extends CustomJavaAction<java.lang.Boolean>
{
private IMendixObject __TemplateObject;
private excelimporter.proxies.Template TemplateObject;
Expand All @@ -33,7 +33,7 @@ public GetHeaderInformationFromExcelFile(IContext context, IMendixObject Templat
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
this.TemplateObject = __TemplateObject == null ? null : excelimporter.proxies.Template.initialize(getContext(), __TemplateObject);

Expand All @@ -49,7 +49,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "GetHeaderInformationFromExcelFile";
}
Expand Down
13 changes: 5 additions & 8 deletions javasource/excelimporter/actions/RefreshClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@
import com.mendix.webui.CustomJavaAction;
import com.mendix.webui.FeedbackHelper;

/**
*
*/
public class RefreshClass extends CustomJavaAction<Boolean>
public class RefreshClass extends CustomJavaAction<java.lang.Boolean>
{
private String objectType;
private java.lang.String objectType;

public RefreshClass(IContext context, String objectType)
public RefreshClass(IContext context, java.lang.String objectType)
{
super(context);
this.objectType = objectType;
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
FeedbackHelper.addRefreshClass(getContext(), this.objectType);
Expand All @@ -39,7 +36,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "RefreshClass";
}
Expand Down
6 changes: 3 additions & 3 deletions javasource/excelimporter/actions/StartImportByTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* The return value is irrelevant and will be always true
*/
public class StartImportByTemplate extends CustomJavaAction<Boolean>
public class StartImportByTemplate extends CustomJavaAction<java.lang.Boolean>
{
private IMendixObject __TemplateObject;
private excelimporter.proxies.Template TemplateObject;
Expand All @@ -39,7 +39,7 @@ public StartImportByTemplate(IContext context, IMendixObject TemplateObject, IMe
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
this.TemplateObject = __TemplateObject == null ? null : excelimporter.proxies.Template.initialize(getContext(), __TemplateObject);

Expand All @@ -60,7 +60,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "StartImportByTemplate";
}
Expand Down
10 changes: 5 additions & 5 deletions javasource/mxmodelreflection/actions/ReplaceToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
/**
* Search the parameter text for the token from the parameter TokenObject, replace the value with a value from the parameter ValueObject.
*/
public class ReplaceToken extends CustomJavaAction<String>
public class ReplaceToken extends CustomJavaAction<java.lang.String>
{
private IMendixObject __TokenObject;
private mxmodelreflection.proxies.Token TokenObject;
private IMendixObject ValueObject;
private String TextToReplace;
private java.lang.String TextToReplace;

public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject ValueObject, String TextToReplace)
public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject ValueObject, java.lang.String TextToReplace)
{
super(context);
this.__TokenObject = TokenObject;
Expand All @@ -34,7 +34,7 @@ public ReplaceToken(IContext context, IMendixObject TokenObject, IMendixObject V
}

@Override
public String executeAction() throws Exception
public java.lang.String executeAction() throws Exception
{
this.TokenObject = __TokenObject == null ? null : mxmodelreflection.proxies.Token.initialize(getContext(), __TokenObject);

Expand All @@ -47,7 +47,7 @@ public String executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "ReplaceToken";
}
Expand Down
6 changes: 3 additions & 3 deletions javasource/mxmodelreflection/actions/SyncObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
*
* (The return value from this action can be ignored)
*/
public class SyncObjects extends CustomJavaAction<Boolean>
public class SyncObjects extends CustomJavaAction<java.lang.Boolean>
{
public SyncObjects(IContext context)
{
super(context);
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
Builder builder = new Builder();
Expand All @@ -55,7 +55,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "SyncObjects";
}
Expand Down
9 changes: 3 additions & 6 deletions javasource/mxmodelreflection/actions/TestThePattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
import com.mendix.webui.FeedbackHelper;
import com.mendix.systemwideinterfaces.core.IMendixObject;

/**
*
*/
public class TestThePattern extends CustomJavaAction<Boolean>
public class TestThePattern extends CustomJavaAction<java.lang.Boolean>
{
private IMendixObject __TestPatternObj;
private mxmodelreflection.proxies.TestPattern TestPatternObj;
Expand All @@ -33,7 +30,7 @@ public TestThePattern(IContext context, IMendixObject TestPatternObj)
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
this.TestPatternObj = __TestPatternObj == null ? null : mxmodelreflection.proxies.TestPattern.initialize(getContext(), __TestPatternObj);

Expand Down Expand Up @@ -81,7 +78,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "TestThePattern";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*/
public class ValidateTokensInMessage extends CustomJavaAction<java.util.List<IMendixObject>>
{
private String Text;
private java.lang.String Text;
private java.util.List<IMendixObject> __TokenList;
private java.util.List<mxmodelreflection.proxies.Token> TokenList;

public ValidateTokensInMessage(IContext context, String Text, java.util.List<IMendixObject> TokenList)
public ValidateTokensInMessage(IContext context, java.lang.String Text, java.util.List<IMendixObject> TokenList)
{
super(context);
this.Text = Text;
Expand All @@ -48,7 +48,7 @@ public java.util.List<IMendixObject> executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "ValidateTokensInMessage";
}
Expand Down
13 changes: 5 additions & 8 deletions javasource/odm/actions/Sleep.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;

/**
*
*/
public class Sleep extends CustomJavaAction<Boolean>
public class Sleep extends CustomJavaAction<java.lang.Boolean>
{
private Long SleepTime;
private java.lang.Long SleepTime;

public Sleep(IContext context, Long SleepTime)
public Sleep(IContext context, java.lang.Long SleepTime)
{
super(context);
this.SleepTime = SleepTime;
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
Thread.sleep(this.SleepTime);
Expand All @@ -39,7 +36,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "Sleep";
}
Expand Down
12 changes: 6 additions & 6 deletions javasource/system/actions/VerifyPassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
/**
* Verifies that the specified user name/password combination is valid.
*/
public class VerifyPassword extends CustomJavaAction<Boolean>
public class VerifyPassword extends CustomJavaAction<java.lang.Boolean>
{
private String userName;
private String password;
private java.lang.String userName;
private java.lang.String password;

public VerifyPassword(IContext context, String userName, String password)
public VerifyPassword(IContext context, java.lang.String userName, java.lang.String password)
{
super(context);
this.userName = userName;
this.password = password;
}

@Override
public Boolean executeAction() throws Exception
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
IUser user = Core.getUser(getContext(), userName);
Expand All @@ -42,7 +42,7 @@ public Boolean executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "VerifyPassword";
}
Expand Down
5 changes: 1 addition & 4 deletions javasource/xlsreport/actions/GenerateExcelDoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;

/**
*
*/
public class GenerateExcelDoc extends CustomJavaAction<IMendixObject>
{
private IMendixObject __TemplateObject;
Expand Down Expand Up @@ -155,7 +152,7 @@ public IMendixObject executeAction() throws Exception
* Returns a string representation of this action
*/
@Override
public String toString()
public java.lang.String toString()
{
return "GenerateExcelDoc";
}
Expand Down
58 changes: 51 additions & 7 deletions javasource/xlsreport/report/export/ExportExcel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
import java.util.Date;
import java.util.List;

import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.poifs.crypt.EncryptionInfo;
import org.apache.poi.poifs.crypt.EncryptionMode;
import org.apache.poi.poifs.crypt.Encryptor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
Expand Down Expand Up @@ -38,6 +45,8 @@ public class ExportExcel extends Export
private Workbook book;
private boolean customExcel = false;
private InputStream stream;
private MxTemplate template;


public ExportExcel(IContext context, MxTemplate template, IMendixObject inputObject) throws CoreException, IOException
{
Expand Down Expand Up @@ -76,7 +85,8 @@ public ExportExcel(IContext context, MxTemplate template, IMendixObject inputObj

// Initialize all the styling items for the excel
this.styling = new Styling(template);
this.styling.setAllStyles(context, template, this.book);
this.styling.setAllStyles(context, template, this.book);
this.template = template;
}

@Override
Expand Down Expand Up @@ -166,12 +176,46 @@ public void buildExportFile(MxSheet mxSheet, List<ColumnPreset> ColumnPresetList
@Override
public void writeData(FileDocument outputDocument) throws Exception
{
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
this.book.write(out);
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(out.toByteArray())) {
Core.storeFileDocumentContent(context, outputDocument.getMendixObject(), inputStream);
}
}
File tmpFile = File.createTempFile("xlsreport-", template.getDocumentType().toString().toLowerCase());
FileOutputStream tmpFos = new FileOutputStream(tmpFile);

try {
if (template.getPasswordProtect()) {
if (template.getPassword() == null || template.getPassword().isEmpty()) {
throw new RuntimeException("No password has been set.");
}

switch (template.getDocumentType()) {
case XLS:
Biff8EncryptionKey.setCurrentUserPassword(template.getPassword());
this.book.write(tmpFos);
tmpFos.close();
Biff8EncryptionKey.setCurrentUserPassword(null);
break;
case XLSX:

POIFSFileSystem fs = new POIFSFileSystem();
EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile);
Encryptor enc = info.getEncryptor();
enc.confirmPassword(template.getPassword());
OutputStream os = enc.getDataStream(fs);
this.book.write(os);
os.close();
fs.writeFilesystem(tmpFos);
tmpFos.close();
break;
default:
throw new RuntimeException("Unable to apply password protection because the format doesn't allow it: " + template.getDocumentType().toString());
}
}
Core.storeFileDocumentContent(context, outputDocument.getMendixObject(), new FileInputStream(tmpFile));

} finally {
try { tmpFos.close(); } catch (Exception e) {}
tmpFile.delete();
}


}

private void processStaticData(List<IMendixObject> StaticList, Sheet sheet, Aggregator aggr) throws CoreException
Expand Down