Ejemplo n.º 1
0
 @Override
 public void replace(ReferenceInfo origId, ReferenceInfo newId) {
   final Set<Entry<String, List<String>>> entrySet = data.entrySet();
   for (Entry<String, List<String>> entry : entrySet) {
     final String attributeKey = entry.getKey();
     final Attribute attribute = getAttribute(attributeKey);
     if (attribute.getRefType() == Allocatable.class) {
       final List<String> list = entry.getValue();
       final String origIdString = origId.getId();
       if (list.contains(origIdString)) {
         list.remove(origIdString);
         final String newIdString = newId.getId();
         if (!list.contains(newIdString)) {
           list.add(newIdString);
         }
       }
     }
   }
 }
Ejemplo n.º 2
0
 public void addRefValue(Attribute attribute, ReferenceInfo info) throws RaplaException {
   if (info == null) {
     return;
   }
   if (attribute.getRefType() != info.getType()) {
     throw new RaplaException(
         "Different reference type exepcted "
             + attribute.getRefType()
             + " but was "
             + info.getType());
   }
   String attributeKey = attribute.getKey();
   final String id = info.getId();
   addValue(attributeKey, id);
 }