Skip to content

Commit

Permalink
open source rotabuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
bibryam committed Dec 16, 2017
0 parents commit 29f09d5
Show file tree
Hide file tree
Showing 232 changed files with 195,505 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
@@ -0,0 +1,13 @@
/translations.pot
**/.DS_Store
.DS_Store
target
**/target/
.idea
*.iml
*.log
**/*.log
**/*.iml
integtests/translations.pot
webapp/logs/sql.log.1
webapp/src/main/resources/data/rotabuilder/solved/
7 changes: 7 additions & 0 deletions Dockerfile
@@ -0,0 +1,7 @@
FROM tomcat:9.0.2-alpine
MAINTAINER Bilgin Ibryam
EXPOSE 8080
COPY webapp/target/ROOT.war /maven/ROOT.war
RUN rm -fr /usr/local/tomcat/webapps/* && mv /maven/ROOT.war /usr/local/tomcat/webapps/
RUN chgrp -R 0 /usr/local/tomcat && chmod -R g=u /usr/local/tomcat
CMD catalina.sh run
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 Bilgin Ibryam - http://twitter.com/bibryam

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
@@ -0,0 +1,51 @@
### RotaBuilder - Employee Rostering
*A Java web application for nurse scheduling based on [OptaPlanner](http://optaplanner.org/) and [Apache ISIS](http://isis.apache.org/)*

### (option 1) Local: Build and Run with Maven

mvn clean install -DskipTests=true
cd webapp
mvn jetty:run

#### (option 2) Local: Build and Run with Docker

mvn clean install -DskipTests=true
docker build --rm -t bibryam/rotabuilder .
docker run -p 8080:8080 bibryam/rotabuilder

#### (option 3) OpenShift Online: Deploy existing Docker image to OpenShift
Create an OpenShift Online [account](https://manage.openshift.com/). Notice, even the free tier account is enough to try out the application.
Install OpenShift client locally (oc) and login to OpenShift. The following commands will run the latest Rotabuilder Docker image and expose its URL to outside world.

oc new-project rotabuilder
oc new-app bibryam/rotabuilder:latest -e CATALINA_OPTS="-Xmx300m"
oc expose service rotabuilder

The process takes some time as it has to download the Docker images and there are not much free resources on a free tier account. Notice also we limit Tomcat heap size in order to run in a Docker container with 512MB memory. After few minutes, you should be able to access your Rotabuilder instance.

### Login
http://localhost:8080/

test:test - no tenancies
user:user - default demo user
admin:admin - admin user

### Live Demo on Red Hat OpenShift

See live demo running at [http://rotabuilder.com](http://rotabuilder.com)

### Screenshot

![project view](![project view](![project view](https://2.bp.blogspot.com/-jb-IJWAOtbY/WjUIQ1tRCII/AAAAAAAAJ5Y/83vQxgATqJwC_gh2xsNgEyjAGsYuz9aMgCLcBGAs/s1600/Screen%2BShot%2B2017-12-16%2Bat%2B11.47.33.png)
)
)

### Application Features
- Manage employees
- Manage skills
- Manage days on/off requests
- Manage shift on/off requests
- Manage contracts
- Manage shifts
- Create automatic employee-shift assignments

47 changes: 47 additions & 0 deletions app/pom.xml
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<parent>
<groupId>com.rotabuilder</groupId>
<artifactId>rotabuilder</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>app</artifactId>
<name>RotaBuilder App</name>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</build>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>fixture</artifactId>
</dependency>
<dependency>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-wrapper</artifactId>
</dependency>
<dependency>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-runtime</artifactId>
</dependency>

</dependencies>

</project>
107 changes: 107 additions & 0 deletions app/src/main/java/com/rotabuilder/app/DomainAppAppManifest.java
@@ -0,0 +1,107 @@
package com.rotabuilder.app;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.rotabuilder.dom.DomainAppDomainModule;
import com.rotabuilder.fixture.DomainAppFixtureModule;
import com.rotabuilder.fixture.scenarios.UserFixture;
import com.rotabuilder.fixture.scenarios.RecreateContracts;
import com.rotabuilder.fixture.scenarios.RecreateEmployees;
import com.rotabuilder.fixture.scenarios.RecreatePatterns;
import com.rotabuilder.fixture.scenarios.RecreateShiftDates;
import com.rotabuilder.fixture.scenarios.RecreateShiftType;
import com.rotabuilder.fixture.scenarios.RecreateSkills;
import org.apache.isis.applib.AppManifest;
import org.apache.isis.applib.fixturescripts.FixtureScript;
import org.isisaddons.module.audit.AuditModule;
import org.isisaddons.module.command.CommandModule;
import org.isisaddons.module.security.SecurityModule;
import org.isisaddons.module.sessionlogger.SessionLoggerModule;
import org.isisaddons.module.settings.SettingsModule;

/**
* Bootstrap the application.
*/
public class DomainAppAppManifest implements AppManifest {

/**
* Load all services and entities found in (the packages and subpackages within) these modules
*/
@Override
public List<Class<?>> getModules() {
return Arrays.asList(
DomainAppDomainModule.class, // domain (entities and repositories)
DomainAppFixtureModule.class, // fixtures
DomainAppAppModule.class, // home page service etc
SecurityModule.class,
SessionLoggerModule.class,
AuditModule.class,
SettingsModule.class,
CommandModule.class
);
}

@Override
public List<Class<?>> getAdditionalServices() {
return Arrays.asList(
org.isisaddons.module.security.dom.password.PasswordEncryptionServiceUsingJBcrypt.class
,org.isisaddons.module.security.dom.permission.PermissionsEvaluationServiceAllowBeatsVeto.class
);
}

/**
* Use shiro for authentication.
*
* <p>
* NB: this is ignored for integration tests, which always use "bypass".
* </p>
*/
@Override
public String getAuthenticationMechanism() {
return "shiro";
}

/**
* Use shiro for authorization.
*
* <p>
* NB: this is ignored for integration tests, which always use "bypass".
* </p>
*/
@Override
public String getAuthorizationMechanism() {
return "shiro";
}

/**
* Fixtures to be installed.
*/
@Override
public List<Class<? extends FixtureScript>> getFixtures() {
return Lists.newArrayList(
UserFixture.class,
RecreateSkills.class,
RecreateShiftType.class,
RecreateShiftDates.class,
RecreatePatterns.class,
RecreateContracts.class,
RecreateEmployees.class);
}
/**
* Force fixtures to be loaded.
*/
@Override
public Map<String, String> getConfigurationProperties() {
HashMap<String,String> props = Maps.newHashMap();
props.put("isis.persistor.datanucleus.install-fixtures","true");
props.put("isis.reflector.facets.include", "org.isisaddons.module.security.facets.TenantedAuthorizationFacetFactory");

return props;
}

}
5 changes: 5 additions & 0 deletions app/src/main/java/com/rotabuilder/app/DomainAppAppModule.java
@@ -0,0 +1,5 @@
package com.rotabuilder.app;

public final class DomainAppAppModule {
private DomainAppAppModule(){}
}
83 changes: 83 additions & 0 deletions app/src/main/java/com/rotabuilder/app/DomainAppTestManifest.java
@@ -0,0 +1,83 @@
package com.rotabuilder.app;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.rotabuilder.dom.DomainAppDomainModule;
import com.rotabuilder.fixture.DomainAppFixtureModule;
import org.apache.isis.applib.AppManifest;
import org.apache.isis.applib.fixturescripts.FixtureScript;

/**
* Bootstrap the application.
*/
public class DomainAppTestManifest implements AppManifest {

/**
* Load all services and entities found in (the packages and subpackages within) these modules
*/
@Override
public List<Class<?>> getModules() {
return Arrays.asList(
DomainAppDomainModule.class, // domain (entities and repositories)
DomainAppFixtureModule.class, // fixtures
DomainAppAppModule.class // home page service etc
);
}

/**
* No additional services.
*/
@Override
public List<Class<?>> getAdditionalServices() {
return Collections.emptyList();
}

/**
* Use shiro for authentication.
*
* <p>
* NB: this is ignored for integration tests, which always use "bypass".
* </p>
*/
@Override
public String getAuthenticationMechanism() {
return "bypass";
}

/**
* Use shiro for authorization.
*
* <p>
* NB: this is ignored for integration tests, which always use "bypass".
* </p>
*/
@Override
public String getAuthorizationMechanism() {
return "bypass";
}

/**
* Fixtures to be installed.
*/
@Override
public List<Class<? extends FixtureScript>> getFixtures() {
return Lists.newArrayList();
}

/**
* Force fixtures to be loaded.
*/
@Override
public Map<String, String> getConfigurationProperties() {
HashMap<String,String> props = Maps.newHashMap();
props.put("isis.persistor.datanucleus.install-fixtures","true");
return props;
}

}
@@ -0,0 +1,30 @@
package com.rotabuilder.app.services.homepage;

import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.HomePage;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.services.registry.ServiceRegistry;

// trick to suppress the actions from the top-level menu
@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
public class HomePageService {

//region > homePage (action)

@Action(semantics = SemanticsOf.SAFE)
@HomePage
public HomePageViewModel homePage() {
return serviceRegistry.injectServicesInto(new HomePageViewModel());
}

//endregion

//region > injected services

@javax.inject.Inject
ServiceRegistry serviceRegistry;

//endregion
}

0 comments on commit 29f09d5

Please sign in to comment.