/** * Factory of the class * * @param id * id of the class SubGeographicalRegion to create * @return the class created */ public static SubGeographicalRegion create(final String id) { SubGeographicalRegion newSubGeographicalRegion = new SubGeographicalRegion(); newSubGeographicalRegion.setId(id); return newSubGeographicalRegion; }
/** * Utility to set the "regionValue" * * @param regionValue * instance to set * @param setInverse * boolean to specify whether to set the inverse association * or not * @throws LinkageException */ public void setRegion( SubGeographicalRegion regionValue, boolean setInverse) throws LinkageException { this.region = regionValue; this.currentBitset.set(0); if (setInverse) { if (regionValue != null) { regionValue.addSubstations(this, false); } } } /**
/** * Utility to "clear" the content of a class when a subset is invalidated * * @param subset subset to clean */ @Override public void clearContent(Subset subset) { // First of all, we clear the associations: this.clearAssociations(subset); switch (subset) { default: // nothing to clear } }
this.setRegion(attributeToSet, setInverse); } catch(LinkageException e) { LOGGER.error(e.toString(), e); this.setRegion(attributeToSetFromBoundary, setInverse); } catch(LinkageException e) { LOGGER.error(e.toString(), e); errorMessage.append(idRegion); errorMessage.append("\" in \"SubGeographicalRegion\" of id \""); errorMessage.append(this.getId()); errorMessage.append("\" !"); throw new LinkageException(errorMessage.toString()); errorMessage.append(idRegion); errorMessage.append("\" in \"SubGeographicalRegion\" of id \""); errorMessage.append(this.getId()); errorMessage.append("\" !"); throw new LinkageException(errorMessage.toString()); removeFromUnresolved();
/** * Utility to copy the "base" of an other instance of the same class * This utility does not copy the associations with other instances from * the instance to copy * * @param otherSubGeographicalRegion * the instance to copy */ public void copyBase(final SubGeographicalRegion otherSubGeographicalRegion) { // Memory allocation has done successfully ! // Dropping "old" objects... // This part may change : we do nothing to allow the user to access // object by their id from the global model. if (otherSubGeographicalRegion.currentBitset.get(0)) { GeographicalRegion regionAssociation = otherSubGeographicalRegion.getRegion(); //this.idRegion = (regionAssociation != null) ? regionAssociation.getId() : ""; if (regionAssociation != null) { this.idRegion = regionAssociation.getId(); // the proper bit will be set when the setter is called } else { this.idRegion = ""; } } // TODO : Call the parent copy constructor instead ? super.copyBase(otherSubGeographicalRegion); }
xmlsw.writeAttribute(CIMModel.rdfURI, "ID", getId()); errorMessage.append("SubGeographicalRegion "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); writeClass(xmlsw); super.write(xmlsw, false); errorMessage.append("SubGeographicalRegion "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); try { xmlsw.writeStartElement(CIMURI.CIMURI, "SubGeographicalRegion"); xmlsw.writeAttribute(CIMModel.rdfURI, "ID", getId()); errorMessage.append("SubGeographicalRegion "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); errorMessage.append(" in the subset "); errorMessage.append("Equipment"); writeClass(xmlsw); super.write(xmlsw, subset, false);
SubGeographicalRegion newSubGeographicalRegion = new SubGeographicalRegion(); SubGeographicalRegion value = entry.getValue(); newSubGeographicalRegion = value; this.id_SubGeographicalRegion.put(newSubGeographicalRegion.getId(), newSubGeographicalRegion); this.allInstances.put(newSubGeographicalRegion.getId(), newSubGeographicalRegion); newMap.put(newSubGeographicalRegion.getId(), newSubGeographicalRegion); this.subsetsInstances.put( .put(newSubGeographicalRegion.getId(), newSubGeographicalRegion);
message.append(this.getId()); message.append("\" is not consistent in this context:\n");
message.append(getMessageForConsistency(this.minBitsets.get(subset)));
/** * Copy constructor * The associations with other objects are not copied * * @param SubGeographicalRegion * the reference to the class to copy * @return the class constructed */ private SubGeographicalRegion(final SubGeographicalRegion otherSubGeographicalRegion) { // TODO : check exception safe this.copyBase(otherSubGeographicalRegion); }
/** * Utility returning a copy of the "base" of this instance * This utility does not copy the associations with other instances * * @return a clone of this instance */ public SubGeographicalRegion clone() { SubGeographicalRegion newInstance = new SubGeographicalRegion(this); SubGeographicalRegion newInstanceSP = newInstance; return newInstanceSP; }
/** * Utility to return the content of this class into the CIM XML format * * @param xmlsw * the stream in which are stored the elements to write */ private void writeClass(XMLStreamWriter xmlsw) { if (currentBitset.get(0)) { for (SubGeographicalRegion regions : this.regions){ try { xmlsw.writeEmptyElement(CIMURI.CIMURI,"GeographicalRegion.Regions"); xmlsw.writeAttribute(CIMModel.rdfURI, "resource", "#" + regions.getId()); } catch (XMLStreamException e) { StringBuilder errorMessage = new StringBuilder( "Error while trying to write the reference to "); errorMessage.append("GeographicalRegion "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); errorMessage.append(" in the subset "); errorMessage.append("Equipment"); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); } } } return; }
message.append(getMessageForConsistency(this.minBitset));
/** * Utility to copy the "base" of an other instance of the same class * This utility does not copy the associations with other instances from * the instance to copy * * @param otherSubstation * the instance to copy */ public void copyBase(final Substation otherSubstation) { // Memory allocation has done successfully ! // Dropping "old" objects... // This part may change : we do nothing to allow the user to access // object by their id from the global model. if (otherSubstation.currentBitset.get(0)) { SubGeographicalRegion regionAssociation = otherSubstation.getRegion(); //this.idRegion = (regionAssociation != null) ? regionAssociation.getId() : ""; if (regionAssociation != null) { this.idRegion = regionAssociation.getId(); // the proper bit will be set when the setter is called } else { this.idRegion = ""; } } // TODO : Call the parent copy constructor instead ? super.copyBase(otherSubstation); }
errorMessage.append("SubGeographicalRegion "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); errorMessage.append("SubGeographicalRegion "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); errorMessage.append(" in the subset "); errorMessage.append("Equipment");