Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move drools-guvnor-models to drools multi-project
- Loading branch information
Showing
319 changed files
with
38,441 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
/**/.* | ||
!.gitignore | ||
/nbproject | ||
*.ipr | ||
*.iws | ||
*.iml | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store |
14 changes: 14 additions & 0 deletions
14
drools-guvnor-models/drools-guvnor-models-commons/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
/**/.* | ||
!.gitignore | ||
/nbproject | ||
*.ipr | ||
*.iws | ||
*.iml | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?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/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>drools-guvnor-models</artifactId> | ||
<groupId>org.drools</groupId> | ||
<version>6.0.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.drools</groupId> | ||
<artifactId>drools-guvnor-models-commons</artifactId> | ||
|
||
<name>Drools Guvnor - Common Model</name> | ||
<description>Drools Guvnor - Common Model</description> | ||
|
||
<dependencies> | ||
|
||
<!-- Internal dependencies --> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-compiler</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.kie.commons</groupId> | ||
<artifactId>kie-commons-validation</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<!-- Include src/main/java in order not to break the Eclipse GWT plug-in --> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
</resource> | ||
<!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in --> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
</project> |
14 changes: 14 additions & 0 deletions
14
...-models-commons/src/main/java/org/drools/guvnor/models/commons/backend/BaseConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.drools.guvnor.models.commons.backend; | ||
|
||
import org.drools.compiler.kie.builder.impl.FormatConverter; | ||
|
||
public abstract class BaseConverter implements FormatConverter { | ||
|
||
protected String getDestinationName(String name) { | ||
return getDestinationName(name, false); | ||
} | ||
|
||
protected String getDestinationName(String name, boolean hasDsl) { | ||
return name.substring(0, name.lastIndexOf('.')) + (hasDsl ? ".dslr" : ".drl"); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...models-commons/src/main/java/org/drools/guvnor/models/commons/backend/IUpgradeHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2011 JBoss Inc | ||
* | ||
* 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.drools.guvnor.models.commons.backend; | ||
|
||
/** | ||
* Interface for utility classes handling upgrades to Models. This may be | ||
* required as the Model changes to support different (future) requirements. | ||
* | ||
* @param <T> | ||
* The return model type after upgrade | ||
* @param <V> | ||
* The source model type | ||
*/ | ||
public interface IUpgradeHelper<T, V> { | ||
|
||
T upgrade( V model ); | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...commons/src/main/java/org/drools/guvnor/models/commons/backend/imports/ImportsParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2012 JBoss Inc | ||
* | ||
* 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.drools.guvnor.models.commons.backend.imports; | ||
|
||
import org.drools.guvnor.models.commons.shared.imports.Import; | ||
import org.drools.guvnor.models.commons.shared.imports.Imports; | ||
|
||
/** | ||
* Utility methods to parse an Imports Config | ||
*/ | ||
public final class ImportsParser { | ||
|
||
private static final String KEYWORD = "import "; | ||
|
||
private ImportsParser() { | ||
} | ||
|
||
public static Imports parseImports( final String content ) { | ||
Imports imports = new Imports(); | ||
|
||
if ( content == null || content.trim().equals( "" ) ) { | ||
return imports; | ||
} else { | ||
final String[] lines = content.split( "\\n" ); | ||
|
||
for ( int i = 0; i < lines.length; i++ ) { | ||
String line = lines[ i ].trim(); | ||
if ( !( line.equals( "" ) || line.startsWith( "#" ) ) ) { | ||
if ( line.startsWith( KEYWORD ) ) { | ||
line = line.substring( KEYWORD.length() ).trim(); | ||
if ( line.endsWith( ";" ) ) { | ||
line = line.substring( 0, line.length() - 1 ); | ||
} | ||
imports.addImport( new Import( line ) ); | ||
} | ||
} | ||
} | ||
|
||
return imports; | ||
} | ||
|
||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...commons/src/main/java/org/drools/guvnor/models/commons/backend/imports/ImportsWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.drools.guvnor.models.commons.backend.imports; | ||
|
||
import org.drools.guvnor.models.commons.shared.imports.HasImports; | ||
import org.drools.guvnor.models.commons.shared.imports.Imports; | ||
|
||
/** | ||
* Writes import details to a String | ||
*/ | ||
public class ImportsWriter { | ||
|
||
public static void write( final StringBuilder sb, | ||
final HasImports model ) { | ||
final Imports imports = model.getImports(); | ||
if ( imports == null ) { | ||
return; | ||
} | ||
sb.append( imports.toString() ); | ||
if ( imports.getImports().size() > 0 ) { | ||
sb.append( "\n" ); | ||
} | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...ns/src/main/java/org/drools/guvnor/models/commons/backend/packages/PackageNameParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2012 JBoss Inc | ||
* | ||
* 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.drools.guvnor.models.commons.backend.packages; | ||
|
||
/** | ||
* Utility methods to parse a Package Name | ||
*/ | ||
public final class PackageNameParser { | ||
|
||
private static final String KEYWORD = "package "; | ||
|
||
private PackageNameParser() { | ||
} | ||
|
||
public static String parsePackageName( final String content ) { | ||
String packageName = ""; | ||
|
||
if ( content == null || content.trim().equals( "" ) ) { | ||
return packageName; | ||
} else { | ||
final String[] lines = content.split( "\\n" ); | ||
|
||
for ( int i = 0; i < lines.length; i++ ) { | ||
String line = lines[ i ].trim(); | ||
if ( !( line.equals( "" ) || line.startsWith( "#" ) ) ) { | ||
if ( line.startsWith( KEYWORD ) ) { | ||
line = line.substring( KEYWORD.length() ).trim(); | ||
if ( line.endsWith( ";" ) ) { | ||
line = line.substring( 0, line.length() - 1 ); | ||
} | ||
return line; | ||
} | ||
} | ||
} | ||
|
||
return packageName; | ||
} | ||
|
||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
...ns/src/main/java/org/drools/guvnor/models/commons/backend/packages/PackageNameWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.drools.guvnor.models.commons.backend.packages; | ||
|
||
import org.drools.guvnor.models.commons.shared.packages.HasPackageName; | ||
|
||
/** | ||
* Writes Package details to a String | ||
*/ | ||
public class PackageNameWriter { | ||
|
||
public static void write( final StringBuilder sb, | ||
final HasPackageName model ) { | ||
final String packageName = model.getPackageName(); | ||
if ( !( packageName == null || packageName.isEmpty() ) ) { | ||
sb.append( "package " ).append( packageName ).append( ";\n\n" ); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.