Пример #1
0
 @SuppressWarnings({"rawtypes", "unchecked"})
 @Override
 public void execute(
     IfcModelInterface model,
     Project project,
     ConcreteRevision concreteRevision,
     DatabaseSession databaseSession,
     Map<Long, IdEObject> created,
     Map<Long, IdEObject> deleted)
     throws UserException, BimserverLockConflictException, BimserverDatabaseException {
   PackageMetaData packageMetaData =
       databaseSession.getMetaDataManager().getPackageMetaData(project.getSchema());
   IdEObject idEObject =
       databaseSession.get(
           model, oid, new Query(packageMetaData, project.getId(), concreteRevision.getId(), -1));
   EClass eClass = databaseSession.getEClassForOid(oid);
   if (idEObject == null) {
     idEObject = created.get(oid);
   }
   if (idEObject == null) {
     throw new UserException(
         "No object of type + "
             + eClass.getName()
             + " with oid "
             + oid
             + " found in project with pid "
             + project.getId());
   }
   EAttribute eAttribute = packageMetaData.getEAttribute(eClass.getName(), attributeName);
   if (eAttribute == null) {
     throw new UserException(
         "No attribute with the name " + attributeName + " found in class " + eClass.getName());
   }
   if (!eAttribute.isMany()) {
     throw new UserException("Attribute is not of type 'many'");
   }
   List list = (List) idEObject.eGet(eAttribute);
   list.add(value);
   databaseSession.store(idEObject, project.getId(), concreteRevision.getId());
 }