Search in sources :

Example 1 with MDocumentObject

use of com.pogeyan.cmis.data.mongo.MDocumentObject in project copper-cms by PogeyanOSS.

the class MDocumentObjectDAOImpl method update.

@Override
public void update(String objectId, Map<String, Object> updateProps) {
    UpdateOperations<MDocumentObject> update = createUpdateOperations();
    Query<MDocumentObject> query = createQuery().disableValidation().field("id").equal(objectId).field("token.changeType").notEqual(TokenChangeType.DELETED.value());
    if (updateProps.get("acl") != null) {
        MongoAclImpl mAcl = MBaseObject.convertMongoAcl((AccessControlListImplExt) updateProps.get("acl"));
        updateProps.remove("acl");
        updateProps.put("acl", mAcl);
    }
    if (updateProps.get("token") != null) {
        MongoToken mToken = MBaseObject.convertMongoToken((TokenImpl) updateProps.get("token"));
        updateProps.remove("token");
        updateProps.put("token", mToken);
    }
    for (Map.Entry<String, Object> entry : updateProps.entrySet()) {
        update = update.set(entry.getKey(), entry.getValue());
    }
    update(query, update);
}
Also used : MongoToken(com.pogeyan.cmis.data.mongo.MongoToken) MDocumentObject(com.pogeyan.cmis.data.mongo.MDocumentObject) MDocumentObject(com.pogeyan.cmis.data.mongo.MDocumentObject) IBaseObject(com.pogeyan.cmis.api.data.IBaseObject) IDocumentObject(com.pogeyan.cmis.api.data.IDocumentObject) MBaseObject(com.pogeyan.cmis.data.mongo.MBaseObject) MongoAclImpl(com.pogeyan.cmis.data.mongo.MongoAclImpl) Map(java.util.Map)

Aggregations

IBaseObject (com.pogeyan.cmis.api.data.IBaseObject)1 IDocumentObject (com.pogeyan.cmis.api.data.IDocumentObject)1 MBaseObject (com.pogeyan.cmis.data.mongo.MBaseObject)1 MDocumentObject (com.pogeyan.cmis.data.mongo.MDocumentObject)1 MongoAclImpl (com.pogeyan.cmis.data.mongo.MongoAclImpl)1 MongoToken (com.pogeyan.cmis.data.mongo.MongoToken)1 Map (java.util.Map)1