MidgardSchemaObjectFactory

MidgardSchemaObjectFactory

Synopsis

#include <midgard/midgard.h>

struct              MidgardSchemaObjectFactory;
struct              MidgardSchemaObjectFactoryClass;
MidgardObject *     midgard_schema_object_factory_get_object_by_guid
                                                        (MidgardConnection *mgd,
                                                         const gchar *guid);
MidgardObject *     midgard_schema_object_factory_get_object_by_path
                                                        (MidgardConnection *mgd,
                                                         const gchar *classname,
                                                         const gchar *path);
gboolean            midgard_schema_object_factory_object_undelete
                                                        (MidgardConnection *mgd,
                                                         const gchar *guid);
MidgardObject *     midgard_schema_object_factory_create_object
                                                        (MidgardConnection *mgd,
                                                         const gchar *classname,
                                                         GValue *value);

Object Hierarchy

  GObject
   +----MidgardSchemaObjectFactory

Description

Details

struct MidgardSchemaObjectFactory

struct MidgardSchemaObjectFactory;


struct MidgardSchemaObjectFactoryClass

struct MidgardSchemaObjectFactoryClass {
	GObjectClass parent;
};


midgard_schema_object_factory_get_object_by_guid ()

MidgardObject *     midgard_schema_object_factory_get_object_by_guid
                                                        (MidgardConnection *mgd,
                                                         const gchar *guid);

Creates new instance of the class defined in Midgard Schema.

Cases to return NULL:

  • Given guid is not a valid guid (MGD_ERR_NOT_EXISTS)

  • There's no object identified by given guid (MGD_ERR_NOT_EXISTS)

  • Object identified by given guid is deleted (MGD_ERR_OBJECT_DELETED)

  • Object identified by given guid is purged (MGD_ERR_OBJECT_PURGED)

  • Object identified by given guid doesn't provide 'metadata' or 'deleted' property (MGD_ERR_INVALID_PROPERTY)

mgd :

MidgardConnection instance

guid :

guid which identifies object to look for

Returns :

MidgardObject derived new instance or NULL on failure. [transfer full]

Since 10.05


midgard_schema_object_factory_get_object_by_path ()

MidgardObject *     midgard_schema_object_factory_get_object_by_path
                                                        (MidgardConnection *mgd,
                                                         const gchar *classname,
                                                         const gchar *path);

Get object by path. Path elements are objects' names. To get top object with empty name use "/" path. Also empty name is allowed in given path: "/A/B//D".

Cases to return NULL:

  • Object identified by given path doesn't exist (MGD_ERR_NOT_EXISTS)

  • Given classname doesn't support tree functionality (MGD_ERR_NOT_INTERNAL)

  • Given classname doesn't provide 'id' or unique named property (MGD_ERR_NOT_INTERNAL)

mgd :

MidgardConnection instance

classname :

name of the class, new instance should be created for

path :

path which identifies object

Returns :

MidgardObject derived, new classname instance or NULL. [transfer full]

Since 10.05


midgard_schema_object_factory_object_undelete ()

gboolean            midgard_schema_object_factory_object_undelete
                                                        (MidgardConnection *mgd,
                                                         const gchar *guid);

Cases to return FALSE:

  • Object identified by given guid doesn't exist (MGD_ERR_NOT_EXISTS)

  • Object identified by given guid is purged (MGD_ERR_OBJECT_PURGED)

  • Object identified by given guid is not deleted (MGD_ERR_USER_DATA)

  • Either object's or repligard's record couldn't be updated (MGD_ERR_INTERNAL)

mgd :

MidgardConnection instance

guid :

guid which identifies object to undelete

Returns :

TRUE on success, FALSE otherwise

Since 10.05


midgard_schema_object_factory_create_object ()

MidgardObject *     midgard_schema_object_factory_create_object
                                                        (MidgardConnection *mgd,
                                                         const gchar *classname,
                                                         GValue *value);

Check midgard_object_new() for returned value and possible errors.

mgd :

MidgardConnection instance

classname :

name of the class created object is instance of

value :

value which holds object's identifier

Returns :

new MidgardObject derived instance or NULL. [transfer full]

Since 10.05.1