/** * 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 otherCurrentLimit * the instance to copy */ public void copyBase(final CurrentLimit otherCurrentLimit) { float newvalue; // assigning primitive type : if (otherCurrentLimit.currentBitset.get(0)) { newvalue = otherCurrentLimit.getValue(); this.setValue(newvalue); } // 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. // TODO : Call the parent copy constructor instead ? super.copyBase(otherCurrentLimit); }
/** * Factory of the class * * @param id * id of the class CurrentLimit to create * @return the class created */ public static CurrentLimit create(final String id) { CurrentLimit newCurrentLimit = new CurrentLimit(); newCurrentLimit.setId(id); return newCurrentLimit; }
/** * 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 } }
/** * 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)) { try { // xmlsw.writeCharacters("\t"); xmlsw.writeStartElement(CIMURI.CIMURI, "CurrentLimit.value"); xmlsw.writeCharacters(String.valueOf(getValue())); xmlsw.writeEndElement(); // xmlsw.writeCharacters("\n"); } catch(XMLStreamException e) { StringBuilder errorMessage = new StringBuilder( "Error while trying to write the value of the attribute "); errorMessage.append("Value"); errorMessage.append(" in class "); errorMessage.append("CurrentLimit "); errorMessage.append("which ID has been initialized to : "); errorMessage.append(getId()); LOGGER.error(errorMessage.toString()); LOGGER.error(e.toString(), e); } } return; }
xmlsw.writeAttribute(CIMModel.rdfURI, "ID", getId()); errorMessage.append("CurrentLimit "); 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("CurrentLimit "); 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, "CurrentLimit"); xmlsw.writeAttribute(CIMModel.rdfURI, "ID", getId()); errorMessage.append("CurrentLimit "); 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);
CurrentLimit newCurrentLimit = new CurrentLimit(); CurrentLimit value = entry.getValue(); newCurrentLimit = value; this.id_CurrentLimit.put(newCurrentLimit.getId(), newCurrentLimit); this.allInstances.put(newCurrentLimit.getId(), newCurrentLimit); newMap.put(newCurrentLimit.getId(), newCurrentLimit); this.subsetsInstances.put( .put(newCurrentLimit.getId(), newCurrentLimit);
cim1.model.OperationalLimitType olt = ol.getOperationalLimitType(); if (ol instanceof cim1.model.CurrentLimit) { float value = ((cim1.model.CurrentLimit) ol).getValue(); if (value <= 0) { LOGGER.warn("Invalid current limit {} for {}", value, ols.getId());
message.append(getMessageForConsistency(this.minBitsets.get(subset)));
/** * 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 CurrentLimit clone() { CurrentLimit newInstance = new CurrentLimit(this); CurrentLimit newInstanceSP = newInstance; return newInstanceSP; }
/** * Copy constructor * The associations with other objects are not copied * * @param CurrentLimit * the reference to the class to copy * @return the class constructed */ private CurrentLimit(final CurrentLimit otherCurrentLimit) { // TODO : check exception safe this.copyBase(otherCurrentLimit); }
/** * 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 { super.resolveLinks(model, boundaryModel); removeFromUnresolved(); }
message.append(this.getId()); message.append("\" is not consistent in this context:\n");
this.setValue(typedValue); return; } else {
message.append(getMessageForConsistency(this.minBitset));