Update MultivalueScrutinizer class (#2885)
Removed inner class as for constraint status and exceptions we now have Constraint class.
This commit is contained in:
parent
d871a2e151
commit
731692df67
@ -17,22 +17,6 @@ public class MultiValueScrutinizer extends EditScrutinizer {
|
|||||||
public static final String new_type = "multi-valued-property-is-required-for-new-item";
|
public static final String new_type = "multi-valued-property-is-required-for-new-item";
|
||||||
public static final String existing_type = "multi-valued-property-is-required-for-existing-item";
|
public static final String existing_type = "multi-valued-property-is-required-for-existing-item";
|
||||||
public static String MULTI_VALUE_CONSTRAINT_QID = "Q21510857";
|
public static String MULTI_VALUE_CONSTRAINT_QID = "Q21510857";
|
||||||
public static String MULTI_VALUE_CONSTRAINT_STATUS = "P2316";
|
|
||||||
|
|
||||||
class MultivalueConstraint {
|
|
||||||
Value constraintStatus;
|
|
||||||
|
|
||||||
MultivalueConstraint(Statement statement) {
|
|
||||||
List<SnakGroup> snakGroupList = statement.getClaim().getQualifiers();
|
|
||||||
for(SnakGroup group : snakGroupList) {
|
|
||||||
for (Snak snak : group.getSnaks()) {
|
|
||||||
if (group.getProperty().getId().equals(MULTI_VALUE_CONSTRAINT_STATUS)){
|
|
||||||
constraintStatus = snak.getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrutinize(ItemUpdate update) {
|
public void scrutinize(ItemUpdate update) {
|
||||||
@ -44,8 +28,6 @@ public class MultiValueScrutinizer extends EditScrutinizer {
|
|||||||
if (propertyCount.containsKey(pid)) {
|
if (propertyCount.containsKey(pid)) {
|
||||||
propertyCount.put(pid, propertyCount.get(pid) + 1);
|
propertyCount.put(pid, propertyCount.get(pid) + 1);
|
||||||
} else if (!statementList.isEmpty()) {
|
} else if (!statementList.isEmpty()) {
|
||||||
Statement constraintStatement = statementList.get(0);
|
|
||||||
MultivalueConstraint constraint = new MultivalueConstraint(constraintStatement);
|
|
||||||
propertyCount.put(pid, 1);
|
propertyCount.put(pid, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user