Skip to content

Commit

Permalink
Added integ tests, updated README, screenshots, other tidy-up in prep…
Browse files Browse the repository at this point in the history
…aration for release.
  • Loading branch information
danhaywood committed Sep 11, 2014
1 parent a64c1af commit ae3042a
Show file tree
Hide file tree
Showing 56 changed files with 913 additions and 708 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,2 +1 @@
language: java
before_install: cd service
50 changes: 49 additions & 1 deletion README.md
Expand Up @@ -14,7 +14,55 @@ The following screenshots show an example app's usage of the module.

#### Installing the Fixture Data ####

...TODO...
The fixture data creates a set of todo items in various categories:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/010-install-fixtures.png)

#### Exporting items using the (example) bulk update manager ####

The example app has a bulk update manager as a wrapper around the ExcelService:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/020-run-bulk-update-manager.png)

The (example) bulk update manager allows the end-user to define a criteria to exporting a (sub)set of items:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/030-export.png)

which are then downloaded ...

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/040-open-xlsx.png)

... and can be viewed in Microsoft Excel:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/050-xlsx.png)

#### Importing Exporting Excel ####

Using Excel the user can update data:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/060-xlsx-updated.png)

... and the use the (example) bulk update manager to import:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/070-import.png)

specifying the updated spreadsheet in the dialog:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/080-import-dialog.png)

#### View models represent the Excel rows ####

For each row in the spreadsheet the `ExcelService` instantiates a corresponding view model.

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/090-line-items.png)

The view model can then provide a bulk `apply` action...

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/100-bulk-apply.png)

to update the corresponding entity:

![](https://raw.github.com/isisaddons/isis-module-excel/master/images/110-updated-todo-item.png)



Expand Down
16 changes: 8 additions & 8 deletions dom/pom.xml
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2013~2014 Dan Haywood
Copyright 2014 Dan Haywood
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific
language governing permissions and limitations under the License.
-->
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2013~2014 Dan Haywood
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2013~2014 Dan Haywood
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
Expand Down
@@ -1,3 +1,19 @@
/*
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.isisaddons.module.excel.dom;

import java.io.ByteArrayOutputStream;
Expand All @@ -9,7 +25,6 @@

class ExcelFileBlobConverter {

private final String xslxMimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

// //////////////////////////////////////

Expand All @@ -20,7 +35,7 @@ Blob toBlob(final String name, final File file) {
fis = new FileInputStream(file);
baos = new ByteArrayOutputStream();
IOUtils.copy(fis, baos);
return new Blob(name, xslxMimeType, baos.toByteArray());
return new Blob(name, ExcelService.XSLX_MIME_TYPE, baos.toByteArray());
} catch (IOException ex) {
throw new ExcelService.Exception(ex);
} finally {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2013~2014 Dan Haywood
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
Expand Down Expand Up @@ -41,6 +41,8 @@
@DomainService
public class ExcelService {

public static final String XSLX_MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

public static class Exception extends RecoverableException {

private static final long serialVersionUID = 1L;
Expand Down
29 changes: 13 additions & 16 deletions fixture/pom.xml
@@ -1,21 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Copyright 2014 Dan Haywood
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific
language governing permissions and limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down
@@ -1,9 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
Expand Down
@@ -1,9 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
Expand Down
@@ -1,9 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
Expand Down
@@ -1,9 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
Expand Down
@@ -1,18 +1,18 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
/*
* Copyright 2014 Dan Haywood
*
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
{
columns: [
Expand Down
@@ -1,9 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
Expand Down
@@ -1,9 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
Expand All @@ -16,31 +14,27 @@
* specific language governing permissions and limitations
* under the License.
*/

package org.isisaddons.module.excel.fixture.scripts;

import java.math.BigDecimal;

import org.joda.time.LocalDate;

import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.fixturescripts.DiscoverableFixtureScript;
import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport;

import org.isisaddons.module.excel.fixture.dom.ExcelModuleDemoToDoItem;
import org.isisaddons.module.excel.fixture.dom.ExcelModuleDemoToDoItem.Category;
import org.isisaddons.module.excel.fixture.dom.ExcelModuleDemoToDoItem.Subcategory;
import org.isisaddons.module.excel.fixture.dom.ExcelModuleDemoToDoItems;
import org.joda.time.LocalDate;
import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.fixturescripts.FixtureScript;
import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport;

public class ExcelModuleDemoToDoItemsFixture extends DiscoverableFixtureScript {
public class CreateAllToDoItems extends FixtureScript {

private final String user;

public ExcelModuleDemoToDoItemsFixture() {
public CreateAllToDoItems() {
this(null);
}

public ExcelModuleDemoToDoItemsFixture(String ownedBy) {
public CreateAllToDoItems(String ownedBy) {
this.user = ownedBy;
}

Expand All @@ -49,8 +43,6 @@ public void execute(ExecutionContext executionContext) {

final String ownedBy = this.user != null ? this.user : getContainer().getUser().getName();

isisJdoSupport.executeUpdate(String.format("delete from \"%s\" where \"ownedBy\" = '%s'", ExcelModuleDemoToDoItem.class.getSimpleName(), ownedBy));

installFor(ownedBy, executionContext);

getContainer().flush();
Expand Down
@@ -0,0 +1,47 @@
/*
* Copyright 2014 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.isisaddons.module.excel.fixture.scripts;

import org.isisaddons.module.excel.fixture.dom.ExcelModuleDemoToDoItem;
import org.apache.isis.applib.fixturescripts.DiscoverableFixtureScript;
import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;

public class DeleteAllToDoItems extends DiscoverableFixtureScript {

private final String user;

public DeleteAllToDoItems() {
this(null);
}

public DeleteAllToDoItems(String ownedBy) {
this.user = ownedBy;
}

@Override
public void execute(ExecutionContext executionContext) {

final String ownedBy = this.user != null ? this.user : getContainer().getUser().getName();

isisJdoSupport.executeUpdate(String.format("delete from \"%s\" where \"ownedBy\" = '%s'", ExcelModuleDemoToDoItem.class.getSimpleName(), ownedBy));
}


@javax.inject.Inject
private IsisJdoSupport isisJdoSupport;

}

0 comments on commit ae3042a

Please sign in to comment.