コード例 #1
0
 /**
  * Erstellt dieses Objekt
  *
  * @param configurationArea Konfigurationsbereich
  * @param pid
  * @param typePid Objekt-Typ-Pid
  * @param objectName Objekt-name falls vorhanden
  * @param allConfigurationData Konfigurationsdaten
  * @param origId
  * @param origConfigAuthority
  * @throws MissingObjectException Falls der angegebene Typ nicht existiert oder nicht vom Typ
  *     DynamicObjectType ist.
  * @throws ConfigurationChangeException Falls die Konfigurationsänderung nicht durchgeführt werden
  *     konnte
  */
 public void create(
     final ConfigurationArea configurationArea,
     final String pid,
     final String typePid,
     final String objectName,
     final Map<PidAttributeGroupUsage, Data> allConfigurationData,
     final long origId,
     final String origConfigAuthority)
     throws MissingObjectException, ConfigurationChangeException,
         MissingKExDaVAttributeGroupException {
   final SystemObject type = _connection.getDataModel().getObject(typePid);
   if (type == null) throw new MissingObjectException(type + " konnte nicht gefunden werden");
   if (!(type instanceof DynamicObjectType)) {
     throw new MissingObjectException(type + " ist kein Typ für dynamische Objekte");
   }
   final Map<PidAttributeGroupUsage, Data> map =
       new HashMap<PidAttributeGroupUsage, Data>(allConfigurationData);
   if (_connection.getDataModel().getAttributeGroup(Constants.Pids.AttributeGroupKExDaVConfigData)
       == null) {
     throw new MissingKExDaVAttributeGroupException();
   }
   if (origConfigAuthority != null) {
     map.put(
         new PidAttributeGroupUsage(
             Constants.Pids.AttributeGroupKExDaVConfigData, Constants.Pids.AspectProperties),
         createProperties(origId, origConfigAuthority));
   }
   final Collection<DataAndATGUsageInformation> dataList = convertConfigurationData(map);
   _manager.addMessage(
       Message.newInfo("Erstelle Objekt: " + (pid.length() == 0 ? '[' + origId + ']' : pid)));
   final DynamicObject dynamicObject =
       configurationArea.createDynamicObject((DynamicObjectType) type, pid, objectName, dataList);
   setWrappedObject(dynamicObject);
 }
コード例 #2
0
 /**
  * Liest alle Konfigurationsdaten dieses Objekts
  *
  * @return Konfigurationsdaten
  * @throws MissingObjectException Falls ein Objekt fehlt (entweder das Systemobjekt, oder die
  *     Attributgruppe oder der Aspekt)
  */
 public Map<PidAttributeGroupUsage, KExDaVAttributeGroupData> getAllConfigurationData()
     throws MissingObjectException {
   final SystemObject wrappedObject = getWrappedObjectOrThrowException();
   final Map<PidAttributeGroupUsage, KExDaVAttributeGroupData> result =
       new HashMap<PidAttributeGroupUsage, KExDaVAttributeGroupData>();
   final List<AttributeGroup> attributeGroups = wrappedObject.getType().getAttributeGroups();
   for (final AttributeGroup attributeGroup : attributeGroups) {
     final Collection<Aspect> aspects = attributeGroup.getAspects();
     for (final Aspect aspect : aspects) {
       final Data data = wrappedObject.getConfigurationData(attributeGroup, aspect);
       if (data != null) {
         result.put(
             new PidAttributeGroupUsage(attributeGroup.getPid(), aspect.getPid()),
             new KExDaVAttributeGroupData(data, _manager));
       }
     }
   }
   return result;
 }
コード例 #3
0
  /**
   * Liefert das System-Objekt mit der angegebenen PID zurück.
   *
   * @param pid Die permanente ID des System-Objekts
   * @return Das gewünschte System-Objekt oder <code>null</code>, wenn es kein Objekt mit der
   *     angegebenen PID gibt.
   * @see de.bsvrz.dav.daf.main.config.DataModel
   */
  public SystemObject getObject(String pid) {
    if (pid == null || pid.equals("") || pid.equals("null")) return null;
    SystemObject object = _dataModel.getObject(pid);
    if (isValid(object)) return object;
    synchronized (this) {
      // Sans, STS, KonfigAss: Korrektur _newlyActiveObjects
      if (_newlyActiveObjects == null) {
        _newlyActiveObjects = new HashMap<String, SystemObject>();

        long startTime = System.currentTimeMillis();
        final Map<String, ConfigurationArea> areas =
            ((ConfigDataModel) _dataModel).getAllConfigurationAreas();
        for (ConfigurationArea configurationArea : areas.values()) {
          final Collection<SystemObject> newObjects = configurationArea.getNewObjects();
          for (SystemObject newObject : newObjects) {
            final String newObjectPid = newObject.getPid();
            if (newObjectPid != null && newObjectPid.length() > 0 && isValid(newObject)) {
              _newlyActiveObjects.put(newObjectPid, newObject);
            }
          }

          _debug.fine(
              "Zwischenspeicherung von neuerdings aktiven Objekten dauerte in Millisekunden",
              System.currentTimeMillis() - startTime);
        }
      }
      return _newlyActiveObjects.get(pid);
    }

    //    final Set<ConfigurationArea> configurationAreas = _configurationAreaVersions.keySet();
    //    for(ConfigurationArea configurationArea : configurationAreas) {
    //      final Collection<SystemObject> newObjects = configurationArea.getNewObjects();
    //      for(SystemObject systemObject : newObjects) {
    //        if(systemObject.getPid().equals(pid) && isValid(systemObject)) return systemObject;
    //      }
    //    }
    //    return null;
  }