Search in sources :

Example 6 with ExtendedDataSchema

use of org.bimserver.models.store.ExtendedDataSchema in project BIMserver by opensourceBIM.

the class AddGeometryReports method execute.

@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException, ServerException {
    ExtendedDataSchema htmlSchema = (ExtendedDataSchema) getDatabaseSession().querySingle(StorePackage.eINSTANCE.getExtendedDataSchema_Name(), "GEOMETRY_GENERATION_REPORT_HTML_1_1");
    ExtendedDataSchema jsonSchema = (ExtendedDataSchema) getDatabaseSession().querySingle(StorePackage.eINSTANCE.getExtendedDataSchema_Name(), "GEOMETRY_GENERATION_REPORT_JSON_1_1");
    storeExtendedData(getDatabaseSession(), htmlSchema, htmlBytes, "text/html", "html", timeToGenerateMs);
    storeExtendedData(getDatabaseSession(), jsonSchema, jsonBytes, "application/json", "json", timeToGenerateMs);
    return null;
}
Also used : ExtendedDataSchema(org.bimserver.models.store.ExtendedDataSchema)

Example 7 with ExtendedDataSchema

use of org.bimserver.models.store.ExtendedDataSchema in project BIMserver by opensourceBIM.

the class RemoveUserFromExtendedDataSchemaDatabaseAction method execute.

@Override
public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
    User user = getDatabaseSession().get(StorePackage.eINSTANCE.getUser(), uoid, OldQuery.getDefault());
    if (user == null) {
        throw new UserException("User with oid " + uoid + " not found");
    }
    ExtendedDataSchema extendedDataSchema = getDatabaseSession().get(StorePackage.eINSTANCE.getExtendedDataSchema(), edsid, OldQuery.getDefault());
    if (extendedDataSchema == null) {
        throw new UserException("ExtendedDataSchema with oid " + edsid + " not found");
    }
    user.getSchemas().remove(extendedDataSchema);
    getDatabaseSession().store(user);
    getDatabaseSession().store(extendedDataSchema);
    return null;
}
Also used : User(org.bimserver.models.store.User) ExtendedDataSchema(org.bimserver.models.store.ExtendedDataSchema) UserException(org.bimserver.shared.exceptions.UserException)

Aggregations

ExtendedDataSchema (org.bimserver.models.store.ExtendedDataSchema)7 User (org.bimserver.models.store.User)4 UserException (org.bimserver.shared.exceptions.UserException)4 IOException (java.io.IOException)3 DatabaseSession (org.bimserver.database.DatabaseSession)3 ServerException (org.bimserver.shared.exceptions.ServerException)3 Date (java.util.Date)2 BimserverDatabaseException (org.bimserver.BimserverDatabaseException)2 QueryException (org.bimserver.database.queries.om.QueryException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 FileAlreadyExistsException (java.nio.file.FileAlreadyExistsException)1 ArrayList (java.util.ArrayList)1 MessagingException (javax.mail.MessagingException)1 AddressException (javax.mail.internet.AddressException)1 GenerateGeometryResult (org.bimserver.GenerateGeometryResult)1 GeometryGeneratingException (org.bimserver.GeometryGeneratingException)1 SummaryMap (org.bimserver.SummaryMap)1 Change (org.bimserver.changes.Change)1 CreateObjectChange (org.bimserver.changes.CreateObjectChange)1