/** * Checks the validity of the archetype specialisation parent identifier, i.e. * that the archetype identifier stated in the specialise clause is the * identifier of the immediate specialisation parent archetype. * * @param archetype * @param errors */ public void checkSpecializationParentIdentifierValidity(Archetype archetype, List<ValidationError> errors) { if (archetype.getParentArchetypeId() == null) { return; // no specialise clause at all } ArchetypeID atId = archetype.getArchetypeId(); String base = atId.base(); String calculatedBaseForParent = base.substring(0, base.lastIndexOf("-")); if (!calculatedBaseForParent.equals(archetype.getParentArchetypeId().base())) { ValidationError error = new ValidationError( ErrorType.VASID, "NORMAL", archetype.getArchetypeId().toString(), archetype.getParentArchetypeId().toString()); errors.add(error); } if (archetype.getParentArchetypeId().versionID().endsWith("draft")) { ValidationError error = new ValidationError( ErrorType.VASID, "DEPRECATED", archetype.getParentArchetypeId().toString()); errors.add(error); } }