/** * Factory of the class * * @param id * id of the class GeographicalRegion to create * @return the class created */ public static GeographicalRegion create(final String id) { GeographicalRegion newGeographicalRegion = new GeographicalRegion(); newGeographicalRegion.setId(id); return newGeographicalRegion; }
/** * 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( GeographicalRegion regionValue, boolean setInverse) throws LinkageException { this.region = regionValue; this.currentBitset.set(0); if (setInverse) { if (regionValue != null) { regionValue.addRegions(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 } }
xmlsw.writeAttribute(CIMModel.rdfURI, "ID", getId()); errorMessage.append("GeographicalRegion "); 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("GeographicalRegion "); 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, "GeographicalRegion"); xmlsw.writeAttribute(CIMModel.rdfURI, "ID", getId()); errorMessage.append("GeographicalRegion "); 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);
GeographicalRegion attributeToSetFromBoundary = boundaryModel.searchGeographicalRegion(idRegion); if(attributeToSetFromBoundary != null) { attributeToSetFromBoundary.setFromBoundary(true); try { model.createGeographicalRegion(idRegion, attributeToSetFromBoundary); throw new LinkageException(e.getMessage()); attributeToSetFromBoundary.resolveLinks(model, boundaryModel); } else { StringBuilder errorMessage = new StringBuilder(
GeographicalRegion newGeographicalRegion = new GeographicalRegion(); GeographicalRegion value = entry.getValue(); newGeographicalRegion = value; this.id_GeographicalRegion.put(newGeographicalRegion.getId(), newGeographicalRegion); this.allInstances.put(newGeographicalRegion.getId(), newGeographicalRegion); newMap.put(newGeographicalRegion.getId(), newGeographicalRegion); this.subsetsInstances.put( .put(newGeographicalRegion.getId(), newGeographicalRegion);
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 GeographicalRegion * the reference to the class to copy * @return the class constructed */ private GeographicalRegion(final GeographicalRegion otherGeographicalRegion) { // TODO : check exception safe this.copyBase(otherGeographicalRegion); }
/** * 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 GeographicalRegion clone() { GeographicalRegion newInstance = new GeographicalRegion(this); GeographicalRegion newInstanceSP = newInstance; return newInstanceSP; }
/** * Utility to resolve the links at the end of parsing * * @param model * the model this class belongs to * @param boundaryModel * the model that gather data about the boundarySet, used * as a resource force links resolving * @throws Linkage Exception */ @Override public void resolveLinks(CIMModel model, CIMModel boundaryModel) throws LinkageException { // TODO : implement vectors (not required according to CIM // specifications) super.resolveLinks(model, boundaryModel); removeFromUnresolved(); }
/** * 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 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); }