<useProjectRuleSet>true</useProjectRuleSet>
<ruleSetFile>siman-pmd.ruleset</ruleSetFile>
<includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
</pmd>
</arguments>
</buildCommand>
<buildCommand>
- <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
<arguments>
</arguments>
</buildCommand>
<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>
converter.src.dir=src
converter.dist.dir=dist
+siman-common.project.name=Siman-Common
<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>
level 5 : good practices
</description>
- <exclude-pattern>.*/org/.*</exclude-pattern>
<exclude-pattern>.*/test/.*</exclude-pattern>
<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
--- /dev/null
+<?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>
bin/*
*.class
*.war
+reports
+reports/*
<useProjectRuleSet>true</useProjectRuleSet>
<ruleSetFile>siman-pmd.ruleset</ruleSetFile>
<includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
</pmd>
</arguments>
</buildCommand>
<buildCommand>
- <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
<arguments>
</arguments>
</buildCommand>
<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>
level 5 : good practices
</description>
- <exclude-pattern>.*/org/.*</exclude-pattern>
<exclude-pattern>.*/test/.*</exclude-pattern>
<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
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];
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];
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;
}
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
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
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
* @copyright OPEN CASCADE 2012
*/
-import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
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;
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 {
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;
}
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);
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
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);
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;
}
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;
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));
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);
}
// ==============================================================================================================================
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);
}
}
// 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();
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;
}
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
*.class
*.war
test-output
-test-output/*
\ No newline at end of file
+test-output/*
+reports
+reports/*
<useProjectRuleSet>true</useProjectRuleSet>
<ruleSetFile>siman-pmd.ruleset</ruleSetFile>
<includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
</pmd>
</arguments>
</buildCommand>
<buildCommand>
- <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
<arguments>
</arguments>
</buildCommand>
<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>
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
<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>
level 5 : good practices
</description>
- <exclude-pattern>.*/org/.*</exclude-pattern>
<exclude-pattern>.*/test/.*</exclude-pattern>
<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
public abstract class Entity extends Any {
- private Set<Relation> relations = new HashSet<Relation>();
+ private final Set<Relation> relations = new HashSet<Relation>();
// ==============================================================================================================================
// Constructors
protected Entity () {
}
// Initialization constructor
- protected Entity (ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
+ protected Entity (final ObjectProperties prop) throws MissedPropertyException, InvalidPropertyException, MultiplyDefinedException {
super(prop);
}
// 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;
}
// 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);
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;
}
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;
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;
* @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;
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
// - Public services
- public void clear () {
+ @Override
+ public void clear () {
super.clear();
name = null;
step = null;
}
// - 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;
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
// -------------------------
}
// 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;
}
* @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;
}
* @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());
}
* Set the state.
* @param state the state to set
*/
- public void setState(ProgressState state) {
+ public void setState(final ProgressState state) {
this.state = state;
}
/**
+++ /dev/null
-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
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;
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;
* Set the folders.
* @param folders the folders to set
*/
- public void setFolders(Step[] folders) {
+ public void setFolders(final Step[] folders) {
this.folders = folders;
}
/**
return folders;
}
- protected final static Logger logger = Logger.getLogger(ProjectElement.class);
+ protected final static Logger LOGGER = Logger.getLogger(ProjectElement.class);
// ==============================================================================================================================
// Constructors
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
// -------------------------------
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
}
return lasdate;
}
- public void setLastModificationDate (Date aDate) {
+ public void setLastModificationDate (final Date aDate) {
lasdate = aDate;
}
* @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;
}
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;
}
// 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);
}
* 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
mystep = null;
}
// Internal constructors
- public Publication (Document doc, ProjectElement publisher) {
+ public Publication (final Document doc, final ProjectElement publisher) {
// --------------------------------------------------------------
mydoc = doc;
mystep = null;
// 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) );
+ }
}
/**
* 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();
+ }
}
/**
*/
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);
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;
* Set the isnew.
* @param isnew the isnew to set
*/
- public void setIsnew(char isnew) {
+ public void setIsnew(final char isnew) {
this.isnew = isnew;
}
* 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
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;
}
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;
// 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;
}
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;
}
* Set the state.
* @param state the state to set
*/
- public void setState(ProgressState state) {
+ public void setState(final ProgressState state) {
this.state = state;
}
/**
* Set the step.
* @param step the step to set
*/
- public void setStep(int step) {
+ public void setStep(final int step) {
this.step = step;
}
--- /dev/null
+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
+++ /dev/null
-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
* @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;
* {@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
}
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;
}
// 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();
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;
}
* 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
package org.splat.i18n;
import java.util.Locale;
+
import org.springframework.context.support.ResourceBundleMessageSource;
/**
/**
* Contains the list of resources bundle.
*/
- private static ResourceBundleMessageSource _resourceBundleMessageSource;
+ private static ResourceBundleMessageSource resourceBundleMessageSource;
/**
* .
* @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);
}
* @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;
}
}
/**
* 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;
}
/**
* @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;
}
/**
* @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;
}
/**
* @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
package org.splat.service.dto;
+
/**
*
* @author Daniel Brunier-Coulin
*/
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
bin/*
*.class
*.war
+reports
+reports/*
<useProjectRuleSet>true</useProjectRuleSet>
<ruleSetFile>siman-pmd.ruleset</ruleSetFile>
<includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
</pmd>
</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>
<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>
<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}" />
level 5 : good practices
</description>
- <exclude-pattern>.*/org/.*</exclude-pattern>
<exclude-pattern>.*/test/.*</exclude-pattern>
<rule ref="rulesets/logging-jakarta-commons.xml/UseCorrectExceptionLogging">
-# 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
-# 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
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;
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 {
.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);
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
* @param publicationService
* the publicationService to set
*/
- public void setPublicationService(PublicationService publicationService) {
+ public void setPublicationService(final PublicationService publicationService) {
_publicationService = publicationService;
}
* @param scenarioService
* the scenarioService to set
*/
- public void setScenarioService(ScenarioService scenarioService) {
+ public void setScenarioService(final ScenarioService scenarioService) {
_scenarioService = scenarioService;
}
* @param stepService
* the stepService to set
*/
- public void setStepService(StepService stepService) {
+ public void setStepService(final StepService stepService) {
_stepService = stepService;
}
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);
"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());
}
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;
}
// 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);
+ }
}
}
* @param repositoryService
* the repositoryService to set
*/
- public void setRepositoryService(RepositoryService repositoryService) {
+ public void setRepositoryService(final RepositoryService repositoryService) {
_repositoryService = repositoryService;
}
* the simulationContextService to set
*/
public void setSimulationContextService(
- SimulationContextService simulationContextService) {
+ final SimulationContextService simulationContextService) {
_simulationContextService = simulationContextService;
}
* @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