public boolean isValid(final SystemObject object) { if (object == null) return false; if (object instanceof ConfigurationObject) { ConfigurationObject configurationObject = (ConfigurationObject) object; short viewingVersion = getVersion(configurationObject); final short validSince = configurationObject.getValidSince(); final short notValidSince = configurationObject.getNotValidSince(); return validSince <= viewingVersion && (notValidSince == 0 || viewingVersion < notValidSince); } else return object.isValid(); }
/** * Löscht dieses Objekt * * @param force Soll das Objekt auch gelöscht werden, wenn es nicht von KExDaV kopiert wurde? * @return true wenn das Objekt nicht mehr existiert, sonst false * @throws ConfigurationChangeException Falls das Ändern der Konfiguration fehlschlägt (z.B. keine * Berechtigung) */ public boolean invalidate(final boolean force) throws ConfigurationChangeException, MissingKExDaVAttributeGroupException { final SystemObject wrappedObject = getWrappedObject(); if (wrappedObject == null || !wrappedObject.isValid()) { return true; // Objekt existiert nicht mehr, es braucht nicht nochmal gelöscht zu werden. // Daher ist auch eine Warnung unnötig. } if (wrappedObject instanceof ConfigurationObject) { throw new IllegalArgumentException("Versuch, ein Konfigurationsobjekt zu löschen."); } if (!force && !isCopy()) return false; _manager.addMessage(Message.newInfo("Lösche Objekt: " + _objectSpecification)); wrappedObject.invalidate(); setWrappedObject(null); return true; }
/** * Prüft ob das Objekt existiert * * @return True wenn es existiert */ public boolean exists() { final SystemObject wrappedObject = getWrappedObject(); return wrappedObject != null && wrappedObject.isValid(); }