Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
d951f5e8
Commit
d951f5e8
authored
Jan 15, 2020
by
Alexander Diewald
Browse files
Merge remote-tracking branch 'origin/master' into 3437
parents
37ff49f2
9f66f781
Changes
116
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/examples/.ratings
View file @
d951f5e8
SimpleTrafficLightsComponentArchitectureExample.java
4f4f3fc51a32b236d935bd41fefa5e6686f6e8f0
GREEN
SimpleTrafficLightsComponentArchitectureExample.java
f1e3238b593a4e8d1c5420e4d8d1f71f53f035f8
GREEN
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/examples/SimpleTrafficLightsComponentArchitectureExample.java
View file @
d951f5e8
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
#
| Copyright 2011 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
...
...
@@ -25,7 +25,6 @@ import static org.fortiss.af3.expression.utils.ExpressionModelElementFactory.cre
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
ExpressionModelElementFactory
.
createMicroTypesystem
;
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
ExpressionModelElementFactory
.
intType
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
FileUtils
.
loadTextFileFromPlugin
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createDummyDevelopmentProcess
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createFileProject
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createProjectConfiguration
;
import
static
org
.
fortiss
.
tooling
.
base
.
ui
.
utils
.
LayoutDataUIUtils
.
addBendPointToConnection
;
...
...
@@ -81,8 +80,7 @@ public class SimpleTrafficLightsComponentArchitectureExample
public
FileProject
createProject
(
String
projectName
)
{
// The generic project.
FileProject
project
=
createFileProject
(
projectName
,
createProjectConfiguration
(
createMicroTypesystem
(),
createDummyDevelopmentProcess
()));
createFileProject
(
projectName
,
createProjectConfiguration
(
createMicroTypesystem
()));
// Data dictionary.
createDataDictionary
(
project
);
...
...
org.fortiss.af3.component/src/org/fortiss/af3/component/constraint/.ratings
View file @
d951f5e8
...
...
@@ -3,7 +3,6 @@ ActionConstraintCheckerBase.java 2859bec84f78a49d69b51aab058fad3e7caeb73f GREEN
ChannelConstraintChecker.java 9ac0753195e7a83bdd787e8d2742077cc18165f9 GREEN
CodeSpecificationConstraintChecker.java a5ed398bfaa827a71c68617d6c7240be166f7151 GREEN
ComponentConstraintChecker.java 67d6147bd4e0ee6891c2c628c032c46707eb86ec GREEN
ComponentConstraintGroup.java a01c05c57a7280ed6ef9dff5f5eda15ad641a4e6 GREEN
ConstraintMessage.java 0a74c02378e51bc9386b7a45a35753d8ffff99f3 GREEN
DataStateVariableConstraintChecker.java 1704b6c295dfcc3a79ddc804175232195a28b736 GREEN
DataStateVariableConstraintCheckerBase.java c1e6c6990bd445c9b252b5776a4d1de68320f1c2 GREEN
...
...
org.fortiss.af3.component/src/org/fortiss/af3/component/constraint/ComponentConstraintGroup.java
deleted
100644 → 0
View file @
37ff49f2
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.component.constraint
;
import
org.fortiss.af3.project.utils.ConstraintsProjectUtils.AF3ProjectConstraintCheckerBase
;
/**
*
* @author abid
*/
public
abstract
class
ComponentConstraintGroup
extends
AF3ProjectConstraintCheckerBase
{
/**
* @return this function will return the group Name
*/
@Override
public
String
getGroup
()
{
return
"Component Constraints Group"
;
}
}
org.fortiss.af3.component/src/org/fortiss/af3/component/utils/.ratings
View file @
d951f5e8
BehaviorModelElementFactory.java 5be68f9a2ae4fad663d6fb20f6c5c7b12c0647ab GREEN
ComponentArchitectureTransformationBase.java ad6f06093cb813a05d13e87bbd0d620b43d2a5ab GREEN
ComponentArchitectureUtils.java
bb7964823a64af71d55a1bdf430c79792ad3edb0
GREEN
ComponentArchitectureUtils.java
11ecb39b4ad807a9b6c37a3e485bde56dab377dc
GREEN
ComponentLibraryModelElementFactory.java b6c854e91d431fa3bc42fafdcf618a2040d23ab4 GREEN
ComponentLibraryUtils.java
bab1cd340e2e724eedaabb4d2b455cba111b511b
GREEN
ComponentLibraryUtils.java
dd5fb918e37c98c885b59ea1a7915b8cdf149997
GREEN
ComponentModelElementFactory.java 7d73764f4ebc3a45bcd2833c68a06213109784a0 GREEN
ComponentProgramUtils.java 71faad6256159ee2d59843fcde83ac6995dff0fe GREEN
ComponentUtils.java d4aa3db08fafafaa937b976c85762f1009fa8dc7 GREEN
...
...
org.fortiss.af3.component/src/org/fortiss/af3/component/utils/ComponentArchitectureUtils.java
View file @
d951f5e8
...
...
@@ -21,7 +21,6 @@ import static org.fortiss.af3.component.utils.ComponentModelElementFactory.creat
import
static
org
.
fortiss
.
af3
.
component
.
utils
.
ComponentModelElementFactory
.
createInputPortAndAttach
;
import
static
org
.
fortiss
.
af3
.
component
.
utils
.
ComponentModelElementFactory
.
createOutputPortAndAttach
;
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
ExpressionModelElementFactory
.
createMicroTypesystem
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createDummyDevelopmentProcess
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createFileProject
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createProjectConfiguration
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectUtils
.
getFileProject
;
...
...
@@ -394,8 +393,7 @@ public class ComponentArchitectureUtils {
public
static
ComponentArchitecture
createTemporaryComponentArchitecture
(
Component
copiedComponent
,
DataDictionary
dd
)
{
FileProject
pro
=
createFileProject
(
"Temp"
,
createProjectConfiguration
(
createMicroTypesystem
(),
createDummyDevelopmentProcess
()));
createFileProject
(
"Temp"
,
createProjectConfiguration
(
createMicroTypesystem
()));
Component
topComponent
=
createComponentArchitecture
(
pro
,
"TempCompArch"
,
copiedComponent
.
getName
());
if
(
dd
!=
null
)
{
...
...
org.fortiss.af3.component/src/org/fortiss/af3/component/utils/ComponentLibraryUtils.java
View file @
d951f5e8
...
...
@@ -17,7 +17,6 @@ package org.fortiss.af3.component.utils;
import
static
org
.
fortiss
.
af3
.
component
.
utils
.
ComponentModelElementFactory
.
createComponentArchitecture
;
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
ExpressionModelElementFactory
.
createMicroTypesystem
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createDummyDevelopmentProcess
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createFileProject
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createProjectConfiguration
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectUtils
.
getFileProject
;
...
...
@@ -73,8 +72,8 @@ public class ComponentLibraryUtils {
*/
public
static
Component
copyComponentIntoNewProject
(
Component
comp
)
{
ProjectConfiguration
projectConfiguration
=
createProjectConfiguration
(
create
MicroTypesystem
(),
createDummyDevelopmentProcess
());
ProjectConfiguration
projectConfiguration
=
create
ProjectConfiguration
(
createMicroTypesystem
());
FileProject
newFp
=
createFileProject
(
"Temporary"
,
projectConfiguration
);
FileProject
fp
=
getFileProject
(
comp
);
...
...
org.fortiss.af3.expression/src/org/fortiss/af3/expression/examples/.ratings
View file @
d951f5e8
ConfiguredExpressionExample.java
20069df0c6c30651a5bd5155853bb86f89bc586
1 GREEN
ConfiguredExpressionExample.java
b7e75544cddc635efa410f4bf2f696236ec2307
1 GREEN
SimpleTrafficLightsDataDictionaryExample.java a4738989d838cd62953ca2d7d1b9927b7cb43dfb GREEN
org.fortiss.af3.expression/src/org/fortiss/af3/expression/examples/ConfiguredExpressionExample.java
View file @
d951f5e8
...
...
@@ -16,7 +16,6 @@
package
org.fortiss.af3.expression.examples
;
import
static
org
.
fortiss
.
af3
.
expression
.
utils
.
ExpressionModelElementFactory
.
createMicroTypesystem
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createConstraintBasedDevelopmentProcess
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
ProjectModelElementFactory
.
createFileProject
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
UniqueIDUtils
.
generateAllIDs
;
...
...
@@ -25,9 +24,7 @@ import org.fortiss.af3.project.model.AF3ProjectFactory;
import
org.fortiss.af3.project.model.FileProject
;
import
org.fortiss.af3.project.model.ProjectConfiguration
;
import
org.fortiss.af3.project.model.configuration.ConfigurationFactory
;
import
org.fortiss.af3.project.model.configuration.DevelopmentProcessConfiguration
;
import
org.fortiss.af3.project.model.configuration.TypeSystemConfiguration
;
import
org.fortiss.af3.project.model.development.ConstraintBasedDevelopmentProcess
;
/**
* Creates an empty {@link FileProject} with the proper default configuration.
...
...
@@ -54,12 +51,6 @@ public class ConfiguredExpressionExample extends SimpleTrafficLightsProjectExamp
ConfigurationFactory
.
eINSTANCE
.
createTypeSystemConfiguration
();
config
.
getConfigurationElements
().
add
(
tsConfig
);
tsConfig
.
setTypesystem
(
createMicroTypesystem
());
DevelopmentProcessConfiguration
dpConfig
=
ConfigurationFactory
.
eINSTANCE
.
createDevelopmentProcessConfiguration
();
config
.
getConfigurationElements
().
add
(
dpConfig
);
ConstraintBasedDevelopmentProcess
devProc
=
createConstraintBasedDevelopmentProcess
(
dpConfig
);
dpConfig
.
setDevelopment
(
devProc
);
FileProject
project
=
createFileProject
(
projectName
,
config
);
// Set the IDs of the project uniquely.
...
...
org.fortiss.af3.mira.ui/META-INF/MANIFEST.MF
View file @
d951f5e8
...
...
@@ -17,7 +17,6 @@ Bundle-ActivationPolicy: lazy
Bundle-Activator: org.fortiss.af3.mira.ui.AF3MiraUIActivator
Export-Package: org.fortiss.af3.mira.ui,
org.fortiss.af3.mira.ui.action,
org.fortiss.af3.mira.ui.constraints,
org.fortiss.af3.mira.ui.dialog,
org.fortiss.af3.mira.ui.editor,
org.fortiss.af3.mira.ui.editor.overview,
...
...
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/.ratings
View file @
d951f5e8
AF3MiraUIActivator.java
69a2ade6276d0b88fcf0bc8d117e426129ba37a6
GREEN
AF3MiraUIActivator.java
751323d4a666c98a9aae2a29aaef81c808bd113b
GREEN
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/AF3MiraUIActivator.java
View file @
d951f5e8
...
...
@@ -18,23 +18,6 @@
package
org.fortiss.af3.mira.ui
;
import
org.eclipse.ui.plugin.AbstractUIPlugin
;
import
org.fortiss.af3.mira.constraints.AuthorConstraint
;
import
org.fortiss.af3.mira.constraints.DescriptionAndOrConstraint
;
import
org.fortiss.af3.mira.constraints.DescriptionConstraint
;
import
org.fortiss.af3.mira.constraints.GlossaryTermsDefinitionConstraint
;
import
org.fortiss.af3.mira.constraints.IDConstraint
;
import
org.fortiss.af3.mira.constraints.NameConstraint
;
import
org.fortiss.af3.mira.constraints.RationaleConstraint
;
import
org.fortiss.af3.mira.constraints.SourceConstraint
;
import
org.fortiss.af3.mira.ui.constraints.AuthorConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.DescriptionAndOrConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.DescriptionConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.GlossaryTermDefinitionConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.IDConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.NameConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.RationaleConstraintUI
;
import
org.fortiss.af3.mira.ui.constraints.SourceConstraintUI
;
import
org.fortiss.tooling.kernel.ui.service.IConstraintUIService
;
import
org.osgi.framework.BundleContext
;
/** The activator class controls the plug-in life cycle. */
...
...
@@ -60,22 +43,6 @@ public class AF3MiraUIActivator extends AbstractUIPlugin {
public
void
start
(
BundleContext
context
)
throws
Exception
{
super
.
start
(
context
);
plugin
=
this
;
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
AuthorConstraintUI
.
class
,
AuthorConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
NameConstraintUI
.
class
,
NameConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
IDConstraintUI
.
class
,
IDConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
RationaleConstraintUI
.
class
,
RationaleConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
SourceConstraintUI
.
class
,
SourceConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
DescriptionConstraintUI
.
class
,
DescriptionConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
DescriptionAndOrConstraintUI
.
class
,
DescriptionAndOrConstraint
.
class
);
IConstraintUIService
.
getInstance
().
registerConstraintUI
(
GlossaryTermDefinitionConstraintUI
.
class
,
GlossaryTermsDefinitionConstraint
.
class
);
}
/** {@inheritDoc} */
...
...
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/constraints/.ratings
deleted
100644 → 0
View file @
37ff49f2
AuthorConstraintUI.java 1155ec5df23467e1b6c7f8e5cc1ff3a1b54c13c0 GREEN
ComponentExistsConstraintUI.java cb7e10be34ec048bdfd4eda904eec121ae1639dd GREEN
ComponentNameMeaningfulConstraintUI.java 87de156dea1a98fcc6bce32cb52446d02bdd5c44 GREEN
ComponentPackageExistsConstraintUI.java 82cb2f30e967d7b4aaa83f1d93befb9f306f3c53 GREEN
ComponentToRequirementTraceExistsConstraintUI.java ae27ffcdc5e0d78f46d7d1fc4a397b4f74ea11c9 YELLOW
DescriptionAndOrConstraintUI.java 6df40a3b58697a428546d9829d923836c48d93de GREEN
DescriptionConstraintUI.java b2bae07a7575e68a9f4924f9c956d1b5b91641ce GREEN
EveryDefinedSignalIsUsedUI.java c1aa75c4d7bd76a3073674d9cfaec63b013efcaf GREEN
EverySignalUsedIsDefinedUI.java d534191b37808c15b7b313b9329adc00a583cf0f GREEN
FunctionalAspectsHaveNonFunctionalAspectsConstraintsUI.java b67567dcddd9a339ae90eff8bf296cbdee779570 GREEN
GlossaryTermDefinitionConstraintUI.java d1c89f16b5e53170d9768480611d58b0e238bf4c GREEN
IDConstraintUI.java 9554fb8c08df717cc0690eef869d3198c8b5634a GREEN
IdentifiedInputOutputDefinedConstraintUI.java cf28bf5da417303cfb1c4ce2381cff84a8068800 GREEN
NameConstraintUI.java 675f9e5d578c275fdf660a9fd3cf178569d6feb4 GREEN
NonFunctionalAspectsHaveFunctionalAspectsConstraintUI.java 337f36f60fcfa8cbe55b6ebfef80d407c35c9a68 GREEN
NonFunctionalReqsHaveExactlyOneFunctionalReqUI.java cf600a1f4498896a3536ff901e90794c5889b254 GREEN
ParameterTypeConstraintUI.java d51da45415dffa135cb1ec093e0bd2865b9119d1 GREEN
RationaleConstraintUI.java 3e22eea390b00a4a9f9836199096c39421f47577 GREEN
RequirementExistsConstraintUI.java c400a0e7ede2c9b1b23e1d9a23853e73d21cfa64 GREEN
RequirementImplementedCorrectlyConstraintUI.java 01495ed0aeb12085fd56ae7e8bdd131b81d697b7 YELLOW
SourceConstraintUI.java 1bd3cb69e4684f6fdffd8a4848d8e24791d76e98 GREEN
TraceNotEmptyConstraintUI.java 936e63fd95e405ae8e6a9840f22a00414d79ca30 GREEN
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/constraints/AuthorConstraintUI.java
deleted
100644 → 0
View file @
37ff49f2
/*-------------------------------------------------------------------------+
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.constraints
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
ConstraintsUtils
.
getFirstConstrained
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintInstance
;
import
org.fortiss.tooling.kernel.model.constraints.FailedConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck
;
import
org.fortiss.tooling.kernel.ui.service.IConstraintUIService.IFix
;
import
org.fortiss.tooling.kernel.ui.util.ConstraintsUIUtils.FixBase
;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.AuthorConstraint}
*
* @author abid
*/
public
class
AuthorConstraintUI
extends
ConstraintUIBaseAutocheck
{
/** {@inheritDoc} */
@Override
public
String
getDescription
()
{
return
"All requirements have an author"
;
}
/** {@inheritDoc} */
@Override
public
boolean
shouldBeManuallyActivated
()
{
return
true
;
}
/** {@inheritDoc} */
@Override
public
List
<
IFix
>
fixes
(
ConstraintInstance
ci
,
IConstraintInstanceStatus
status
)
{
if
(
status
instanceof
FailedConstraintInstanceStatus
)
{
String
reqName
=
((
Requirement
)
getFirstConstrained
(
ci
)).
getName
();
if
(
reqName
!=
null
)
{
if
(
reqName
.
isEmpty
()
==
false
)
{
String
splitFix
=
"Author field empty for requirement: "
+
reqName
;
return
Arrays
.
asList
(
new
FixBase
(
splitFix
,
s
->
reqName
.
toString
()));
}
}
}
return
super
.
fixes
(
ci
,
status
);
}
}
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/constraints/DescriptionAndOrConstraintUI.java
deleted
100644 → 0
View file @
37ff49f2
/*-------------------------------------------------------------------------+
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.constraints
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
ConstraintsUtils
.
getFirstConstrained
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintInstance
;
import
org.fortiss.tooling.kernel.model.constraints.FailedConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck
;
import
org.fortiss.tooling.kernel.ui.service.IConstraintUIService.IFix
;
import
org.fortiss.tooling.kernel.ui.util.ConstraintsUIUtils.FixBase
;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.AuthorConstraint}
*
* @author saadbinabid
*/
public
class
DescriptionAndOrConstraintUI
extends
ConstraintUIBaseAutocheck
{
/** {@inheritDoc} */
@Override
public
String
getDescription
()
{
return
"All requirements should not have words \"and/or\" in their description"
;
}
/** {@inheritDoc} */
@Override
public
boolean
shouldBeManuallyActivated
()
{
return
true
;
}
/** {@inheritDoc} */
@Override
public
List
<
IFix
>
fixes
(
ConstraintInstance
ci
,
IConstraintInstanceStatus
status
)
{
if
(
status
instanceof
FailedConstraintInstanceStatus
)
{
String
reqName
=
((
Requirement
)
getFirstConstrained
(
ci
)).
getName
();
if
(
reqName
!=
null
)
{
if
(
reqName
.
isEmpty
()
==
false
)
{
String
splitFix
=
"Description field cointains \"and/or\" for requirement: "
+
reqName
;
return
Arrays
.
asList
(
new
FixBase
(
splitFix
,
s
->
reqName
.
toString
()));
}
}
}
return
super
.
fixes
(
ci
,
status
);
}
}
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/constraints/DescriptionConstraintUI.java
deleted
100644 → 0
View file @
37ff49f2
/*-------------------------------------------------------------------------+
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.constraints
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
ConstraintsUtils
.
getFirstConstrained
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintInstance
;
import
org.fortiss.tooling.kernel.model.constraints.FailedConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck
;
import
org.fortiss.tooling.kernel.ui.service.IConstraintUIService.IFix
;
import
org.fortiss.tooling.kernel.ui.util.ConstraintsUIUtils.FixBase
;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.AuthorConstraint}
*
* @author saadbinabid
*/
public
class
DescriptionConstraintUI
extends
ConstraintUIBaseAutocheck
{
/** {@inheritDoc} */
@Override
public
String
getDescription
()
{
return
"All requirements have a description"
;
}
/** {@inheritDoc} */
@Override
public
boolean
shouldBeManuallyActivated
()
{
return
true
;
}
/** {@inheritDoc} */
@Override
public
List
<
IFix
>
fixes
(
ConstraintInstance
ci
,
IConstraintInstanceStatus
status
)
{
if
(
status
instanceof
FailedConstraintInstanceStatus
)
{
String
reqName
=
((
Requirement
)
getFirstConstrained
(
ci
)).
getName
();
if
(
reqName
!=
null
)
{
if
(
reqName
.
isEmpty
()
==
false
)
{
String
splitFix
=
"Description field empty for requirement: "
+
reqName
;
return
Arrays
.
asList
(
new
FixBase
(
splitFix
,
s
->
reqName
.
toString
()));
}
}
}
return
super
.
fixes
(
ci
,
status
);
}
}
org.fortiss.af3.mira.ui/src/org/fortiss/af3/mira/ui/constraints/GlossaryTermDefinitionConstraintUI.java
deleted
100644 → 0
View file @
37ff49f2
/*-------------------------------------------------------------------------+
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.constraints
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
ConstraintsUtils
.
getFirstConstrained
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.af3.mira.model.glossary.GlossaryEntry
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintInstance
;
import
org.fortiss.tooling.kernel.model.constraints.FailedConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.ui.extension.base.ConstraintUIBases.ConstraintUIBaseAutocheck
;
import
org.fortiss.tooling.kernel.ui.service.IConstraintUIService.IFix
;
import
org.fortiss.tooling.kernel.ui.util.ConstraintsUIUtils.FixBase
;
/**
* UI part of {@link org.fortiss.af3.mira.constraints.AuthorConstraint}
*
* @author abid
*/
public
class
GlossaryTermDefinitionConstraintUI
extends
ConstraintUIBaseAutocheck
{
/** {@inheritDoc} */
@Override
public
String
getDescription
()
{
return
"All requirements having glossary terms that are fully defined"
;
}
/** {@inheritDoc} */
@Override
public
boolean
shouldBeManuallyActivated
()
{
return
true
;
}
/** {@inheritDoc} */
@Override
public
List
<
IFix
>
fixes
(
ConstraintInstance
ci
,
IConstraintInstanceStatus
status
)
{
if
(
status
instanceof
FailedConstraintInstanceStatus
)
{
Requirement
req
=
((
Requirement
)
getFirstConstrained
(
ci
));
List
<
GlossaryEntry
>
failedGlossaryEntries
=
createFailedGlossaryList
(
req
);
// search for only the relevant glossary entries in the description of the requirement
// and show it to the user
String
GlossaryArray
=
""
;
List
<
GlossaryEntry
>
relevantEntries
=
new
ArrayList
<
GlossaryEntry
>();
for
(
int
glossary_itr
=
0
;
glossary_itr
<
failedGlossaryEntries
.
size
();
glossary_itr
++)
{
/**
* check each failed glossary one by one in the requirement description in order to
* find out
* if the failed glossary entry belong to the requirement and add it to the relevant
* glossary
* that will be shown to the user to work-out with..
*/
if
(
isContainedExactWord
(
req
.
getDescription
().
toString
(),
failedGlossaryEntries
.
get
(
glossary_itr
).
getName
().
toString
()))
{
relevantEntries
.
add
(
failedGlossaryEntries
.
get
(
glossary_itr
));
}
}
for
(
int
glossary_itr
=
0
;
glossary_itr
<
relevantEntries
.
size
();
glossary_itr
++)
{
GlossaryArray
+=
relevantEntries
.
get
(
glossary_itr
).
getName
()
+
","
;
}
// create a list of name and add it to
/** Creates a {@link Requirement}. */
String
splitFix
=
"Glossary entries not defined are: "
+
GlossaryArray
;
return
Arrays
.
asList
(
new
FixBase
(
splitFix
,
s
->
relevantEntries
.
toString
()));
}
return
super
.
fixes
(
ci
,
status
);
}
/**
* @param req1
* @return List of failed glossary entries that do not have definition
*/
public
List
<
GlossaryEntry
>
createFailedGlossaryList
(
Requirement
req1
)
{
List
<
GlossaryEntry
>
failedGlossaryEntry
=
new
ArrayList
<
GlossaryEntry
>();
for
(
int
itr
=
0
;
itr
<
req1
.
getAnalysis
().
getGlossariesList
().
size
();
itr
++)
{
for
(
int
glossaryItr
=
0
;
glossaryItr
<
req1
.
getAnalysis
().
getGlossariesList
().
get
(
itr
)
.
getGlossaryEntryList
().
size
();
glossaryItr
++)
{
GlossaryEntry
glossaryentry
=
req1
.
getAnalysis
().
getGlossariesList
().
get
(
itr
)
.
getGlossaryEntryList
().
get
(
glossaryItr
);
if
(
glossaryentry
.
getDefinition
().
isEmpty
()
||
glossaryentry
.
getDefinition
().
trim
().
isEmpty
()
||
glossaryentry
.
getDefinition
()
==
null
)
{
failedGlossaryEntry
.
add
(
glossaryentry
);
}
}
}
return
failedGlossaryEntry
;
}
/**
* @param text
* @param keyWord
* @return true if the text is found false otherwise
*/
private
boolean
isContainedExactWord
(
String
text
,
String
keyWord
)
{
String
pattern
=
"\\b"
+
keyWord
+
"\\b"
;
Pattern
p
=
Pattern
.
compile
(
pattern
);