public class DefaultGuidProvider extends java.lang.Object implements IGuidProvider
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_GUID_PROVIDER_LABEL
Label of the default GUID provider as shown in the preference page.
|
static java.util.regex.Pattern |
GUID_PATTERN
Pattern to identify valid GUIDs.
|
COMPARATOR, EXTENSION_POINT_ID
Constructor and Description |
---|
DefaultGuidProvider() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
createNewGuid(EObject element)
Implementations must create a new GUID.
|
java.lang.String |
getLabel() |
int |
getPriority() |
boolean |
isValidGuid(java.lang.String guid)
In some cases, a GUID must be checked for validity, because the EA may use some special GUIDs.
|
public static final java.lang.String DEFAULT_GUID_PROVIDER_LABEL
public static final java.util.regex.Pattern GUID_PATTERN
public java.lang.String getLabel()
getLabel
in interface IGuidProvider
null
, otherwise it will not be used!public int getPriority()
getPriority
in interface IGuidProvider
public java.lang.String createNewGuid(EObject element)
IGuidProvider
element
is set, then the GUID is used for that particular
element. If element == null
, then the GUID is used for a database entry that does not represent a
model element in the first place, e.g. tagged values or additional properties stored in table t_xref
.
Please note that the behavior of the EA may be undefined if the GUID does not comply to the EA standard format
which is apparently the Microsoft GUID format:
Wikipedia - GUID.
So make sure to test your implementation properly before going in production with your own GUID provider.
createNewGuid
in interface IGuidProvider
element
- The element for which the GUID should be generated or null
, if the GUID should not be
generated for a particular model element.public boolean isValidGuid(java.lang.String guid)
IGuidProvider
In case the GUID points to a built-in primitive type, its name is stored as GUID, e.g.
boolean
, UnlimitedNatural
or unsigned int
, depending on the language that
is selected on the parent element. Example: {EAINT000-B653-4f3c-A010-30205D67F5F5}
.
There may also be other cases in the future, for which the GUID column is exploited, not only primitive type
names.
guid
, whether it is a valid GUID in their context. Maybe
the GUID was even created from within the EA, so it is probably a good idea to return
DefaultGuidProvider.isValidGuid(guid)
instead of just returning false
. Otherwise types
may not be resolved correctly.
To check that your implementation is compatible with the rest of the YAKINDU EA-Brige, you should also run the
test suite with your implementation of IGuidProvider
!
isValidGuid
in interface IGuidProvider
guid
- A GUID that should be checked for validity.true
, if the GUID is a valid example in the context of this GUID provider;
false
otherwise.Copyright (c) 2015 itemis AG, and others. All rights reserved.