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

Support for SQL Server native sequences and README.md update #1

Open
wants to merge 2 commits into
base: main
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ The user can optionally select to print more than one label by entering a `Coun

# Build
## Maximo Dependencies
To build the *zebra-label* project, you will need the Maximo `businessobjects.jar`, classes from the Maximo maximouiweb classes and the Maximo tools classes. The `businessobjects.jar` file can be obtained by unzipping the `maximo.ear` file and copying the file.
To build the *zebra-label* project, you will need the Maximo `businessobjects.jar`, `commonweb.jar`, classes from the Maximo maximouiweb classes and the Maximo tools classes. The `businessobjects.jar` and `commonweb.jar` files can be obtained by unzipping the `maximo.ear` file and copying the files.

The Maximo maximouiweb classes are not provided as a jar file and therefore must be created. Open a terminal (unix) or command (windows) window and navigate to the [SMP_HOME]/maximo/applications/maximo/maximouiweb/webmodule/WEB-INF/classes/ folder. Run the following command.

Expand All @@ -172,7 +172,7 @@ The Maximo tools classes are not provided as a jar file and therefore must be cr
```shell
jar cf maximo-tools.jar *
```
Copy the `businessobjects.jar`, `maximo-webclient.jar` and `maximo-tools.jar` to the project's `libs` directory.
Copy the `businessobjects.jar`, `commonweb.jar`, `maximo-webclient.jar` and `maximo-tools.jar` to the project's `libs` directory.

## Gradle assembleDist
To build the project run the gradle `assembleDist` task.
7 changes: 5 additions & 2 deletions src/main/java/psdi/zebralabel/en/AutoScriptUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,16 @@ private static void addScript(Connection connection, String scriptName, String d
}

private static long getNextId(Connection connection, String sequenceName, int dbIn, Util util) throws Exception {
if (dbIn == UpgConstants.SQLSERVER) {
if(!util.nativeSequenceExists(sequenceName)) {
return Long.parseLong(util.getNextSequenceValueForSqlServer(sequenceName));
} else {
String statement = dbIn == UpgConstants.SQLSERVER
? "select next value for " + sequenceName + " from dummy_table"
: "select " + sequenceName + ".nextval from dummy_table";
PreparedStatement nextIdStatement = null;
ResultSet resultSet = null;
try {
nextIdStatement = connection.prepareStatement("select " + sequenceName + ".nextval from dummy_table");
nextIdStatement = connection.prepareStatement(statement);
resultSet = nextIdStatement.executeQuery();
resultSet.next();
return resultSet.getLong(1);
Expand Down