@Override public String getId(IdentifiedObject object) { return object.getId(); }
private static void addName(Map<String, String> idMapping, Set<String> names, cim1.model.IdentifiedObject object) { StringBuilder name = new StringBuilder(); if (object instanceof cim1.model.PowerTransformer) { // name field seems to always contains "1" while description seems to have a name constistent with // lines one. Just reshape it to look like lines Matcher matcher = POWER_TRANSFORMER_DESCRIPTION_PATTERN.matcher(object.getDescription()); if (matcher.matches()) { name.append(matcher.group(1)).append("_").append(matcher.group(2)).append("_").append(matcher.group(3)).append("_").append(matcher.group(4)); } } else { name.append(object.getName().trim()); // generators and loads have the same naming and collides, just add to suffixe to distinguish generators // and loads if (object instanceof SynchronousMachine) { name.append("_GEN"); } else if (object instanceof EnergyConsumer) { name.append("_LOAD"); } } if (name.toString().isEmpty()) { throw new CIM1Exception(object.getId() + " is unnamed"); } if (names.contains(name.toString())) { throw new CIM1Exception(object.getId() + " name is not unique: " + name); } names.add(name.toString()); idMapping.put(object.getId(), name.toString()); }
message.append(this.getId()); message.append("\" is not consistent in this context:\n");
errorMessage.append("IdentifiedObject "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); errorMessage.append("IdentifiedObject "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); errorMessage.append("IdentifiedObject "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e);