Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
e5bf38b5
Commit
e5bf38b5
authored
8 years ago
by
Vincent Aravantinos
Browse files
Options
Downloads
Patches
Plain Diff
adapts the service to the new metamodel
refs 2726
parent
e308c5d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ConstraintService.java
+13
-22
13 additions, 22 deletions
...rg/fortiss/tooling/kernel/internal/ConstraintService.java
with
13 additions
and
22 deletions
org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ConstraintService.java
+
13
−
22
View file @
e5bf38b5
...
...
@@ -4,8 +4,6 @@ import static java.util.Collections.emptyList;
import
static
org
.
eclipse
.
emf
.
ecore
.
xmi
.
XMLResource
.
OPTION_PROCESS_DANGLING_HREF
;
import
static
org
.
eclipse
.
emf
.
ecore
.
xmi
.
XMLResource
.
OPTION_PROCESS_DANGLING_HREF_DISCARD
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
copy
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
disableNotificationsOf
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
enableNotificationsOf
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
warning
;
import
java.io.ByteArrayOutputStream
;
...
...
@@ -20,6 +18,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.eclipse.emf.common.util.EMap
;
import
org.eclipse.emf.common.util.TreeIterator
;
import
org.eclipse.emf.common.util.URI
;
import
org.eclipse.emf.ecore.EObject
;
...
...
@@ -34,9 +33,7 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import
org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService
;
import
org.fortiss.tooling.kernel.introspection.items.ConstraintVerificationServiceIntrospectionDetailsItem
;
import
org.fortiss.tooling.kernel.model.INamedElement
;
import
org.fortiss.tooling.kernel.model.constraints.ConstrainedWithChecksum
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintInstance
;
import
org.fortiss.tooling.kernel.model.constraints.ConstraintsFactory
;
import
org.fortiss.tooling.kernel.model.constraints.IConstrained
;
import
org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus
;
import
org.fortiss.tooling.kernel.service.IConstraintService
;
...
...
@@ -49,7 +46,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
CF334BB211CE8640BB9A3B90F5D94532
* @ConQAT.Rating YELLOW Hash:
1FC7269BEBCFB91D0029CCD01E2F5741
*/
public
final
class
ConstraintService
implements
IIntrospectiveKernelService
,
IConstraintService
{
...
...
@@ -169,9 +166,11 @@ public final class ConstraintService implements IIntrospectiveKernelService, ICo
/** {@inheritDoc} */
@Override
public
boolean
isUpToDate
(
ConstraintInstance
ci
)
{
for
(
ConstrainedWithChecksum
cwc
:
ci
.
getConstrainedsWithChecksum
())
{
BigInteger
computeCheckSum
=
computeCheckSum
(
cwc
.
getConstrained
(),
ci
);
if
(
computeCheckSum
==
null
||
!
computeCheckSum
.
equals
(
cwc
.
getChecksum
()))
{
for
(
IConstrained
c
:
ci
.
getConstraineds
())
{
BigInteger
computeCheckSum
=
computeCheckSum
(
c
,
ci
);
EMap
<
String
,
BigInteger
>
checksumMap
=
c
.
getChecksumsPerConstraintName
();
BigInteger
storedChecksum
=
checksumMap
.
get
(
ci
.
getConstraintName
());
if
(
computeCheckSum
==
null
||
!
computeCheckSum
.
equals
(
storedChecksum
))
{
return
false
;
}
}
...
...
@@ -180,18 +179,9 @@ public final class ConstraintService implements IIntrospectiveKernelService, ICo
/** Updates all the checksums of <code>ci</code>. */
private
void
updateChecksums
(
ConstraintInstance
ci
)
{
List
<
ConstrainedWithChecksum
>
newCwcs
=
new
ArrayList
<
ConstrainedWithChecksum
>();
for
(
ConstrainedWithChecksum
cwc
:
ci
.
getConstrainedsWithChecksum
())
{
ConstrainedWithChecksum
newCwc
=
ConstraintsFactory
.
eINSTANCE
.
createConstrainedWithChecksum
();
newCwc
.
setConstrained
(
cwc
.
getConstrained
());
newCwc
.
setChecksum
(
computeCheckSum
(
cwc
.
getConstrained
(),
ci
));
newCwcs
.
add
(
newCwc
);
for
(
IConstrained
c
:
ci
.
getConstraineds
())
{
c
.
getChecksumsPerConstraintName
().
put
(
ci
.
getConstraintName
(),
computeCheckSum
(
c
,
ci
));
}
disableNotificationsOf
(
ci
);
ci
.
getConstrainedsWithChecksum
().
clear
();
ci
.
getConstrainedsWithChecksum
().
addAll
(
newCwcs
);
enableNotificationsOf
(
ci
);
}
/**
...
...
@@ -257,12 +247,13 @@ public final class ConstraintService implements IIntrospectiveKernelService, ICo
}
/**
*
@r
eturn
T
he object to be used to compute the checksum.
*
Generally, all statuses and checksums are removed. Each constraint can also provide
*
specific adaptations.
*
R
eturn
s t
he object to be used to compute the checksum.
* Generally, all statuses and checksums are removed. Each constraint can also provide
* specific adaptations.
*/
protected
EObject
getChecksumRelevantEObject
(
IConstrained
constrained
,
ConstraintInstance
ci
)
{
IConstrained
res
=
copy
(
constrained
);
res
.
getChecksumsPerConstraintName
().
clear
();
IConstraint
verifier
=
getConstraint
(
ci
);
if
(
verifier
!=
null
)
{
verifier
.
preprocessBeforeChecksum
(
res
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment