]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
PMD plugin is refreshed. Some code is modified to respect PMD rules. Ant build proced...
authorrkv <rkv@opencascade.com>
Fri, 2 Nov 2012 09:12:25 +0000 (09:12 +0000)
committerrkv <rkv@opencascade.com>
Fri, 2 Nov 2012 09:12:25 +0000 (09:12 +0000)
46 files changed:
Workspace/3dparty_src/.cvsignore [new file with mode: 0644]
Workspace/Converter/.pmd
Workspace/Converter/.project
Workspace/Converter/build.properties
Workspace/Converter/build.xml
Workspace/Converter/siman-pmd.ruleset
Workspace/DaoGenerator/.pmd [new file with mode: 0644]
Workspace/SPlat/.cvsignore
Workspace/SPlat/.pmd
Workspace/SPlat/.project
Workspace/SPlat/siman-pmd.ruleset
Workspace/SPlat/src/org/splat/manox/Toolbox.java
Workspace/SPlat/src/org/splat/manox/TypeMismatchException.java
Workspace/SPlat/src/org/splat/manox/WordDOCXDocument.java
Workspace/SPlat/src/org/splat/manox/WordXMLDocument.java
Workspace/SPlat/src/org/splat/manox/XDOM.java
Workspace/SPlat/src/org/splat/manox/XMLDocument.java
Workspace/SPlat/src/org/splat/manox/XMLException.java
Workspace/Siman-Common/.cvsignore
Workspace/Siman-Common/.pmd
Workspace/Siman-Common/.project
Workspace/Siman-Common/build.properties
Workspace/Siman-Common/build.xml
Workspace/Siman-Common/ext/servlet-api.jar [new file with mode: 0644]
Workspace/Siman-Common/siman-pmd.ruleset
Workspace/Siman-Common/src/org/splat/dal/bo/kernel/Entity.java
Workspace/Siman-Common/src/org/splat/dal/bo/som/Document.java
Workspace/Siman-Common/src/org/splat/dal/bo/som/DocumentType.java
Workspace/Siman-Common/src/org/splat/dal/bo/som/Entity.java [deleted file]
Workspace/Siman-Common/src/org/splat/dal/bo/som/ProjectElement.java
Workspace/Siman-Common/src/org/splat/dal/bo/som/Publication.java
Workspace/Siman-Common/src/org/splat/dal/bo/som/SimulationContextType.java
Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java [new file with mode: 0644]
Workspace/Siman-Common/src/org/splat/dal/dao/kernel/Database.java [deleted file]
Workspace/Siman-Common/src/org/splat/dal/dao/som/Database.java
Workspace/Siman-Common/src/org/splat/i18n/I18nUtils.java
Workspace/Siman-Common/src/org/splat/service/dto/ImportedStudyDTO.java
Workspace/Siman-Common/src/org/splat/service/dto/KnowledgeElementDTO.java
Workspace/Siman/.cvsignore
Workspace/Siman/.pmd
Workspace/Siman/.project
Workspace/Siman/build.xml
Workspace/Siman/siman-pmd.ruleset
Workspace/Siman/src/hibernate.properties
Workspace/Siman/src/jdbc.properties
Workspace/Siman/src/org/splat/module/SaveDocumentAction.java

diff --git a/Workspace/3dparty_src/.cvsignore b/Workspace/3dparty_src/.cvsignore
new file mode 100644 (file)
index 0000000..3690de0
--- /dev/null
@@ -0,0 +1 @@
+.pmd
index 05d8fd431d29e431df2809ad3b9744fa6e804432..dc7a2c18736c39413e3fe4b2ab8c7cbca6119524 100644 (file)
@@ -3,4 +3,5 @@
     <useProjectRuleSet>true</useProjectRuleSet>
     <ruleSetFile>siman-pmd.ruleset</ruleSetFile>
     <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
 </pmd>
index 5fc1506a357a8135cb2e8f074bd405b52a41d29b..3cdd13ce1481bf2301d0079f0972c67ab2afe1fd 100644 (file)
@@ -27,7 +27,7 @@
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+                       <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
@@ -36,5 +36,6 @@
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
                <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
+               <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
        </natures>
 </projectDescription>
index 0ccd8968b5c48beb356f572747f5ce810069282b..886885423ee52440b498ddebf83c1292acb903c0 100644 (file)
@@ -1,2 +1,3 @@
 converter.src.dir=src
 converter.dist.dir=dist
+siman-common.project.name=Siman-Common
index e40903ef7a13aadb94d97bcbef7496d425e90b9c..9810f134e62fe9ec30ac5afafa9e74e5cce8c3f7 100644 (file)
@@ -6,10 +6,20 @@
        <property file="../SPlat/build.properties" description="set the SPlat build parameters" />
        <property file="build.properties" description="set the build parameters" />
 
+    <property file="../${siman-common.project.name}/build.properties" description="set the build parameters" />
+    <property file="../${splat.project.name}/build.properties" description="set the build parameters" />
+
+    <!-- ================================================= -->
+    <!--    siman-common: Build Siman-Common project       -->
+    <!-- ================================================= -->
+    <target name="siman-common" description="Builds Siman-Common project">
+        <ant dir="../${siman-common.project.name}" />
+    </target>
+
        <!-- ================================================= -->
        <!--    create_run_jar: Build the converter Jar            -->
        <!-- ================================================= -->
-       <target name="create_run_jar" description="Build the converter Jar">
+       <target name="create_run_jar" depends="siman-common" description="Build the converter Jar">
                <mkdir dir="${converter.dist.dir}" />
                <jar destfile="${converter.dist.dir}/converter.jar">
                        <manifest>
index 534af487b298ea6d450743ff667efa829409bcd6..e610618ba174d493c5e2a7097eaddb70fa76b82d 100644 (file)
@@ -8,7 +8,6 @@
        level 5 : good practices
        </description>
        
-       <exclude-pattern>.*/org/.*</exclude-pattern>
        <exclude-pattern>.*/test/.*</exclude-pattern>
        
        <rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
diff --git a/Workspace/DaoGenerator/.pmd b/Workspace/DaoGenerator/.pmd
new file mode 100644 (file)
index 0000000..c4b848c
--- /dev/null
@@ -0,0 +1,1809 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd>
+    <useProjectRuleSet>false</useProjectRuleSet>
+    <ruleSetFile>.ruleset</ruleSetFile>
+    <rules>
+        <rule>
+            <name>LooseCoupling</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloneMethodMustImplementCloneable</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedImports</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SignatureDeclareThrowsException</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IfStmtsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>WhileLoopsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IfElseStmtsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ForLoopsMustUseBraces</name>
+            <ruleset>Braces Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryConstructor</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NullAssignment</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>OnlyOneReturn</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedModifier</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AssignmentInOperand</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AtLeastOneConstructor</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DontImportSun</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousOctalEscape</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CallSuperInConstructor</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryParentheses</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DefaultPackage</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanInversion</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DataflowAnomalyAnalysis</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFinalLocalVariable</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingShortType</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingVolatile</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingNativeCode</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidAccessibilityAlteration</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotCallGarbageCollectionExplicitly</name>
+            <ruleset>Controversial Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyCatchBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyIfStmt</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyWhileStmt</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyTryBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyFinallyBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptySwitchStatements</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JumbledIncrementer</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ForLoopShouldBeWhileLoop</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryConversionTemporary</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>OverrideBothEqualsAndHashcode</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoubleCheckedLocking</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReturnFromFinallyBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptySynchronizedBlock</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryReturn</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyStaticInitializer</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnconditionalIfStatement</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyStatementNotInLoop</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanInstantiation</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryFinalModifier</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CollapsibleIfStatements</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UselessOverridingMethod</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ClassCastExceptionWithToArray</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDecimalLiteralsInBigDecimalConstructor</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UselessOperationOnImmutable</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MisplacedNullCheck</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedNullCheckInEquals</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThreadGroup</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BrokenNullCheck</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BigIntegerInstantiation</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingOctalValues</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingHardCodedIP</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CheckResultSet</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidMultipleUnaryOperators</name>
+            <ruleset>Basic Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedPrivateField</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedLocalVariable</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedPrivateMethod</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedFormalParameter</name>
+            <ruleset>Unused Code Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MoreThanOneLogger</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LoggerIsNotStaticFinal</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SystemPrintln</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidPrintStackTrace</name>
+            <ruleset>Java Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCatchingThrowable</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SignatureDeclareThrowsException</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExceptionAsFlowControl</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCatchingNPE</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThrowingRawExceptionTypes</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThrowingNullPointerException</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidRethrowingException</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotExtendJavaLangError</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotThrowExceptionInFinally</name>
+            <ruleset>Strict Exception Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceVectorWithList</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceHashtableWithMap</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceEnumerationWithIterator</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidEnumAsIdentifier</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidAssertAsIdentifier</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IntegerInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ByteInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ShortInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LongInstantiation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4TestShouldUseBeforeAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4TestShouldUseAfterAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4TestShouldUseTestAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnit4SuitesShouldUseSuiteAnnotation</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitUseExpected</name>
+            <ruleset>Migration Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseSingleton</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanReturns</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanExpressions</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SwitchStmtsShouldHaveDefault</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDeeplyNestedIfStmts</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidReassigningParameters</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SwitchDensity</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ConstructorCallsOverridableMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AccessorClassGeneration</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalFieldCouldBeStatic</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloseResource</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NonStaticInitializer</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DefaultLabelNotLastInSwitchStmt</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NonCaseLabelInSwitchStatement</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>OptimizableToArrayCall</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BadComparison</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EqualsNull</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ConfusingTernary</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InstantiationToGetClass</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>IdempotentOperations</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimpleDateFormatNeedsLocale</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ImmutableField</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseLocaleWithCaseConversions</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidProtectedFieldInFinalClass</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AssignmentToNonFinalStatic</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingStaticMethodInNonInstantiatableClass</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidSynchronizedAtMethodLevel</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingBreakInSwitch</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseNotifyAllInsteadOfNotify</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidInstanceofChecksInCatchClause</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractClassWithoutAbstractMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyConditional</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CompareObjectsWithEquals</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>PositionLiteralsFirstInComparisons</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryLocalBeforeReturn</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NonThreadSafeSingleton</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UncommentedEmptyMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UncommentedEmptyConstructor</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidConstantsInterface</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnsynchronizedStaticDateFormatter</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>PreserveStackTrace</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseCollectionIsEmpty</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyMethodInAbstractClassShouldBeAbstract</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SingularField</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ReturnEmptyArrayRatherThanNull</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractClassWithoutAnyMethod</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooFewBranchesForASwitchStatement</name>
+            <ruleset>Design Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseProperClassLoader</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MDBAndSessionBeanNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>RemoteSessionInterfaceNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LocalInterfaceSessionNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LocalHomeNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>RemoteInterfaceNamingConvention</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotCallSystemExit</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StaticEJBFieldShouldBeFinal</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotUseThreads</name>
+            <ruleset>J2EE Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LocalVariableCouldBeFinal</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodArgumentCouldBeFinal</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidInstantiatingObjectsInLoops</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseArrayListInsteadOfVector</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyStartsWith</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseStringBufferForStringAppends</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseArraysAsList</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidArrayLoops</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryWrapperObjectCreation</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AddEmptyString</name>
+            <ruleset>Optimization Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodReturnsInternalArray</name>
+            <ruleset>Security Code Guidelines</ruleset>
+        </rule>
+        <rule>
+            <name>ArrayIsStoredDirectly</name>
+            <ruleset>Security Code Guidelines</ruleset>
+        </rule>
+        <rule>
+            <name>CouplingBetweenObjects</name>
+            <ruleset>Coupling Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveImports</name>
+            <ruleset>Coupling Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LooseCoupling</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DuplicateImports</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>DontImportJavaLang</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedImports</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ImportFromSamePackage</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyStaticImports</name>
+            <ruleset>Import Statement Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitStaticSuite</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitSpelling</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitAssertionsShouldIncludeMessage</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>JUnitTestsShouldIncludeAssert</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TestClassWithoutTestCases</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryBooleanAssertion</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseAssertEqualsInsteadOfAssertTrue</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseAssertSameInsteadOfAssertTrue</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseAssertNullInsteadOfAssertTrue</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanAssertion</name>
+            <ruleset>JUnit Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ShortVariable</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>LongVariable</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ShortMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>VariableNamingConventions</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodNamingConventions</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ClassNamingConventions</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractNaming</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDollarSigns</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MethodWithSameNameAsEnclosingClass</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousHashcodeMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousConstantFieldName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousEqualsMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFieldNameMatchingTypeName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFieldNameMatchingMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NoPackage</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>PackageCase</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MisleadingVariableName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanGetMethodName</name>
+            <ruleset>Naming Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NPathComplexity</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveMethodLength</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveParameterList</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveClassLength</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CyclomaticComplexity</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessivePublicCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyFields</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NcssMethodCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NcssTypeCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>NcssConstructorCount</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyMethods</name>
+            <ruleset>Code Size Rules</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyFinalizer</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeOnlyCallsSuperFinalize</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeOverloaded</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeDoesNotCallSuperFinalize</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeShouldBeProtected</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCallingFinalize</name>
+            <ruleset>Finalizer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseCorrectExceptionLogging</name>
+            <ruleset>Jakarta Commons Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ProperLogger</name>
+            <ruleset>Jakarta Commons Logging Rules</ruleset>
+        </rule>
+        <rule>
+            <name>BeanMembersShouldSerialize</name>
+            <ruleset>JavaBean Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingSerialVersionUID</name>
+            <ruleset>JavaBean Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ProperCloneImplementation</name>
+            <ruleset>Clone Implementation Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloneThrowsCloneNotSupportedException</name>
+            <ruleset>Clone Implementation Rules</ruleset>
+        </rule>
+        <rule>
+            <name>CloneMethodMustImplementCloneable</name>
+            <ruleset>Type Resolution Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDuplicateLiterals</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StringInstantiation</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StringToString</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InefficientStringBuffering</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryCaseChange</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseStringBufferLength</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AppendCharacterWithChar</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>ConsecutiveLiteralAppends</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseIndexOfChar</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InefficientEmptyStringCheck</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>InsufficientStringBufferDeclaration</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UselessStringValueOf</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>StringBufferInstantiationWithChar</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>UseEqualsToCompareStrings</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidStringBufferField</name>
+            <ruleset>String and StringBuffer Rules</ruleset>
+        </rule>
+        <rule>
+            <name>MissingStaticMethodInNonInstantiatableClass</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ExceptionAsFlowControl</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCatchingThrowable</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SingularField</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingNativeCode</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCatchingNPE</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AppendCharacterWithChar</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseStringBufferForStringAppends</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveImports</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AccessorClassGeneration</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousHashcodeMethodName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>LooseCoupling</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>LooseCoupling</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BrokenNullCheck</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ClassNamingConventions</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CloneMethodMustImplementCloneable</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDollarSigns</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DefaultLabelNotLastInSwitchStmt</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SignatureDeclareThrowsException</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>InefficientStringBuffering</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidInstantiatingObjectsInLoops</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MissingBreakInSwitch</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CallSuperInConstructor</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>StringBufferInstantiationWithChar</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BeanMembersShouldSerialize</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NcssConstructorCount</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractNaming</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AssignmentInOperand</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ConsecutiveLiteralAppends</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>IfElseStmtsMustUseBraces</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SimpleDateFormatNeedsLocale</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThrowingNullPointerException</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>JumbledIncrementer</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AddEmptyString</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyFields</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidSynchronizedAtMethodLevel</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousEqualsMethodName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CloseResource</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>IdempotentOperations</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UselessOperationOnImmutable</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFieldNameMatchingTypeName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidInstanceofChecksInCatchClause</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanExpressions</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UselessOverridingMethod</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseCorrectExceptionLogging</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>WhileLoopsMustUseBraces</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NonThreadSafeSingleton</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedModifier</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ClassCastExceptionWithToArray</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryParentheses</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseProperClassLoader</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ProperCloneImplementation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ReturnFromFinallyBlock</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ReturnEmptyArrayRatherThanNull</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MisleadingVariableName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ConfusingTernary</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousConstantFieldName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDuplicateLiterals</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedImports</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UncommentedEmptyMethod</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedPrivateMethod</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NonStaticInitializer</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ForLoopShouldBeWhileLoop</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFieldNameMatchingMethodName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidFinalLocalVariable</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>InstantiationToGetClass</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotExtendJavaLangError</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UselessStringValueOf</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MethodArgumentCouldBeFinal</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EqualsNull</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ConstructorCallsOverridableMethod</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SwitchDensity</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyMethods</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyConditional</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyCatchBlock</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>LocalHomeNamingConvention</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotUseConditionalExpression </name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyIfStmt</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ImmutableField</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DefaultPackage</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidArrayLoops</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotCallSystemExit</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CheckResultSet</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CyclomaticComplexity</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingShortType</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyFinallyBlock</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CouplingBetweenObjects</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidStringBufferField</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyBooleanReturns</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MethodWithSameNameAsEnclosingClass</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnconditionalIfStatement</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryFinalModifier</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BigIntegerInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>LoggerIsNotStaticFinal</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NonCaseLabelInSwitchStatement</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>InsufficientStringBufferDeclaration</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>TooManyStaticImports</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CompareObjectsWithEquals</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveParameterList</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DuplicateImports</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryReturn</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptySynchronizedBlock</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AssignmentToNonFinalStatic</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceVectorWithList</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SignatureDeclareThrowsException</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedImports</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CloneThrowsCloneNotSupportedException</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidConstantsInterface</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseArraysAsList</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnsynchronizedStaticDateFormatter</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ShortInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidReassigningParameters</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceHashtableWithMap</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseIndexOfChar</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BadComparison</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseNotifyAllInsteadOfNotify</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryConversionTemporary</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NcssMethodCount</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidProtectedFieldInFinalClass</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>OnlyOneReturn</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MisplacedNullCheck</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeOverloaded</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseArrayListInsteadOfVector</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedFormalParameter</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ParametersNamingRules</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ArrayIsStoredDirectly</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>StringInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ImportFromSamePackage</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>PackageCase</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>StringToString</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MissingSerialVersionUID</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeOnlyCallsSuperFinalize</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UncommentedEmptyConstructor</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidPrintStackTrace</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NoPackage</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedPrivateField</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>StaticEJBFieldShouldBeFinal</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingOctalValues</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryWrapperObjectCreation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanInversion</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ClassWithOnlyPrivateConstructorsShouldBeFinal</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CloneMethodMustImplementCloneable</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>PositionLiteralsFirstInComparisons</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedNullCheckInEquals</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotUseThreads</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>InefficientEmptyStringCheck</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DataflowAnomalyAnalysis</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ForLoopsMustUseBraces</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeShouldBeProtected</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyTryBlock</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseStringBufferLength</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyFinalizer</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>FieldNamingRules</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingHardCodedIP</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ByteInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DontImportSun</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MethodNamingConventions</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidAccessibilityAlteration</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousConstantFieldName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SwitchStmtsShouldHaveDefault</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveMethodLength</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>OverrideBothEqualsAndHashcode</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MethodReturnsInternalArray</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>TooFewBranchesForASwitchStatement</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NcssTypeCount</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDecimalLiteralsInBigDecimalConstructor</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DontImportJavaLang</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MDBAndSessionBeanNamingConvention</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyMethodInAbstractClassShouldBeAbstract</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotThrowExceptionInFinally</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>PreserveStackTrace</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessiveClassLength</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>RemoteInterfaceNamingConvention</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyStatementNotInLoop</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseCollectionIsEmpty</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryConstructor</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>BooleanGetMethodName</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SystemPrintln</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>OptimizableToArrayCall</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyStaticInitializer</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidUsingVolatile</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnnecessaryCaseChange</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ReplaceEnumerationWithIterator</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>FinalFieldCouldBeStatic</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>IntegerInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThrowingRawExceptionTypes</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SuspiciousOctalEscape</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptySwitchStatements</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidMultipleUnaryOperators</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>CollapsibleIfStatements</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>LocalInterfaceSessionNamingConvention</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>EmptyWhileStmt</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NullAssignment</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>FinalizeDoesNotCallSuperFinalize</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ProperLogger</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>IfStmtsMustUseBraces</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractClassWithoutAnyMethod</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>MoreThanOneLogger</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UnusedLocalVariable</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AbstractClassWithoutAbstractMethod</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>LongInstantiation</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>VariableNamingConventions</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseSingleton</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>UseEqualsToCompareStrings</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidRethrowingException</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>SimplifyStartsWith</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidDeeplyNestedIfStmts</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidCallingFinalize</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>RemoteSessionInterfaceNamingConvention</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>AvoidThreadGroup</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>NPathComplexity</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoubleCheckedLocking</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>ExcessivePublicCount</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+        <rule>
+            <name>DoNotCallGarbageCollectionExplicitly</name>
+            <ruleset>pmd-eclipse</ruleset>
+        </rule>
+    </rules>
+    <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
+</pmd>
index abc70c2c339a896ea78ae8f85b4862bebff2927b..4ffb44f3a811eff498f5d36e381f97bef749dd17 100644 (file)
@@ -6,3 +6,5 @@ dist/*
 bin/*
 *.class
 *.war
+reports
+reports/*
index 05d8fd431d29e431df2809ad3b9744fa6e804432..dc7a2c18736c39413e3fe4b2ab8c7cbca6119524 100644 (file)
@@ -3,4 +3,5 @@
     <useProjectRuleSet>true</useProjectRuleSet>
     <ruleSetFile>siman-pmd.ruleset</ruleSetFile>
     <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
 </pmd>
index 01d2e088241735bd4ee42a03ef6490b5fe5206b6..541e729affec0b358d7693f36b50dd6100faeb19 100644 (file)
@@ -36,7 +36,7 @@
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+                       <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
@@ -48,5 +48,6 @@
                <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
                <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
                <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
+               <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
        </natures>
 </projectDescription>
index 534af487b298ea6d450743ff667efa829409bcd6..e610618ba174d493c5e2a7097eaddb70fa76b82d 100644 (file)
@@ -8,7 +8,6 @@
        level 5 : good practices
        </description>
        
-       <exclude-pattern>.*/org/.*</exclude-pattern>
        <exclude-pattern>.*/test/.*</exclude-pattern>
        
        <rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
index 20954bf273b25ae9fa8d77c9457fa9f52bd7f7b3..e6da679516a769cb8939d482047395a09aa7fb09 100644 (file)
@@ -3,15 +3,17 @@ package org.splat.manox;
 import java.io.File;
 
 
-public abstract class Toolbox {
+public class Toolbox {
 
 //  ==============================================================================================================================
 //  Public services
 //  ==============================================================================================================================
 
-    public static Reader getReader (File file) {
+    public static Reader getReader (final File file) {
 //  ------------------------------------------
-      if (!file.exists()) return null;
+      if (!file.exists()) {
+               return null;
+       }
 
          String[] name = file.getName().split("\\x2E");                  // Split around '.' (period) character
          String   fext = name[name.length-1];
@@ -19,17 +21,21 @@ public abstract class Toolbox {
          
          if (fext.equals("xml")) {
         XMLDocument                odoc = new XMLDocument(file);      // Parses the file
-        if (odoc.isWordDocument()) me   = new WordXMLDocument(odoc);
+        if (odoc.isWordDocument()) {
+                       me   = new WordXMLDocument(odoc);
+               }
          } else
-      if (fext.equals("docx")) {
+      if (fext.equals("docx")) { //NOPMD: todo
 //TODO:        me = new WordDOCXDocument(file);
       }
       return me;
     }
 
-    public static Writer getWriter (File file) {
+    public static Writer getWriter (final File file) {
 //  ------------------------------------------
-      if (!file.exists()) return null;
+      if (!file.exists()) {
+               return null;
+       }
 
          String[] name = file.getName().split("\\x2E");                  // Split around '.' (period) character
          String   fext = name[name.length-1];
@@ -37,7 +43,9 @@ public abstract class Toolbox {
          
          if (fext.equals("xml")) {
         XMLDocument                odoc = new XMLDocument(file);      // Parses the file
-        if (odoc.isWordDocument()) me   = new WordXMLDocument(odoc);
+        if (odoc.isWordDocument()) {
+                       me   = new WordXMLDocument(odoc);
+               }
          }
       return me;
     }
index 55d1650c2a23c3f87727cf530b64cd5a2c3798c6..d8cdf4c1c9658b74286a9b9f5095358310fe0339 100644 (file)
@@ -5,8 +5,9 @@ public class TypeMismatchException extends Exception {
     private static final long serialVersionUID = 5083246617526245578L;
 
     public TypeMismatchException () {
+       super();
     }
-    public TypeMismatchException (String message) {
+    public TypeMismatchException (final String message) {
       super(message);
     }
 }
\ No newline at end of file
index e1e3edebb17ed8e0a2bce2b0a35cdd8cd23e20d2..2eaa38e57d795d3397d32cd9613fd9ef2ea42d95 100644 (file)
@@ -4,56 +4,58 @@ import java.io.File;
 import java.io.FileInputStream;\r
 import java.io.InputStream;\r
 \r
+import org.apache.log4j.Logger;\r
 import org.apache.poi.xwpf.extractor.XWPFWordExtractor;\r
 import org.apache.poi.xwpf.usermodel.XWPFDocument;\r
 \r
-\r
 public class WordDOCXDocument implements Reader {\r
 \r
-//  private  File              myfile;\r
-    private  XWPFWordExtractor mytool;\r
-    private  String            contents;\r
-\r
-//  ==============================================================================================================================\r
-//  Constructor\r
-//  ==============================================================================================================================\r
-\r
-    public WordDOCXDocument (File file) {\r
-//  -----------------------------------\r
-      try {\r
-        InputStream  from = new FileInputStream(file);\r
-        XWPFDocument odoc = new XWPFDocument(from);\r
-\r
-        mytool   = new XWPFWordExtractor(odoc);\r
-        contents = mytool.getText();\r
-      }\r
-      catch (Exception error) {\r
-         \r
-      }\r
-    }\r
-\r
-//  ==============================================================================================================================\r
-//  Public services\r
-//  ==============================================================================================================================\r
-\r
-    public String extractProperty (String name) {\r
-//  -------------------------------------------\r
-      String value   = null;\r
-      String proname = "DOCPROPERTY  " + name;\r
-      int    index   = contents.indexOf(proname);\r
-      if (index > 0) {\r
-        String  fragment = contents.substring(index + proname.length() + 18);\r
-               index = fragment.indexOf("\15");\r
-        if (index > 0) {\r
-          value = fragment.substring(0, index);\r
-          if (value.startsWith("<") && value.endsWith(">")) value = null;\r
-        }\r
-      }\r
-      return value;  \r
-    }\r
-\r
-    public String extractText () {\r
-//  ----------------------------\r
-      return contents;\r
-    }\r
+    private final static  Logger  LOGGER = Logger.getLogger(WordDOCXDocument.class);\r
+    \r
+       private transient String _contents;\r
+\r
+       // ==============================================================================================================================\r
+       // Constructor\r
+       // ==============================================================================================================================\r
+\r
+       public WordDOCXDocument(final File file) {\r
+               XWPFWordExtractor aTool;\r
+               try {\r
+                       InputStream from = new FileInputStream(file);\r
+                       XWPFDocument odoc = new XWPFDocument(from);\r
+\r
+                       aTool = new XWPFWordExtractor(odoc);\r
+                       _contents = aTool.getText();\r
+               } catch (Exception error) {\r
+                       LOGGER.error(error.getMessage());\r
+               }\r
+       }\r
+\r
+       // ==============================================================================================================================\r
+       // Public services\r
+       // ==============================================================================================================================\r
+\r
+       public String extractProperty(final String name) {\r
+               // -------------------------------------------\r
+               String value = null;\r
+               String proname = "DOCPROPERTY  " + name;\r
+               int index = _contents.indexOf(proname);\r
+               if (index > 0) {\r
+                       String fragment = _contents\r
+                                       .substring(index + proname.length() + 18);\r
+                       index = fragment.indexOf('\15');\r
+                       if (index > 0) {\r
+                               value = fragment.substring(0, index);\r
+                               if (value.startsWith("<") && value.endsWith(">")) {\r
+                                       value = null;\r
+                               }\r
+                       }\r
+               }\r
+               return value;\r
+       }\r
+\r
+       public String extractText() {\r
+               // ----------------------------\r
+               return _contents;\r
+       }\r
 }
\ No newline at end of file
index 474caaa0dad4f1341a955c89ce50e4729c60cb9b..286181b5fd94b07d826b1b601fb7ccf92799ddd8 100644 (file)
 package org.splat.manox;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Vector;
+import java.util.List;
+import java.util.Map;
 
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-
 public class WordXMLDocument extends XMLDocument implements Reader, Writer {
 
-    private  HashMap<String,Node> binprop;           // Built-in properties
-       private  HashMap<String,Node> capprop;           // Custom application properties
-       private  Node                 body;              // Body of the document
-       private  Vector<Node>         fields = null;     // Fields into the document body
-       
-//  ==============================================================================================================================
-//  Constructors
-//  ==============================================================================================================================
-
-    public WordXMLDocument (File file) throws TypeMismatchException {
-//  ----------------------------------
-      super(file);
-      if (!isWordDocument()) throw new TypeMismatchException("The file to be open is not a Word document");
-      initializeMe();
-    }
-    protected WordXMLDocument (XMLDocument parse) {  // Downcast internal constructor
-//  ---------------------------------------------
-      super(parse);
-      initializeMe();                                // The given document is supposed being Word
-    }
-       
-//  ==============================================================================================================================
-//  Public services
-//  ==============================================================================================================================
-
-    public String extractProperty (String name) {
-//  -------------------------------------------
-      Node property;
-//    Properties not conform to the naming scheme
-         if      (name.equals("author")) property = binprop.get("creator");
-         else if (name.equals("type"))   property = binprop.get("category");
-//    Other properties
-         else {
-        property = capprop.get(name);                // Looking into custom properties first
-        if (property != null)  {
-          property = property.getFirstChild();       // vt:lpwstr node
-        } else {
-          property = binprop.get(name);
-        }
-         }
-      if (property == null) return null;
-      String value = property.getTextContent();
-      if    (value.startsWith("<") && value.endsWith(">"))  value = null;  // Property not set
-      return value;
-    }
-
-    public String extractText () {
-//  ----------------------------
-      String text = "";
-      if (body != null) {
-       Node body = this.body.getFirstChild();       // w:document node
-//     if  (body == null)  return text;             // Should not happen
-       body = body.getFirstChild();                 // w:body node
-       if  (body != null) text = extractTextContent(body, text);
-      }
-      return text;
-    }
-
-    public String updateProperty (String name, String value) {
-//  --------------------------------------------------------
-      if (fields == null) {
-         fields = collectFieldNodes(body, new Vector<Node>());
-      }
-//    Setting of the property
-      Node property = capprop.get(name);             // Looking into custom properties first
-      if  (property != null)  {
-        property = property.getFirstChild();
-      } else {
-       if (name.equals("author")) property = binprop.get("creator"); // thanks to Bill Gates...
-       else                       property = binprop.get(name);
-//      Built-in property names are capitalized into the document body  (thanks again, Bill Gates)        
-        char initial = name.charAt(0);
-        name = name.replaceFirst(String.valueOf(initial), String.valueOf(initial).toUpperCase());
-      }
-      if (property == null) return null;
-      String oldvalue = property.getTextContent();
-      property.setTextContent(value);
-
-//    Update of the property fields, if exist
-      String  proname  = " DOCPROPERTY  " + name + " ";
-
-      for (int j=0; j<fields.size(); j++) {
-        Node    cnode = fields.get(j);
-        String  aname = cnode.getAttributes().getNamedItem("w:instr").getNodeValue();
-        if (!aname.startsWith(proname)) continue;
-
-               property = XDOM.getChildNode("w:t", cnode.getFirstChild());
-               property.setTextContent(value);
-      }
-      return oldvalue;
-    }
-
-    public boolean save () {
-//  -------------------
-      return XDOM.saveDocument(myfile, myxdoc);
-    }
-
-//  ==============================================================================================================================
-//  Private services
-//  ==============================================================================================================================
-
-    private void initializeMe () {
-//  ----------------------------
-      loadDocument();                                                // Parses myfile XML document
-
-      body    = mynodes.get("/word/document.xml");
-      capprop = new HashMap<String,Node>();
-      binprop = new HashMap<String,Node>();
-
-      Node property = mynodes.get("/docProps/custom.xml");
-      if  (property != null)  {
-        NodeList  nlist = property.getFirstChild().getChildNodes();  // Contents of Properties node
-        for (int i=0; i<nlist.getLength(); i++) {
-          property = nlist.item(i);
-//        if (!property.getNodeName().equals("property")) continue;
-          
-          String name = property.getAttributes().getNamedItem("name").getNodeValue();
-          capprop.put(name, property);
-        }
-      }
-      property = mynodes.get("/docProps/core.xml");
-      if  (property != null)  {
-        NodeList  nlist = property.getFirstChild().getChildNodes();  // Contents of cp:coreProperties node
-        String    name;
-        for (int i=0; i<nlist.getLength(); i++) {
-          property = nlist.item(i);
-          name     = property.getNodeName();
-//        if (!name.startsWith("dc:")) continue;                     // Subset of user properties
-          
-          String[] parse = name.split(":");
-          binprop.put(parse[1], property);
-        }
-      }
-    }
-
-    private Vector<Node> collectFieldNodes (Node from, Vector<Node> to) {
-//  -------------------------------------------------------------------
-      NodeList nlist = from.getChildNodes();
-      for (int i=0; i<nlist.getLength(); i++) {
-        Node cnode = nlist.item(i);
-        if (cnode.getNodeName().equals("w:fldSimple")) to.add(cnode);
-        else                                           to = collectFieldNodes(cnode, to);                
-      }
-      return to;
-    }
-
-    private String extractTextContent (Node from, String to) {
-//  --------------------------------------------------------
-      NodeList nlist = from.getChildNodes();
-      for (int i=0; i<nlist.getLength(); i++) {
-        Node cnode = nlist.item(i);
-        if (cnode.getNodeName().equals("w:t")) to = to + " " + cnode.getTextContent();
-        else                                   to = extractTextContent(cnode, to);               
-      }
-      return to;
-    }
+       private transient Map<String, Node> _binprop; // Built-in properties
+       private transient Map<String, Node> _capprop; // Custom application properties
+       private transient Node _body; // Body of the document
+       private transient List<Node> _fields = null; // Fields into the document body
+
+       // ==============================================================================================================================
+       // Constructors
+       // ==============================================================================================================================
+
+       public WordXMLDocument(final File file) throws TypeMismatchException {
+               // ----------------------------------
+               super(file);
+               if (!isWordDocument()) {
+                       throw new TypeMismatchException(
+                                       "The file to be open is not a Word document");
+               }
+               initializeMe();
+       }
+
+       protected WordXMLDocument(final XMLDocument parse) { // Downcast internal constructor
+       // ---------------------------------------------
+               super(parse);
+               initializeMe(); // The given document is supposed being Word
+       }
+
+       // ==============================================================================================================================
+       // Public services
+       // ==============================================================================================================================
+
+       public String extractProperty(final String name) {
+               // -------------------------------------------
+               Node property;
+               // Properties not conform to the naming scheme
+               if ("author".equals(name)) {
+                       property = _binprop.get("creator");
+               } else if ("type".equals(name)) {
+                       property = _binprop.get("category");
+               } else {
+                       property = _capprop.get(name); // Looking into custom properties first
+                       if (property == null) {
+                               property = _binprop.get(name);
+                       } else {
+                               property = property.getFirstChild(); // vt:lpwstr node
+                       }
+               }
+               String value = null;
+               if (property != null) {
+                       value = property.getTextContent();
+                       if (value.startsWith("<") && value.endsWith(">")) {
+                               value = null; // Property not set
+                       }
+               }
+               return value;
+       }
+
+       public String extractText() {
+               // ----------------------------
+               String text = "";
+               if (_body != null) {
+                       Node body = this._body.getFirstChild(); // w:document node
+                       // if (body == null) return text; // Should not happen
+                       body = body.getFirstChild(); // w:body node
+                       if (body != null) {
+                               text = extractTextContent(body, text);
+                       }
+               }
+               return text;
+       }
+
+       public String updateProperty(String name, final String value) {
+               // --------------------------------------------------------
+               if (_fields == null) {
+                       _fields = collectFieldNodes(_body, new ArrayList<Node>());
+               }
+               // Setting of the property
+               Node property = _capprop.get(name); // Looking into custom properties first
+               if (property == null) {
+                       if ("author".equals(name)) {
+                               property = _binprop.get("creator"); // thanks to Bill Gates...
+                       } else {
+                               property = _binprop.get(name);
+                       }
+                       // Built-in property names are capitalized into the document body (thanks again, Bill Gates)
+                       char initial = name.charAt(0);
+                       name = name.replaceFirst(String.valueOf(initial), String.valueOf(
+                                       initial).toUpperCase());
+               } else {
+                       property = property.getFirstChild();
+               }
+               String oldvalue = null;
+               if (property != null) {
+                       oldvalue = property.getTextContent();
+                       property.setTextContent(value);
+
+                       // Update of the property fields, if exist
+                       String proname = " DOCPROPERTY  " + name + " ";
+
+                       for (int j = 0; j < _fields.size(); j++) {
+                               Node cnode = _fields.get(j);
+                               String aname = cnode.getAttributes().getNamedItem("w:instr")
+                                               .getNodeValue();
+                               if (!aname.startsWith(proname)) {
+                                       continue;
+                               }
+
+                               property = XDOM.getChildNode("w:t", cnode.getFirstChild());
+                               property.setTextContent(value);
+                       }
+               }
+               return oldvalue;
+       }
+
+       public boolean save() {
+               // -------------------
+               return XDOM.saveDocument(_myfile, _myxdoc);
+       }
+
+       // ==============================================================================================================================
+       // Private services
+       // ==============================================================================================================================
+
+       private void initializeMe() {
+               // ----------------------------
+               loadDocument(); // Parses myfile XML document
+
+               _body = _mynodes.get("/word/document.xml");
+               _capprop = new HashMap<String, Node>();
+               _binprop = new HashMap<String, Node>();
+
+               Node property = _mynodes.get("/docProps/custom.xml");
+               if (property != null) {
+                       NodeList nlist = property.getFirstChild().getChildNodes(); // Contents of Properties node
+                       for (int i = 0; i < nlist.getLength(); i++) {
+                               property = nlist.item(i);
+                               // if (!property.getNodeName().equals("property")) continue;
+
+                               String name = property.getAttributes().getNamedItem("name")
+                                               .getNodeValue();
+                               _capprop.put(name, property);
+                       }
+               }
+               property = _mynodes.get("/docProps/core.xml");
+               if (property != null) {
+                       NodeList nlist = property.getFirstChild().getChildNodes(); // Contents of cp:coreProperties node
+                       String name;
+                       for (int i = 0; i < nlist.getLength(); i++) {
+                               property = nlist.item(i);
+                               name = property.getNodeName();
+                               // if (!name.startsWith("dc:")) continue; // Subset of user properties
+
+                               String[] parse = name.split(":");
+                               _binprop.put(parse[1], property);
+                       }
+               }
+       }
+
+       private List<Node> collectFieldNodes(final Node from, List<Node> to) {
+               // -------------------------------------------------------------------
+               NodeList nlist = from.getChildNodes();
+               for (int i = 0; i < nlist.getLength(); i++) {
+                       Node cnode = nlist.item(i);
+                       if (cnode.getNodeName().equals("w:fldSimple")) {
+                               to.add(cnode);
+                       } else {
+                               to = collectFieldNodes(cnode, to);
+                       }
+               }
+               return to;
+       }
+
+       private String extractTextContent(final Node from, String to) {
+               // --------------------------------------------------------
+               NodeList nlist = from.getChildNodes();
+               for (int i = 0; i < nlist.getLength(); i++) {
+                       Node cnode = nlist.item(i);
+                       if (cnode.getNodeName().equals("w:t")) {
+                               to = to + " " + cnode.getTextContent();
+                       } else {
+                               to = extractTextContent(cnode, to);
+                       }
+               }
+               return to;
+       }
 }
\ No newline at end of file
index 8cc45982fe8676bd66126b7228381a3e992d5ba3..3c2eea1d242c8800ae1ee008ba3f59422d5078ce 100644 (file)
@@ -5,7 +5,6 @@ package org.splat.manox;
  * @copyright OPEN CASCADE 2012
  */
 
-import org.apache.log4j.Logger;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -20,6 +19,7 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import org.apache.log4j.Logger;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -27,9 +27,9 @@ import org.w3c.dom.NodeList;
 
 public class XDOM {
 
-    private final static  Logger  logger = Logger.getLogger(XDOM.class);
+    private final static  Logger  LOGGER = Logger.getLogger(XDOM.class);
 
-    public static org.w3c.dom.Document createDocument (String name) {
+    public static org.w3c.dom.Document createDocument (final String name) {
 //  ---------------------------------------------------------------
       DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
       try {
@@ -42,17 +42,19 @@ public class XDOM {
         return document;
       }
       catch (Exception error) {
-        logger.error("Could not create document " + name + ", reason:", error);
+        LOGGER.error("Could not create document " + name + ", reason:", error);
         return null;
       }
        }
 
-    public static Node getChildNode (String name, Node from) {
+    public static Node getChildNode (final String name, final Node from) {
 //  --------------------------------------------------------
       NodeList nlist = from.getChildNodes();
       for (int i=0; i<nlist.getLength(); i++) {
         Node cnode = nlist.item(i);
-        if (cnode.getNodeName().equals(name)) return cnode;
+        if (cnode.getNodeName().equals(name)) {
+                       return cnode;
+               }
       }
       return null;
     }
@@ -64,13 +66,15 @@ public class XDOM {
       for (int i=0; i<nlist.getLength(); i++) {
         node = nlist.item(i);
         String name = node.getNodeName();
-        if (name.startsWith("#")) continue;
+        if (name.startsWith("#")) {
+                       continue;
+               }
         result.put(name, node);
       }
       return result;
        }
        
-       public static boolean saveDocument (File xmlOutputFile, org.w3c.dom.Document doc) {
+       public static boolean saveDocument (final File xmlOutputFile, final org.w3c.dom.Document doc) {
 //  ---------------------------------------------------------------------------------
 //    Open output stream where XML Document will be saved
 //    File xmlOutputFile = new File(fileName);
@@ -80,7 +84,7 @@ public class XDOM {
         fos = new FileOutputStream(xmlOutputFile);
       }
       catch (FileNotFoundException error) {
-        logger.error("Could not open the " + xmlOutputFile.getName() + " file, reason:", error);
+        LOGGER.error("Could not open the " + xmlOutputFile.getName() + " file, reason:", error);
         return false;
       }
 //    Use a Transformer for output
@@ -89,7 +93,7 @@ public class XDOM {
         transformer = transformerFactory.newTransformer();
       }
       catch (TransformerConfigurationException error) {
-        logger.error("Transformer configuration error, reason:", error);
+        LOGGER.error("Transformer configuration error, reason:", error);
         return false;
       }
       DOMSource    source = new DOMSource(doc);
@@ -99,7 +103,7 @@ public class XDOM {
         transformer.transform(source, result);
       }
       catch (TransformerException error) {
-        logger.error("Error during XML transformation, reason:", error);
+        LOGGER.error("Error during XML transformation, reason:", error);
       }
       return true;
     }
index ab94d20dc7f26c03de2ea0b0cf493204d7ece056..0b336b0836863d15b2f6aee2cff3140f5ee86ada 100644 (file)
@@ -2,15 +2,16 @@ package org.splat.manox;
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.InputStream;
 import java.io.FileInputStream;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.HashMap;
-import org.apache.log4j.Logger;
+import java.util.Map;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.apache.log4j.Logger;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -18,21 +19,21 @@ import org.w3c.dom.NodeList;
 
 public class XMLDocument {
 
-    protected  File                 myfile;
-    protected  String               mytype;
-    protected  org.w3c.dom.Document myxdoc  = null;
-    protected  HashMap<String,Node> mynodes = null;
+    protected transient File                 _myfile;
+    protected transient  String               _mytype;
+    protected transient  org.w3c.dom.Document _myxdoc  = null;
+    protected transient  Map<String,Node>     _mynodes = null;
 
-    protected final static  Logger  logger  = Logger.getLogger(XMLDocument.class);
+    protected final static  Logger  LOGGER  = Logger.getLogger(XMLDocument.class);
 
 //  ==============================================================================================================================
 //  Construction
 //  ==============================================================================================================================
 
-    public XMLDocument (File file) {
+    public XMLDocument (final File file) {
 //  ------------------------------
-      myfile = file;
-      mytype = "any";
+      _myfile = file;
+      _mytype = "any";
       try {
         InputStream    ist    = new FileInputStream(file);
         BufferedReader buffer = new BufferedReader(new InputStreamReader(ist));
@@ -42,44 +43,52 @@ public class XMLDocument {
           if  (line.indexOf("mso-application ") > 0) {
                String[] parse = line.split("\"");
                int  natr;
-               for (natr=0; natr<parse.length; natr++) if (parse[natr].endsWith("progid=")) break;
+               for (natr=0; natr<parse.length; natr++) {
+                               if (parse[natr].endsWith("progid=")) {
+                                       break;
+                               }
+                       }
                natr += 1;
-               if  (natr < parse.length) mytype = parse[natr];
+               if  (natr < parse.length) {
+                               _mytype = parse[natr];
+                       }
                return;
           }
           line = buffer.readLine().trim();
         }
       }
       catch (Exception error) {
-        logger.error("Error reading the file " + myfile.getName() + ", reason:", error);
+        LOGGER.error("Error reading the file " + _myfile.getName() + ", reason:", error);
       }
     }
-    protected XMLDocument (XMLDocument parse) {
+    protected XMLDocument (final XMLDocument parse) {
 //  -----------------------------------------
-      myfile  = parse.myfile;
-      mytype  = parse.mytype;
+      _myfile  = parse._myfile;
+      _mytype  = parse._mytype;
     }
 
 //  ==============================================================================================================================
 //  Public services
 //  ==============================================================================================================================
 
-    public static String getActualFormat (File file) {
+    public static String getActualFormat (final File file) {
 //  ------------------------------------------------
          String[] name   = file.getName().split("\\x2E");
          String   format = name[name.length-1];
          
-         if (format.equals("xml")) {
+         if ("xml".equals(format)) {
         XMLDocument parse = new XMLDocument(file);
-        if         (parse.isWordDocument()) format = "docx";
+        if         (parse.isWordDocument()) {
+                       format = "docx";
 //      else if    (parse.is...)            format = "....";
+               }
          }
          return format;
     }
 
     public boolean isWordDocument () {
 //  -----------------------------------
-      return mytype.equals("Word.Document");
+      return "Word.Document".equals(_mytype);
     }
 
 //  ==============================================================================================================================
@@ -92,11 +101,11 @@ public class XMLDocument {
         DocumentBuilderFactory dfactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();
         DocumentBuilder        dBuilder = dfactory.newDocumentBuilder();  // Throws ParserConfigurationException
             
-        myxdoc  = dBuilder.parse(myfile);                                 // Throws IOException                                
-        mynodes = getNamedPartNodes(myxdoc);
+        _myxdoc  = dBuilder.parse(_myfile);                                 // Throws IOException                              
+        _mynodes = getNamedPartNodes(_myxdoc);
       }
       catch (Exception error) {
-        logger.error("XML parse error, reason:", error);
+        LOGGER.error("XML parse error, reason:", error);
       }
     }
 
@@ -104,7 +113,7 @@ public class XMLDocument {
 //  Private service
 //  ==============================================================================================================================
 
-    private HashMap<String,Node> getNamedPartNodes (org.w3c.dom.Document xmldoc) {
+    private Map<String,Node> getNamedPartNodes (final org.w3c.dom.Document xmldoc) {
 //  ----------------------------------------------------------------------------
       HashMap<String,Node> mapnode = new HashMap<String,Node>();
       Node                 root    = xmldoc.getDocumentElement();
@@ -112,18 +121,20 @@ public class XMLDocument {
 
       for (int i=0; i<nlist.getLength(); i++) {
         root = nlist.item(i);
-        if (!root.getNodeName().equals("pkg:part")) continue;
-        
-        NamedNodeMap  natr = root.getAttributes();
-        Node          node;
-        String        name;
-        if (natr == null) continue;               // Should not happen
-        node = natr.getNamedItem("pkg:name");
-        if (node == null) continue;               // Should not happen
-        name = node.getNodeValue();
-        node = root.getFirstChild();              // pkg:xxxData node
-        
-        mapnode.put(name, node);
+        if ("pkg:part".equals(root.getNodeName())) {
+               NamedNodeMap  natr = root.getAttributes();
+               Node          node;
+               String        name;
+               if (natr != null) {
+                       node = natr.getNamedItem("pkg:name");
+                       if (node != null) {
+                               name = node.getNodeValue();
+                               node = root.getFirstChild();              // pkg:xxxData node
+                               
+                               mapnode.put(name, node);
+                               }
+                       }
+               }
       }
       return mapnode;
     }
index 7f7917a8fd25ceb15faca7fe7132043c9e8e02cf..6211b56db4c774fbf6428285212a044bb8f76c1f 100644 (file)
@@ -10,8 +10,9 @@ public class XMLException extends Exception {
     private static final long serialVersionUID = -4807111035943839090L;
 
     public XMLException () {
+       super();
     }
-    public XMLException (String message) {
+    public XMLException (final String message) {
       super(message);
     }
 }
\ No newline at end of file
index 3e39f1f5856ea8873b8f041decb734c0ee218670..04ca8e1d7dda82ce50979423d17661d6b701f08e 100644 (file)
@@ -7,4 +7,6 @@ bin/*
 *.class
 *.war
 test-output
-test-output/*
\ No newline at end of file
+test-output/*
+reports
+reports/*
index 05d8fd431d29e431df2809ad3b9744fa6e804432..dc7a2c18736c39413e3fe4b2ab8c7cbca6119524 100644 (file)
@@ -3,4 +3,5 @@
     <useProjectRuleSet>true</useProjectRuleSet>
     <ruleSetFile>siman-pmd.ruleset</ruleSetFile>
     <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
 </pmd>
index 775fb4def3a9231cc736980d23e108cade33df42..a4f509585684a953659a794b96f7dfaa987b2211 100644 (file)
@@ -42,7 +42,7 @@
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+                       <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
@@ -55,5 +55,6 @@
                <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
                <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
                <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
+               <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
        </natures>
 </projectDescription>
index be45f31c3f51e270bd7f5ba5551e80310798ede8..aeda9b73158ec7cefc7e9fb98ba94b5f09bcb844 100644 (file)
@@ -2,5 +2,12 @@ siman-common.src.dir=src
 siman-common.lib.dir=lib
 siman-common.bin.dir=bin
 siman-common.dist.dir=dist
+siman-common.ext.dir=ext
 siman-common.jar.name=siman-common.jar
 splat.project.name=SPlat
+
+compiler.debug=on
+compiler.generate.no.warnings=off
+compiler.max.memory=256m
+compiler.optimize=on
+compiler.deprecation=on
index 10f846218a601e26c84a89d8bf15638c24a29461..afb8714ea76b708f19dda564d1344ac363a3fb2e 100644 (file)
                <ant dir="../${splat.project.name}" />
        </target>
 
+    <path id="ext.classpath">
+        <pathelement location="${siman-common.ext.dir}/*" />
+    </path>
+       
+    <!-- ===================================================================== -->
+    <!-- compile-java : compile the java classes                               -->
+    <!-- ===================================================================== -->
+    <target name="compile-java" depends="splat" description="Builds the java classes">
+        <echo message="Compile Siman-Common java classes" />
+       <mkdir dir="${siman-common.bin.dir}/temp"/>
+        <javac target="1.6" srcdir="${siman-common.src.dir}"  destdir="${siman-common.bin.dir}/temp" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" fork="true" optimize="${compiler.optimize}" deprecation="${compiler.deprecation}">
+            <classpath>
+                <path refid="ext.classpath" />
+                <fileset dir="../${splat.project.name}/${splat.dist.dir}" includes="**/*" />
+                <fileset dir="../${splat.project.name}/${splat.lib.dir}" includes="**/*" />
+                <fileset dir="${siman-common.lib.dir}" includes="**/*" />
+             </classpath>
+            <exclude name="test/**" />
+        </javac>
+    </target>
+
        <!-- ================================================= -->
        <!--    build-dist: Create the JAR distribution            -->
        <!-- ================================================= -->
-       <target name="build-dist" depends="clean, splat, build-stub" description="Builds the JAR distribution">
+       <target name="build-dist" depends="clean, splat, compile-java, build-stub" description="Builds the JAR distribution">
                <echo message="build ${siman-common.jar.name}" />
 
                <!--    <antcall target="compile-java">
                <jar destfile="${siman-common.dist.dir}/${siman-common.jar.name}">
                        <zipfileset dir="${siman-common.bin.dir}">
                                <include name="**" />
-                               <exclude name="test" />
+                <exclude name="test" />
+                <exclude name="temp" />
+                <exclude name="test/**" />
+                <exclude name="temp/**" />
                                <exclude name="**/datasourceContextTomcat.xml" />
                        </zipfileset>
                        <manifest>
diff --git a/Workspace/Siman-Common/ext/servlet-api.jar b/Workspace/Siman-Common/ext/servlet-api.jar
new file mode 100644 (file)
index 0000000..1bf50af
Binary files /dev/null and b/Workspace/Siman-Common/ext/servlet-api.jar differ
index 534af487b298ea6d450743ff667efa829409bcd6..e610618ba174d493c5e2a7097eaddb70fa76b82d 100644 (file)
@@ -8,7 +8,6 @@
        level 5 : good practices
        </description>
        
-       <exclude-pattern>.*/org/.*</exclude-pattern>
        <exclude-pattern>.*/test/.*</exclude-pattern>
        
        <rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
index 77388d24086ea24c08fb35168ee7fd0615d67d8d..c66a7ce204cc00469fcfc4fded326d01a9b33790 100644 (file)
@@ -24,7 +24,7 @@ import org.splat.kernel.ObjectProperties;
 
 public abstract class Entity extends Any {
 
-    private Set<Relation> relations = new HashSet<Relation>();
+    private final Set<Relation> relations = new HashSet<Relation>();
 
 //  ==============================================================================================================================
 //  Constructors
@@ -34,7 +34,7 @@ public abstract class Entity extends Any {
     protected Entity () {
     }
 //  Initialization constructor
-    protected Entity (ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
+    protected Entity (final ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
       super(prop);
     }
 
@@ -42,21 +42,25 @@ public abstract class Entity extends Any {
 //  Public member functions
 //  ==============================================================================================================================
 
-    public Relation getFirstRelation (Class<? extends Relation> type) {
+    public Relation getFirstRelation (final Class<? extends Relation> type) {
 //  -----------------------------------------------------------------
       for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
        Relation link = i.next();
-       if (link.getClass().equals(type)) return link;
+       if (link.getClass().equals(type)) {
+                       return link;
+               }
       }
       return null;
     }
 
-    public List<Relation> getRelations (Class<? extends Relation> type) {
+    public List<Relation> getRelations (final Class<? extends Relation> type) {
       List<Relation> result = new Vector<Relation>();
 
       for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
        Relation link = i.next();
-       if (link.getClass().equals(type)) result.add(link);
+       if (link.getClass().equals(type)) {
+                       result.add(link);
+               }
       }
       return result;
     }
@@ -65,11 +69,11 @@ public abstract class Entity extends Any {
 //  Protected services
 //  ==============================================================================================================================
 
-    protected Set<Relation> getAllRelations () {
+    public Set<Relation> getAllRelations () {
       return relations;
     }
 
-    protected Relation addRelation (Relation link) {
+    public Relation addRelation (Relation link) {
 
       relations.add(link);
 
@@ -82,11 +86,15 @@ public abstract class Entity extends Any {
       return link;
     }
 
-    protected void removeRelation (Class<? extends Relation> type, Persistent to) {
+    public void removeRelation (final Class<? extends Relation> type, final Persistent to) {
       for (Iterator<Relation> i=relations.iterator(); i.hasNext();) {
        Relation link = i.next();
-       if (!link.getClass().equals(type)) continue;
-       if (!link.getTo().equals(to))      continue;
+       if (!link.getClass().equals(type)) {
+                       continue;
+               }
+       if (!link.getTo().equals(to)) {
+                       continue;
+               }
        i.remove();
        return;
       }
index e39ccba25bb3c850efa6d5c857cc890548c4ffee..d312469cc8cdc90710ad309045b79ec575ac0c1e 100644 (file)
@@ -12,6 +12,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
 
+import org.splat.dal.bo.kernel.Entity;
 import org.splat.dal.bo.kernel.Persistent;
 import org.splat.dal.bo.kernel.Relation;
 import org.splat.dal.bo.kernel.User;
@@ -20,7 +21,6 @@ import org.splat.kernel.InvalidPropertyException;
 import org.splat.kernel.MissedPropertyException;
 import org.splat.kernel.MultiplyDefinedException;
 import org.splat.service.technical.ProjectSettingsService;
-import org.splat.service.technical.ProjectSettingsServiceImpl;
 import org.splat.som.Revision;
 import org.splat.som.Step;
 
index ca954a6abbba7fc15998bf962f406bacf67c97bb..707ae66421d964c2ac0d10c98a55438786399449 100644 (file)
@@ -5,8 +5,8 @@ package org.splat.dal.bo.som;
  * @copyright OPEN CASCADE 2012
  */
 
-import java.util.Set;
 import java.util.HashSet;
+import java.util.Set;
 
 import org.splat.dal.bo.kernel.Persistent;
 import org.splat.kernel.InvalidPropertyException;
@@ -22,7 +22,7 @@ public class DocumentType extends Persistent {
     private ProgressState     state;
        private String            step;     // List of (dash separated) steps (numbers) containing this type
     private String            result;   // Step (number ) having this type as result
-    private Set<DocumentType> uses = new HashSet<DocumentType>();
+    private final Set<DocumentType> uses = new HashSet<DocumentType>();
 
 //  ==============================================================================================================================
 //  Construction
@@ -38,7 +38,8 @@ public class DocumentType extends Persistent {
 
 //  - Public services
 
-      public void clear () {
+      @Override
+       public void clear () {
         super.clear();
         name    = null;
         step    = null;
@@ -47,24 +48,28 @@ public class DocumentType extends Persistent {
       }
 //  - Setters of DocumentType properties
       
-      public Properties setName (String name) throws InvalidPropertyException
+      public Properties setName (final String name) throws InvalidPropertyException
       {
-        if (name.length() == 0) throw new InvalidPropertyException("name");
+        if (name.length() == 0) {
+                       throw new InvalidPropertyException("name");
+               }
         this.name = name;
         return this;
       }
-      public Properties setResult (ProjectSettingsService.Step step)
+      public Properties setResult (final ProjectSettingsService.Step step)
       {
         this.result = String.valueOf(step.getNumber());
         return this;
       }
-      public Properties setStep (ProjectSettingsService.Step... step)
+      public Properties setStep (final ProjectSettingsService.Step... step)
       {
         this.step = "-";
-       for (int i=0; i<step.length; i++) this.step = this.step + String.valueOf(step[i].getNumber()) + "-";
+       for (int i=0; i<step.length; i++) {
+                       this.step = this.step + String.valueOf(step[i].getNumber()) + "-";
+               }
         return this;
       }
-      public Properties setUses (DocumentType... type)
+      public Properties setUses (final DocumentType... type)
       {
         this.uses = type;
         return this;
@@ -73,8 +78,12 @@ public class DocumentType extends Persistent {
         
       public void checkValidity() throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException
       {
-        if (name == null)  throw new MissedPropertyException("name");
-        if (step == null)  throw new MissedPropertyException("path");
+        if (name == null) {
+                       throw new MissedPropertyException("name");
+               }
+        if (step == null) {
+                       throw new MissedPropertyException("path");
+               }
       }
     }
 //  Database fetch constructor
@@ -82,32 +91,41 @@ public class DocumentType extends Persistent {
 //  -------------------------
     }
 //  Initialization constructor
-    public DocumentType (Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
+    public DocumentType (final Properties dprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
 //  -----------------------------------------
       super(dprop);              // Throws one of the above exception if not valid
       name   = dprop.name;
       state  = ProgressState.inCHECK;
       step   = dprop.step;
       result = dprop.result;     // May be null
-      if (dprop.uses != null) for (int i=0; i<dprop.uses.length; i++) getUses().add(dprop.uses[i]);
+      if (dprop.uses != null) {
+               for (int i=0; i<dprop.uses.length; i++) {
+                       getUses().add(dprop.uses[i]);
+               }
+       }
     }
 
 //  ==============================================================================================================================
 //  Public member functions
 //  ==============================================================================================================================
 
-    public boolean equals(Object entity) {
+    @Override
+       public boolean equals(final Object entity) {
 //  ------------------------------------
-      if (entity == null) return false;
+      if (entity == null) {
+               return false;
+       }
       if (entity instanceof String) {
-        return this.name.equals((String)entity);   // Names are unique
-      } else
-      if (entity instanceof DocumentType) {
+        return this.name.equals(entity);   // Names are unique
+      } else if (entity instanceof DocumentType) {
         DocumentType object = (DocumentType)entity;
         long   he = object.getIndex();
         long   me = this.getIndex();
-        if (me*he != 0) return (he == me);
-        else            return this.getName().equals(object.getName());
+        if (me*he != 0) {
+               return (he == me);
+        } else {
+               return this.getName().equals(object.getName());
+        }
       } else {
         return false;
       }
@@ -135,13 +153,17 @@ public class DocumentType extends Persistent {
  * @return true if documents of this type are attached to the given step.
  * @see    #isResultOf(org.splat.service.technical.ProjectSettingsServiceImpl.Step)
  */
-    public boolean isContentInto (ProjectSettingsService.Step step) {
+    public boolean isContentInto (final ProjectSettingsService.Step step) {
 //  --------------------------------------------------------
       String[] path = this.step.split("-");
       for (int i=0; i<path.length; i++) {
        String value = path[i];
-       if (value.length() == 0) continue;
-       if (Integer.valueOf(value) == step.getNumber()) return true;
+       if (value.length() == 0) {
+                       continue;
+               }
+       if (Integer.valueOf(value) == step.getNumber()) {
+                       return true;
+               }
       }
       return false;
     }
@@ -167,9 +189,11 @@ public class DocumentType extends Persistent {
  * @see    #isStepResult()
  * @see    #isStudyResult()
  */
-    public boolean isResultOf (ProjectSettingsService.Step step) {
+    public boolean isResultOf (final ProjectSettingsService.Step step) {
 //  -----------------------------------------------------
-      if (result == null) return false;
+      if (result == null) {
+               return false;
+       }
       return (Integer.valueOf(result) == step.getNumber());
     }
     
@@ -184,7 +208,7 @@ public class DocumentType extends Persistent {
         * Set the state.
         * @param state the state to set
         */
-       public void setState(ProgressState state) {
+       public void setState(final ProgressState state) {
                this.state = state;
        }
        /**
diff --git a/Workspace/Siman-Common/src/org/splat/dal/bo/som/Entity.java b/Workspace/Siman-Common/src/org/splat/dal/bo/som/Entity.java
deleted file mode 100644 (file)
index 13b9b50..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.splat.dal.bo.som;
-/**
- * Class whose only purpose is to represent the kernel's Entity class for propagating to this package the visibility of relations
- * and attributes editing functions.
- * 
- * @author    Daniel Brunier-Coulin
- * @copyright OPEN CASCADE 2012
- */
-
-import java.util.Set;
-
-import org.splat.dal.bo.kernel.Persistent;
-import org.splat.dal.bo.kernel.Relation;
-import org.splat.kernel.ObjectProperties;
-import org.splat.kernel.InvalidPropertyException;
-import org.splat.kernel.MissedPropertyException;
-import org.splat.kernel.MultiplyDefinedException;
-
-
-public abstract class Entity extends org.splat.dal.bo.kernel.Entity {
-
-//  ==============================================================================================================================
-//  Constructors
-//  ==============================================================================================================================
-
-//  Database fetch constructor
-    protected Entity () {
-    }
-//  Initialization constructor
-    protected Entity (ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
-//  ----------------------------------------
-      super(prop);
-    }
-
-//  ==============================================================================================================================
-//  Protected services
-//  ==============================================================================================================================
-
-    public Relation addRelation (Relation link) {
-//  ----------------------------------------------
-      return super.addRelation(link);
-    }
-
-    public Set<Relation> getAllRelations () {
-//  ------------------------------------------
-      return super.getAllRelations();
-    }
-
-    public void removeRelation (Class<? extends Relation> type, Persistent to) {
-//  -----------------------------------------------------------------------------
-      super.removeRelation(type, to);
-    }
-}
\ No newline at end of file
index fd8d747c97a3c5e57b0d62dbf23cb16dcbac2b3c..74c5a59596119deb8e23673c6399089cae9112d4 100644 (file)
@@ -14,12 +14,12 @@ import java.util.Set;
 import java.util.Vector;
 
 import org.apache.log4j.Logger;
-
+import org.splat.dal.bo.kernel.Entity;
 import org.splat.dal.bo.kernel.User;
-import org.splat.kernel.ObjectProperties;
 import org.splat.kernel.InvalidPropertyException;
 import org.splat.kernel.MissedPropertyException;
 import org.splat.kernel.MultiplyDefinedException;
+import org.splat.kernel.ObjectProperties;
 import org.splat.som.Step;
 
 
@@ -30,8 +30,8 @@ public abstract class ProjectElement extends Entity {
     protected  User                     manager;
     protected  Date                     credate;    // Object creation date
     protected  Date                     lasdate;    // Object Last modification date
-    private    List<SimulationContext>  contex = new Vector<SimulationContext>();     // Structured by the Step transient class
-    private    Set<Publication>         docums = new LinkedHashSet<Publication>();     // Structured by the Step transient class
+    private final    List<SimulationContext>  contex = new Vector<SimulationContext>();     // Structured by the Step transient class
+    private final    Set<Publication>         docums = new LinkedHashSet<Publication>();     // Structured by the Step transient class
 
 //  Transient field
     private    Step[]                   folders;
@@ -40,7 +40,7 @@ public abstract class ProjectElement extends Entity {
         * Set the folders.
         * @param folders the folders to set
         */
-       public void setFolders(Step[] folders) {
+       public void setFolders(final Step[] folders) {
                this.folders = folders;
        }
        /**
@@ -51,7 +51,7 @@ public abstract class ProjectElement extends Entity {
                return folders;
        }
 
-       protected final static Logger       logger = Logger.getLogger(ProjectElement.class);
+       protected final static Logger       LOGGER = Logger.getLogger(ProjectElement.class);
 
 //  ==============================================================================================================================
 //  Constructors
@@ -63,7 +63,7 @@ public abstract class ProjectElement extends Entity {
       folders  = null;
     }
 //  Initialization constructor
-    protected ProjectElement (ObjectProperties oprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
+    protected ProjectElement (final ObjectProperties oprop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
 //  -------------------------------------------------          
       super(oprop);       // Throws one of the above exception if not valid
       title    = null;     // Initialized by subclasses
@@ -96,7 +96,9 @@ public abstract class ProjectElement extends Entity {
 //  -------------------------------
       String               summary = null;
       DescriptionAttribute field   = (DescriptionAttribute)this.getAttribute(DescriptionAttribute.class);
-      if (field != null)   summary = field.getValue();
+      if (field != null) {
+               summary = field.getValue();
+       }
       return summary;               // May be null
     }
 
@@ -104,7 +106,7 @@ public abstract class ProjectElement extends Entity {
       return lasdate;
     }
 
-    public void setLastModificationDate (Date aDate) {
+    public void setLastModificationDate (final Date aDate) {
       lasdate = aDate;
     }
 
@@ -115,12 +117,14 @@ public abstract class ProjectElement extends Entity {
  * @param doc a document version published into this Project Element
  * @return the publication of the document version, or null if the given document version is not published into this Project Element
  */
-    public Publication getPublication (Document doc) {
+    public Publication getPublication (final Document doc) {
 //  ------------------------------------------------
       long  index = doc.getIndex();
       for (Iterator<Publication> i=docums.iterator(); i.hasNext(); ) {
        Publication  found = i.next();
-       if (found.value().getIndex() == index) return found;   // A document publication is unique in a given ProjectElement
+       if (found.value().getIndex() == index) {
+                       return found;   // A document publication is unique in a given ProjectElement
+               }
       }
       return null;
     }
@@ -130,16 +134,18 @@ public abstract class ProjectElement extends Entity {
       return title;
     }
 
-    public void setTitle (String aTitle) {
+    public void setTitle (final String aTitle) {
       title = aTitle;
     }
 
-    public boolean publishes (Document doc) {
+    public boolean publishes (final Document doc) {
 //  ---------------------------------------
       long  index = doc.getIndex();
       for (Iterator<Publication> i=docums.iterator(); i.hasNext(); ) {
        Document  found = i.next().value();
-       if (found.getIndex() == index) return true;
+       if (found.getIndex() == index) {
+                       return true;
+               }
       }
       return false;
     }
@@ -158,22 +164,22 @@ public abstract class ProjectElement extends Entity {
 //  Protected member functions
 //  ==============================================================================================================================
 
-    public boolean add (Publication newdoc) {
+    public boolean add (final Publication newdoc) {
 //  ------------------------------------------
       return  docums.add(newdoc);
     }
 
-    public boolean add (SimulationContext newdoc) {
+    public boolean add (final SimulationContext newdoc) {
 //  ------------------------------------------------
       return  contex.add(newdoc);
     }
 
-    public boolean remove (Publication oldoc) {
+    public boolean remove (final Publication oldoc) {
 //  --------------------------------------------
       return  docums.remove(oldoc);   // The removed tag becoming orphan, it is supposed automatically deleted from the data store
     }
 
-    public boolean remove (SimulationContext oldoc) {
+    public boolean remove (final SimulationContext oldoc) {
 //  --------------------------------------------------
       return  contex.remove(oldoc);
     }
index 6dafc733cd1b74f0ba1e2f0866825d5a514e380c..5ec4291d85be9f5ca871ab8dd9debc2656d97338 100644 (file)
@@ -51,7 +51,7 @@ public class Publication extends Persistent {
         * Set the mystep.
         * @param aStep the mystep to set
         */
-       public void setStep(Step aStep) {
+       public void setStep(final Step aStep) {
                this.mystep = aStep;
        }
        //  Database fetch constructor
@@ -60,7 +60,7 @@ public class Publication extends Persistent {
       mystep = null;
     }
 //  Internal constructors
-    public Publication (Document doc, ProjectElement publisher) {
+    public Publication (final Document doc, final ProjectElement publisher) {
 //  --------------------------------------------------------------
       mydoc  = doc;
       mystep = null;
@@ -71,15 +71,18 @@ public class Publication extends Persistent {
 //  Member functions
 //  ==============================================================================================================================
 
-    public Relation addDependency (Publication to) {
+    public Relation addDependency (final Publication to) {
 //  ----------------------------------------------
       return  this.addDependency(to.value());
     }
 
-    public Relation addDependency (Document to) {
+    public Relation addDependency (final Document to) {
 //  -------------------------------------------
-      if (to == null) return null;
-      else            return mydoc.addRelation( new UsesRelation(mydoc, to) );
+      if (to == null) {
+               return null;
+       } else {
+               return mydoc.addRelation( new UsesRelation(mydoc, to) );
+       }
     }
 
 /**
@@ -99,14 +102,17 @@ public class Publication extends Persistent {
         * Set the owner.
         * @param owner the owner to set
         */
-       public void setOwner(ProjectElement owner) {
+       public void setOwner(final ProjectElement owner) {
                this.owner = owner;
        }
 
        public Study getOwnerStudy () {
 //  -----------------------------
-      if (owner instanceof Study) return  (Study)owner;
-      else                        return ((Scenario)owner).getOwnerStudy();
+      if (owner instanceof Study) {
+               return  (Study)owner;
+       } else {
+               return ((Scenario)owner).getOwnerStudy();
+       }
     }
 
 /**
@@ -119,13 +125,18 @@ public class Publication extends Persistent {
  */
     public ProgressState getProgressState () {
 //  ----------------------------------------
-      if (this.isOutdated()) return ProgressState.inWORK;   // Overrides the document state
-      else                   return mydoc.getProgressState();
+      if (this.isOutdated()) {
+               return ProgressState.inWORK;   // Overrides the document state
+       } else {
+               return mydoc.getProgressState();
+       }
     }
 
-    public List<Publication> getRelations (Class<? extends Relation> type) {
+    public List<Publication> getRelations (final Class<? extends Relation> type) {
 //  ----------------------------------------------------------------------
-      if (type == null) return null;
+      if (type == null) {
+               return null;
+       }
 
       List<Publication> result = new ArrayList<Publication>();
       List<Relation>    relist = mydoc.getRelations(type);
@@ -135,10 +146,11 @@ public class Publication extends Persistent {
         Publication  related   = owner.getPublication(relatedoc);
         if (related != null) {
           result.add(related);
-        } else
-               if (owner instanceof Scenario) {   // The relation may cross steps belonging to a scenario and its owner study
+        } else if (owner instanceof Scenario) {   // The relation may cross steps belonging to a scenario and its owner study
                  related = ((Scenario)owner).getOwnerStudy().getPublication(relatedoc);
-                 if (related != null) result.add(related);
+                 if (related != null) {
+                         result.add(related);
+                 }
                }
       }
       return result;
@@ -170,7 +182,7 @@ public class Publication extends Persistent {
         * Set the isnew.
         * @param isnew the isnew to set
         */
-       public void setIsnew(char isnew) {
+       public void setIsnew(final char isnew) {
                this.isnew = isnew;
        }
        
@@ -185,7 +197,7 @@ public class Publication extends Persistent {
         * Set the mydoc.
         * @param mydoc the mydoc to set
         */
-       public void setValue (Document aDoc) {
+       public void setValue (final Document aDoc) {
                this.mydoc = aDoc;
        }
 }
\ No newline at end of file
index 607582aba8d21ff42ed0a060036ccec8dceac942..aa18647188418cfa79680096765f6fd7369cf39f 100644 (file)
@@ -38,11 +38,11 @@ public class SimulationContextType extends Persistent implements Serializable {
       public ProjectSettingsService.Step getStep () {
        return step;
       }
-      public Properties setProgressState (ProgressState state) {
+      public Properties setProgressState (final ProgressState state) {
        this.state = state;
        return this;
       }
-      public Properties setStep (ProjectSettingsService.Step  step) {
+      public Properties setStep (final ProjectSettingsService.Step  step) {
        this.step = step;
        return this;
       }
@@ -51,7 +51,7 @@ public class SimulationContextType extends Persistent implements Serializable {
     protected SimulationContextType () {
     }
 //  Initialization constructor
-    public SimulationContextType (String name, ProjectSettingsService.Step step) throws InvalidPropertyException {
+    public SimulationContextType (final String name, final ProjectSettingsService.Step step) throws InvalidPropertyException {
 //  ------------------------------------------------------------------------
       super();
       this.name  = name;
@@ -63,18 +63,23 @@ public class SimulationContextType extends Persistent implements Serializable {
 //  Public member functions
 //  ==============================================================================================================================
 
-    public boolean equals(Object entity) {
+    @Override
+       public boolean equals(final Object entity) {
 //  ------------------------------------
-      if (entity == null) return false;
+      if (entity == null) {
+               return false;
+       }
       if (entity instanceof String) {
-        return this.name.equals((String)entity);   // Names are unique
-      } else
-      if (entity instanceof SimulationContextType) {
+        return this.name.equals(entity);   // Names are unique
+      } else if (entity instanceof SimulationContextType) {
          SimulationContextType object = (SimulationContextType)entity;
         long   he = object.getIndex();
         long   me = this.getIndex();
-        if (me*he != 0) return (he == me);
-        else            return this.getName().equals(object.getName());
+        if (me*he != 0) {
+               return (he == me);
+        } else {
+               return this.getName().equals(object.getName());
+        }
       } else {
         return false;
       }
@@ -85,9 +90,11 @@ public class SimulationContextType extends Persistent implements Serializable {
       return name;
     }
 
-    public boolean isAttachedTo (ProjectSettingsService.Step step) {
+    public boolean isAttachedTo (final ProjectSettingsService.Step step) {
 //  -------------------------------------------------------
-      if (this.step == step.getNumber()) return true;
+      if (this.step == step.getNumber()) {
+               return true;
+       }
       return false;
     }
 
@@ -106,7 +113,7 @@ public class SimulationContextType extends Persistent implements Serializable {
         * Set the state.
         * @param state the state to set
         */
-       public void setState(ProgressState state) {
+       public void setState(final ProgressState state) {
                this.state = state;
        }
        /**
@@ -120,7 +127,7 @@ public class SimulationContextType extends Persistent implements Serializable {
         * Set the step.
         * @param step the step to set
         */
-       public void setStep(int step) {
+       public void setStep(final int step) {
                this.step = step;
        }
 
diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/AbstractDatabase.java
new file mode 100644 (file)
index 0000000..0bfef74
--- /dev/null
@@ -0,0 +1,28 @@
+package org.splat.dal.dao.kernel;
+
+/**
+ * 
+ * @author    Daniel Brunier-Coulin
+ * @copyright OPEN CASCADE 2012
+ */
+
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
+
+public abstract class AbstractDatabase extends HibernateDaoSupport {
+
+//     protected final static Logger logger = Logger.getLogger(Database.class);
+
+       // ==============================================================================================================================
+       // Protected services
+       // ==============================================================================================================================
+
+       protected String getSchemaVersion() {
+               String res = "";
+               return res;// TODO: Get schema version from the specific object/table
+       }
+
+       protected void setSchemaVersion(final String version) {
+               // TODO: Set schema version into specific object/table: myIDpool = new IDPool(version);
+               // getSession().save(myIDpool);
+       }
+}
\ No newline at end of file
diff --git a/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/Database.java b/Workspace/Siman-Common/src/org/splat/dal/dao/kernel/Database.java
deleted file mode 100644 (file)
index 9f13ef3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.splat.dal.dao.kernel;
-
-/**
- * 
- * @author    Daniel Brunier-Coulin
- * @copyright OPEN CASCADE 2012
- */
-
-import org.hibernate.Session;
-import org.splat.service.technical.IndexService;
-import org.splat.service.technical.RepositoryService;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-import org.apache.log4j.Logger;
-
-public abstract class Database extends HibernateDaoSupport implements
-               ApplicationContextAware {
-
-       /**
-        * The ApplicationContext.
-        */
-       private static ApplicationContext _context = null;
-
-       /**
-        * Spring will call this method for initialize the applicationContext.
-        * 
-        * @param ctx
-        *            the application context
-        * @throws BeansException
-        *             the BeanException
-        */
-       public void setApplicationContext(final ApplicationContext ctx)
-                       throws BeansException {
-               _context = ctx;
-       }
-
-       /**
-        * Static for getting the context.
-        * 
-        * @return ApplicationContext the application context
-        */
-       public static ApplicationContext getContext() {
-               return _context;
-       }
-
-       // private static String CONFIG_FILE = "/hibernate.cfg.xml";
-       protected final static Logger logger = Logger.getLogger(Database.class);
-
-       // ==============================================================================================================================
-       // Protected services
-       // ==============================================================================================================================
-
-       protected String getSchemaVersion() {
-               // ------------------------------------
-               return null;// TODO: Get schema version into specific object/table: getIDPool().getSchemaVersion();
-       }
-
-       protected void setSchemaVersion(String version) {
-               // ------------------------------------------------
-               // TODO: Set schema version into specific object/table: myIDpool = new IDPool(version);
-               // getSession().save(myIDpool);
-       }
-
-       // ==============================================================================================================================
-       // Private services
-       // ==============================================================================================================================
-//{
-//             if (myDB == null) {
-//                     myDB = new Database();
-//             }
-//             return myDB;
-//     }
-}
\ No newline at end of file
index 4a206b93ecb49c3bf446621a971bc24254796fa6..c87860648ea6377318c57020d3eb65b8f246574d 100644 (file)
@@ -6,24 +6,23 @@ package org.splat.dal.dao.som;
  * @copyright OPEN CASCADE 2012
  */
 
-import java.util.Properties;
 import java.io.IOException;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Properties;
 
+import org.apache.log4j.Logger;
 import org.hibernate.Session;
 import org.hibernate.jdbc.Work;
-import org.apache.log4j.Logger;
-
 import org.splat.dal.bo.kernel.User;
 import org.splat.service.UserService;
 import org.splat.service.technical.IndexService;
 import org.splat.service.technical.RepositoryService;
 import org.springframework.transaction.annotation.Transactional;
 
-public class Database extends org.splat.dal.dao.kernel.Database {
+public class Database extends org.splat.dal.dao.kernel.AbstractDatabase {
 
        private int uplevel = 0; // Level of database upgrade
        private RepositoryService _repositoryService;
@@ -43,19 +42,20 @@ public class Database extends org.splat.dal.dao.kernel.Database {
                 * {@inheritDoc}
                 * @see org.hibernate.jdbc.Work#execute(java.sql.Connection)
                 */
-               public void execute(Connection connex) throws SQLException {
+               public void execute(final Connection connex) throws SQLException {
                        DatabaseMetaData dbmdata = connex.getMetaData();
                        String dbname = connex.getCatalog();
                        ResultSet table;
 
                        table = dbmdata.getTables(dbname, null, "study", null);
-                       if (table.next())
+                       if (table.next()) {
                                return;
+                       }
                        uplevel = -1; // Database not initialized
                }
        }
 
-       public final static Logger logger = org.splat.dal.dao.kernel.Database.logger;
+       public final static Logger logger = org.splat.dal.dao.som.Database.logger;
 
        // ==============================================================================================================================
        // Construction
@@ -75,13 +75,14 @@ public class Database extends org.splat.dal.dao.kernel.Database {
        }
 
        public Database getCheckedDB() {
-               if (my == null)
+               if (my == null) {
                        try {
                                my = this;
                                my.checkVersion();
                        } catch (Exception error) {
                                logger.fatal("Could not access the database, reason:", error);
                        }
+               }
                return my;
        }
 
@@ -122,7 +123,7 @@ public class Database extends org.splat.dal.dao.kernel.Database {
        // Protected member functions
        // ==============================================================================================================================
 
-       public void configure(Properties reprop) throws IOException {
+       public void configure(final Properties reprop) throws IOException {
                String basepath = reprop.getProperty("repository");
                getRepositoryService().setBasepath(basepath);
                getIndexService().configure();
@@ -169,11 +170,11 @@ public class Database extends org.splat.dal.dao.kernel.Database {
                return _repositoryService;
        }
 
-       public void setRepositoryService(RepositoryService repositoryService) {
+       public void setRepositoryService(final RepositoryService repositoryService) {
                _repositoryService = repositoryService;
        }
 
-       public void setIndexService(IndexService indexService) {
+       public void setIndexService(final IndexService indexService) {
                _indexService = indexService;
        }
 
@@ -189,7 +190,7 @@ public class Database extends org.splat.dal.dao.kernel.Database {
         * Set the userService.
         * @param userService the userService to set
         */
-       public void setUserService(UserService userService) {
+       public void setUserService(final UserService userService) {
                _userService = userService;
        }
 }
\ No newline at end of file
index 679ddec128bb86afe700411a2b01da5276da7c98..690574e5e5234ce99145eb930464061a7a9237cc 100644 (file)
@@ -10,6 +10,7 @@
 package org.splat.i18n; 
 
 import java.util.Locale;
+
 import org.springframework.context.support.ResourceBundleMessageSource;
 
 /**
@@ -23,7 +24,7 @@ public final class I18nUtils {
        /**
         * Contains the list of resources bundle. 
         */
-       private static ResourceBundleMessageSource _resourceBundleMessageSource;
+       private static ResourceBundleMessageSource resourceBundleMessageSource;
        
        /**
         * .
@@ -43,7 +44,7 @@ public final class I18nUtils {
         * @return message i18n
         */
        public static String getMessage(final Locale locale, final String code, final Object... context) {
-               return _resourceBundleMessageSource.getMessage(code, context, locale);
+               return resourceBundleMessageSource.getMessage(code, context, locale);
        }
        
        
@@ -76,15 +77,15 @@ public final class I18nUtils {
         * @return the resourceBundleMessageSource
         */
        protected ResourceBundleMessageSource getResourceBundleMessageSource() {
-               return _resourceBundleMessageSource;
+               return resourceBundleMessageSource;
        }
        /**
         * Set the resourceBundleMessageSource.
-        * @param resourceBundleMessageSource the resourceBundleMessageSource to set
+        * @param aResourceBundleMessageSource the resourceBundleMessageSource to set
         */
        public void setResourceBundleMessageSource(
-                       final ResourceBundleMessageSource resourceBundleMessageSource) {
-               _resourceBundleMessageSource = resourceBundleMessageSource;
+                       final ResourceBundleMessageSource aResourceBundleMessageSource) {
+               resourceBundleMessageSource = aResourceBundleMessageSource;
        }       
        
 }
index 98ac862c96b10bac42c79bd0594dca223616bc62..ddb9559f7afeb42cb79aedd0f181eb8d47f85e7e 100644 (file)
@@ -10,22 +10,22 @@ public class ImportedStudyDTO {
        /**
         * DB primary key.
         */
-       private long    rid;
+       private long    _rid;
     /**
      * Study reference.
      */
-    private String  sid;
+    private String  _reference;
     /**
      * Study title.
      */
-    private String  title;
+    private String  _title;
 
        /**
         * Get the rid.
         * @return the rid
         */
        public long getIndex() {
-               return rid;
+               return _rid;
        }
 
        /**
@@ -33,15 +33,15 @@ public class ImportedStudyDTO {
         * @return the rid
         */
        public long getRid() {
-               return rid;
+               return _rid;
        }
 
        /**
         * Set the rid.
         * @param rid the rid to set
         */
-       public void setRid(long rid) {
-               this.rid = rid;
+       public void setRid(final long rid) {
+               this._rid = rid;
        }
 
        /**
@@ -49,15 +49,15 @@ public class ImportedStudyDTO {
         * @return the sid
         */
        public String getReference() {
-               return sid;
+               return _reference;
        }
 
        /**
         * Set the sid.
         * @param sid the sid to set
         */
-       public void setReference(String sid) {
-               this.sid = sid;
+       public void setReference(final String sid) {
+               this._reference = sid;
        }
 
        /**
@@ -65,14 +65,14 @@ public class ImportedStudyDTO {
         * @return the title
         */
        public String getTitle() {
-               return title;
+               return _title;
        }
 
        /**
         * Set the title.
         * @param title the title to set
         */
-       public void setTitle(String title) {
-               this.title = title;
+       public void setTitle(final String title) {
+               this._title = title;
        }
 }
\ No newline at end of file
index e354bd9c5d1dcb20159bd766d6c771ae29cb036e..fe1be2c855e77e5edf167aed226195dab2f8e3e3 100644 (file)
@@ -1,4 +1,5 @@
 package org.splat.service.dto;
+
 /**
  * 
  * @author    Daniel Brunier-Coulin
@@ -6,166 +7,262 @@ package org.splat.service.dto;
  */
 
 import java.text.DecimalFormat;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Vector;
 
 import org.splat.dal.bo.som.ProgressState;
 import org.splat.som.Step;
 
-
+/**
+ * DTO for an open knowledge element.
+ */
 public class KnowledgeElementDTO {
 
-       private long                     rid;
-       private KnowledgeElementTypeDTO  type;     // User extendable types
-    private ProgressState            state;
-    private String                   title;
-    private String                   value;
-    private UserDTO                  author;
-    private Date                     date;
-    private List<Step>               involving = new Vector<Step>();
-       private String                   studyTitle;
-       private String                   scenarioTitle;
+       /**
+        * Primary key.
+        */
+       private long _index;
+       /**
+        * User extendable knowledge type.
+        */
+       private KnowledgeElementTypeDTO _type;
+       /**
+        * Knowledge element progress state.
+        */
+       private ProgressState _progressState;
+       /**
+        * Knowledge title.
+        */
+       private String _title;
+       /**
+        * Knowledge text.
+        */
+       private String _value;
+       /**
+        * Knowledge author.
+        */
+       private UserDTO _author;
+       /**
+        * Knowledge modification date.
+        */
+       private Date _date;
+       /**
+        * Study steps involving this knowledge.
+        */
+       private transient final List<Step> _involving = new ArrayList<Step>();
+       /**
+        * Parent study title.
+        */
+       private String _studyTitle;
+       /**
+        * Parent scenario title.
+        */
+       private String _scenarioTitle;
 
-//  ==============================================================================================================================
-//  Public member functions
-//  ==============================================================================================================================
+       // ==============================================================================================================================
+       // Public member functions
+       // ==============================================================================================================================
 
-    /**
-     * @param given
-     * @return
-     */
-    public boolean equals (KnowledgeElementDTO given) {
-      if (!this.getType().equals(given.getType())) return false;
-      if (this.getValue().equals(given.getValue())) return true;
-      return false;      
-    }
+       /**
+        * Compare this knowledge element with the given one.
+        * 
+        * @param given
+        *            the knowledge element to compare to
+        * @return true if knowledge elements are equal
+        */
+       public boolean equals(final KnowledgeElementDTO given) { //NOPMD: RKV: TODO: to be refined
+               return (this.getType().equals(given.getType()) && this.getValue()
+                               .equals(given.getValue()));
+       }
 
-    public UserDTO getAuthor () {
-      return author;
-    }
+       /**
+        * Get knowledge author.
+        * 
+        * @return the author as user DTO
+        */
+       public UserDTO getAuthor() {
+               return _author;
+       }
 
-    public Date getDate () {
-      return date;
-    }
+       /**
+        * Get knowledge modification date.
+        * 
+        * @return the modification date
+        */
+       public Date getDate() {
+               return _date;
+       }
 
-    public ProgressState getProgressState () {
-      return state;
-    }
+       /**
+        * Get knowledge progress state.
+        * 
+        * @return the knowledge state
+        */
+       public ProgressState getProgressState() {
+               return _progressState;
+       }
 
-    public String getTitle () {
-      return title;
-    }
+       /**
+        * Get knowledge title.
+        * 
+        * @return the title
+        */
+       public String getTitle() {
+               return _title;
+       }
 
-    public String getReference () {
-      DecimalFormat toString = new DecimalFormat("00000");   // Supports 99 999 knowledge elements
-      return "KE" + toString.format(this.getIndex());
-    }
+       /**
+        * Get knowledge reference.
+        * 
+        * @return the reference
+        */
+       public String getReference() {
+               DecimalFormat toString = new DecimalFormat("00000"); // Supports 99 999 knowledge elements
+               return "KE" + toString.format(this.getIndex());
+       }
 
-    public KnowledgeElementTypeDTO getType () {
-      return type;
-    }
+       /**
+        * Get knowledge type.
+        * 
+        * @return the knowledge type
+        */
+       public KnowledgeElementTypeDTO getType() {
+               return _type;
+       }
 
-    public String getValue () {
-      return value;
-    }
+       /**
+        * Get knowledge text.
+        * 
+        * @return the knowledge text
+        */
+       public String getValue() {
+               return _value;
+       }
 
        /**
-        * Set a status of 
-        * @param aState knowledge element progress state to set
+        * Set a status of this knowledge.
+        * 
+        * @param aState
+        *            knowledge element progress state to set
         */
-       public void setProgressState(ProgressState aState) {
-               state = aState;
+       public void setProgressState(final ProgressState aState) {
+               _progressState = aState;
        }
+
        /**
         * Set a title of the knowledge.
-        * @param aTitle a title to set
+        * 
+        * @param aTitle
+        *            a title to set
         */
-       public void setTitle(String aTitle) {
-               title = aTitle;
+       public void setTitle(final String aTitle) {
+               _title = aTitle;
        }
+
        /**
         * Set the value.
-        * @param value the value to set
+        * 
+        * @param value
+        *            the value to set
         */
-       public void setValue(String value) {
-               this.value = value;
+       public void setValue(final String value) {
+               this._value = value;
        }
+
        /**
         * Get list of involving steps.
+        * 
         * @return list of steps
         */
        public List<Step> getInvolving() {
-               return involving;
+               return _involving;
        }
+
        /**
         * Get title of the parent study.
+        * 
         * @return study title
         */
        public String getStudyTitle() {
-               return studyTitle;
+               return _studyTitle;
        }
+
        /**
         * Get title of the parent scenario.
+        * 
         * @return scenario title
         */
        public String getScenarioTitle() {
-               return scenarioTitle;
+               return _scenarioTitle;
        }
 
        /**
         * Get the rid.
+        * 
         * @return the rid
         */
        public long getIndex() {
-               return rid;
+               return _index;
        }
 
        /**
         * Set the rid.
-        * @param rid the rid to set
+        * 
+        * @param rid
+        *            the rid to set
         */
-       public void setIndex(long rid) {
-               this.rid = rid;
+       public void setIndex(final long rid) {
+               this._index = rid;
        }
 
        /**
         * Set the studyTitle.
-        * @param studyTitle the studyTitle to set
+        * 
+        * @param studyTitle
+        *            the studyTitle to set
         */
-       public void setStudyTitle(String studyTitle) {
-               this.studyTitle = studyTitle;
+       public void setStudyTitle(final String studyTitle) {
+               this._studyTitle = studyTitle;
        }
 
        /**
         * Set the scenarioTitle.
-        * @param scenarioTitle the scenarioTitle to set
+        * 
+        * @param scenarioTitle
+        *            the scenarioTitle to set
         */
-       public void setScenarioTitle(String scenarioTitle) {
-               this.scenarioTitle = scenarioTitle;
+       public void setScenarioTitle(final String scenarioTitle) {
+               this._scenarioTitle = scenarioTitle;
        }
 
        /**
         * Set the type.
-        * @param type the type to set
+        * 
+        * @param type
+        *            the type to set
         */
-       public void setType(KnowledgeElementTypeDTO type) {
-               this.type = type;
+       public void setType(final KnowledgeElementTypeDTO type) {
+               this._type = type;
        }
 
        /**
         * Set the author.
-        * @param author the author to set
+        * 
+        * @param author
+        *            the author to set
         */
-       public void setAuthor(UserDTO author) {
-               this.author = author;
+       public void setAuthor(final UserDTO author) {
+               this._author = author;
        }
 
        /**
         * Set the date.
-        * @param date the date to set
+        * 
+        * @param date
+        *            the date to set
         */
-       public void setDate(Date date) {
-               this.date = date;
+       public void setDate(final Date date) {
+               this._date = date;
        }
 }
\ No newline at end of file
index a26b7c59204aebac14fc1f6bcaacad16f8291ce2..b45b411f9360ab5baf6f5b0a02ca2f253581a2ae 100644 (file)
@@ -8,3 +8,5 @@ dist/*
 bin/*
 *.class
 *.war
+reports
+reports/*
index 05d8fd431d29e431df2809ad3b9744fa6e804432..dc7a2c18736c39413e3fe4b2ab8c7cbca6119524 100644 (file)
@@ -3,4 +3,5 @@
     <useProjectRuleSet>true</useProjectRuleSet>
     <ruleSetFile>siman-pmd.ruleset</ruleSetFile>
     <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
 </pmd>
index cdf9f8d29f3b09626d8e65b2282e4185e15a0acd..f333516676eb5380f63ff7a884c0e8ee5048042d 100644 (file)
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+                       <name>org.springframework.ide.eclipse.core.springbuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
-                       <name>org.springframework.ide.eclipse.core.springbuilder</name>
+                       <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
@@ -66,5 +66,6 @@
                <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
                <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
                <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
+               <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
        </natures>
 </projectDescription>
index e7a377e8477f3e905891c7827fe37370e343f4cf..112242429958d41eb4c0c94623d789a582e2e8b0 100644 (file)
                <copy-config mode="release" />
        </target>
 
+    <!-- ===================================================================== -->
+    <!-- compile-java : compile the java classes                               -->
+    <!-- ===================================================================== -->
+    <target name="compile-java" depends="siman-common" description="Builds the java classes">
+        <echo message="Compile Siman java classes" />
+        <mkdir dir="${siman.bin.dir}/temp"/>
+        <javac target="1.6" srcdir="${siman.src.dir}"  destdir="${siman.bin.dir}/temp" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" fork="true" optimize="${compiler.optimize}" deprecation="${compiler.deprecation}">
+            <classpath>
+                <fileset dir="../${siman-common.project.name}/${siman-common.ext.dir}" includes="**/*" />
+                <fileset dir="../${splat.project.name}/${splat.dist.dir}" includes="**/*" />
+                <fileset dir="../${splat.project.name}/${splat.lib.dir}" includes="**/*" />
+                <fileset dir="../${siman-common.project.name}/${siman-common.dist.dir}" includes="**/*" />
+                <fileset dir="../${siman-common.project.name}/${siman-common.lib.dir}" includes="**/*" />
+                <fileset dir="${siman.content.dir}/WEB-INF/lib" includes="**/*" />
+             </classpath>
+            <exclude name="test/**" />
+        </javac>
+    </target>
+
        <!-- ===================================================================== -->
        <!-- build-dist : Create the war file                                                      -->
        <!-- ===================================================================== -->
-       <target name="build-war" depends="clean, siman-common, release-config" description="Builds the WAR distribution">
+       <target name="build-war" depends="clean, siman-common, compile-java, release-config" description="Builds the WAR distribution">
                <echo message="build ${webapp.name}.war" />
 
                <mkdir dir="${siman.dist.dir}" />
index 534af487b298ea6d450743ff667efa829409bcd6..e610618ba174d493c5e2a7097eaddb70fa76b82d 100644 (file)
@@ -8,7 +8,6 @@
        level 5 : good practices
        </description>
        
-       <exclude-pattern>.*/org/.*</exclude-pattern>
        <exclude-pattern>.*/test/.*</exclude-pattern>
        
        <rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
index 94db428125ca6b728b67b740466a0c19223d2a53..dd6d2743e58a41ae46db10a7b40393ead33662bb 100644 (file)
@@ -1,4 +1,4 @@
-# Generated at 12/10/2012 07:20:45
+# Generated at 02/11/2012 08:35:56
 # Don't edit manually. See the source in D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\conf\templates.
 # Connection properties
 connection.driver_class=com.mysql.jdbc.Driver
index aeb70ccb185060f46cf889d35fb10e3cfa48a72a..7573dfc63e127d00c03f23ae640fb793d4fdf127 100644 (file)
@@ -1,4 +1,4 @@
-# Generated at 12/10/2012 07:20:45
+# Generated at 02/11/2012 08:35:56
 # Don't edit manually. See the source in D:\users\rkv\SIMAN\SIMAN_SRC\Workspace\Siman\conf\templates.
 # Connection properties
 connection.url=jdbc:mysql://localhost/simer
index 878975b33dfe3db0c9905bf78078d31624482284..332d9209aa0838d5f5f772b0b2eb1f5ffdd92a68 100644 (file)
@@ -9,18 +9,8 @@ import java.util.Vector;
 import org.hibernate.HibernateException;
 import org.hibernate.Session;
 import org.hibernate.Transaction;
-import org.splat.kernel.Do;
 import org.splat.dal.bo.kernel.User;
-import org.splat.service.DocumentTypeService;
-import org.splat.service.PublicationService;
-import org.splat.service.ScenarioService;
-import org.splat.service.SimulationContextService;
-import org.splat.service.StepService;
-import org.splat.service.technical.RepositoryService;
-import org.splat.simer.Action;
-import org.splat.simer.OpenStudy;
 import org.splat.dal.bo.som.ConvertsRelation;
-import org.splat.dal.dao.som.Database;
 import org.splat.dal.bo.som.Document;
 import org.splat.dal.bo.som.DocumentType;
 import org.splat.dal.bo.som.ProgressState;
@@ -28,6 +18,16 @@ import org.splat.dal.bo.som.Publication;
 import org.splat.dal.bo.som.Scenario;
 import org.splat.dal.bo.som.SimulationContext;
 import org.splat.dal.bo.som.SimulationContextType;
+import org.splat.dal.dao.som.Database;
+import org.splat.kernel.Do;
+import org.splat.service.DocumentTypeService;
+import org.splat.service.PublicationService;
+import org.splat.service.ScenarioService;
+import org.splat.service.SimulationContextService;
+import org.splat.service.StepService;
+import org.splat.service.technical.RepositoryService;
+import org.splat.simer.Action;
+import org.splat.simer.OpenStudy;
 import org.splat.som.Step;
 
 public class SaveDocumentAction extends Action {
@@ -105,8 +105,9 @@ public class SaveDocumentAction extends Action {
                                                        .setAuthor(user));
                        // Writing the uploaded file into the created document
                        File target = credoc.getSourceFile().asFile();
-                       if (target.exists())
+                       if (target.exists()) {
                                target.delete();
+                       }
                        Do.copy(upfile, target); // Instead of rename for keeping the "uploaded" file for further use
                        // upfile.renameTo(target);
 
@@ -129,8 +130,9 @@ public class SaveDocumentAction extends Action {
                                                credoc, "brep");
 
                                target = export.getTo().asFile();
-                               if (target.exists())
+                               if (target.exists()) {
                                        target.delete();
+                               }
                                Do.copy(upfile, target); // Instead of rename for keeping the "uploaded" file for further use
                        }
                        // 2. Addition of simulation contexts
@@ -200,7 +202,7 @@ public class SaveDocumentAction extends Action {
         * @param publicationService
         *            the publicationService to set
         */
-       public void setPublicationService(PublicationService publicationService) {
+       public void setPublicationService(final PublicationService publicationService) {
                _publicationService = publicationService;
        }
 
@@ -219,7 +221,7 @@ public class SaveDocumentAction extends Action {
         * @param scenarioService
         *            the scenarioService to set
         */
-       public void setScenarioService(ScenarioService scenarioService) {
+       public void setScenarioService(final ScenarioService scenarioService) {
                _scenarioService = scenarioService;
        }
 
@@ -238,7 +240,7 @@ public class SaveDocumentAction extends Action {
         * @param stepService
         *            the stepService to set
         */
-       public void setStepService(StepService stepService) {
+       public void setStepService(final StepService stepService) {
                _stepService = stepService;
        }
 
@@ -268,16 +270,18 @@ public class SaveDocumentAction extends Action {
                        Publication current = mystudy.getSelectedDocument();
                        Document.Properties dprop = new Document.Properties();
                        dprop.setAuthor(user);
-                       if (summary.length() > 0)
+                       if (summary.length() > 0) {
                                dprop.setDescription(summary);
+                       }
 
                        Publication next = getStepService().versionDocument(step, current,
                                        dprop);
 
                        // Writing the uploaded file into the created document
                        File target = next.getSourceFile().asFile();
-                       if (target.exists())
+                       if (target.exists()) {
                                target.delete();
+                       }
                        Do.copy(upfile, target); // Instead of rename for keeping the "uploaded" file for further use
                        // upfile.renameTo(target);
 
@@ -301,8 +305,9 @@ public class SaveDocumentAction extends Action {
                                                "brep");
                                String fname = table[0];
 
-                               for (int i = 1; i < table.length - 1; i++)
+                               for (int i = 1; i < table.length - 1; i++) {
                                        fname = fname + table[i];
+                               }
                                upfile = new File(upath + fname + ".brep");
                                upfile.renameTo(export.getTo().asFile());
                        }
@@ -335,27 +340,27 @@ public class SaveDocumentAction extends Action {
                return summary;
        }
 
-       public void setDescription(String summary) {
+       public void setDescription(final String summary) {
                // -------------------------------------------
                this.summary = summary;
        }
 
-       public void setDocumentName(String name) {
+       public void setDocumentName(final String name) {
                // -----------------------------------------
                this.docname = name;
        }
 
-       public void setDocumentState(String state) {
+       public void setDocumentState(final String state) {
                // -------------------------------------------
                this.state = ProgressState.valueOf(state);
        }
 
-       public void setDocumentType(String value) {
+       public void setDocumentType(final String value) {
                // ------------------------------------------
                this.doctype = Integer.valueOf(value);
        }
 
-       public void setFileName(String name) {
+       public void setFileName(final String name) {
                // -------------------------------------
                this.filename = name;
        }
@@ -364,16 +369,17 @@ public class SaveDocumentAction extends Action {
        // Private service
        // ==============================================================================================================================
 
-       private void setupDefaultUses(DocumentType type) {
+       private void setupDefaultUses(final DocumentType type) {
                Set<DocumentType> uses = type.getDefaultUses();
 
                for (Iterator<DocumentType> i = uses.iterator(); i.hasNext();) {
                        DocumentType usetype = i.next();
                        List<Document> usedoc = mystudy.collectInvolvedDocuments(usetype);
-                       if (usedoc.isEmpty())
+                       if (usedoc.isEmpty()) {
                                setupDefaultUses(usetype);
-                       else
+                       } else {
                                defuses.addAll(usedoc);
+                       }
                }
        }
 
@@ -392,7 +398,7 @@ public class SaveDocumentAction extends Action {
         * @param repositoryService
         *            the repositoryService to set
         */
-       public void setRepositoryService(RepositoryService repositoryService) {
+       public void setRepositoryService(final RepositoryService repositoryService) {
                _repositoryService = repositoryService;
        }
 
@@ -412,7 +418,7 @@ public class SaveDocumentAction extends Action {
         *            the simulationContextService to set
         */
        public void setSimulationContextService(
-                       SimulationContextService simulationContextService) {
+                       final SimulationContextService simulationContextService) {
                _simulationContextService = simulationContextService;
        }
 
@@ -431,7 +437,7 @@ public class SaveDocumentAction extends Action {
         * @param documentTypeService
         *            the documentTypeService to set
         */
-       public void setDocumentTypeService(DocumentTypeService documentTypeService) {
+       public void setDocumentTypeService(final DocumentTypeService documentTypeService) {
                _documentTypeService = documentTypeService;
        }
 }
\ No newline at end of file