midgard_object_class

midgard_object_class

Synopsis

const gchar*        midgard_object_class_get_primary_property
                                                        (MidgardObjectClass *klass);
const gchar*        midgard_object_class_get_property_parent
                                                        (MidgardObjectClass *klass);
const gchar*        midgard_object_class_get_property_up
                                                        (MidgardObjectClass *klass);
MidgardObjectClass** midgard_object_class_list_children (MidgardObjectClass *klass);
gboolean            midgard_object_class_is_multilang   (MidgardObjectClass *klass);
MgdObject*          midgard_object_class_get_object_by_guid
                                                        (MidgardConnection *mgd,
                                                         const gchar *guid);
MgdObject*          midgard_object_class_get_object_by_path
                                                        (MidgardConnection *mgd,
                                                         const gchar *classname,
                                                         const gchar *object_path);
gboolean            midgard_object_class_undelete       (MidgardConnection *mgd,
                                                         const gchar *guid);

Description

Details

midgard_object_class_get_primary_property ()

const gchar*        midgard_object_class_get_primary_property
                                                        (MidgardObjectClass *klass);

klass :

Returns :


midgard_object_class_get_property_parent ()

const gchar*        midgard_object_class_get_property_parent
                                                        (MidgardObjectClass *klass);

Returned string is a pointer to object's parent property, and you should not free it. Parent property is a property which holds value of field which points to parent object's identifier. Parent property always points to object's identifier which is not the same type as given MidgardObjectClass klass.

This is static method. NULL is returned if parent property is not found.

klass :

MidgardObjectClass

Returns :

the name of object's parent property or NULL.

midgard_object_class_get_property_up ()

const gchar*        midgard_object_class_get_property_up
                                                        (MidgardObjectClass *klass);

/param klass MidgardObjectClass pointer

Returned string is a pointer to object's up property. Up property is a property which holds value of field which points to "upper" object's identifier. Up property always points to object's identifier which is the same type as given MidgardObjectClass klass.

This is static method.

NULL is returned if up property is not registered for given class.

klass :

MidgardObjectClass

Returns :

the name of object's up property or NULL.

midgard_object_class_list_children ()

MidgardObjectClass** midgard_object_class_list_children (MidgardObjectClass *klass);

Returns newly allocated and NULL terminated children ( in midgard tree ) classes' pointers . Returned array should be freed if no longer needed without freeing array's elements. Elements are static pointers owned by GLib.

This is static method.

klass :

MidgardObjectClass

Returns :

array of childreen ( in midgard tree ) classes of the given MidgardObjectClass.

midgard_object_class_is_multilang ()

gboolean            midgard_object_class_is_multilang   (MidgardObjectClass *klass);

Checks whether given MidgardObjectClass is multilingual.

This is static method.

klass :

MidgardObjectClass

Returns :

TRUE if MidgardObjectClass is mutlilingual, FALSE otherwise.

midgard_object_class_get_object_by_guid ()

MgdObject*          midgard_object_class_get_object_by_guid
                                                        (MidgardConnection *mgd,
                                                         const gchar *guid);

MidgardError set by this function: - MGD_ERR_NOT_EXISTS: object is not found - MGD_ERR_OBJECT_DELETED: object is already deleted - MGD_ERR_OBJECT_PURGED: object is purged - MGD_ERR_SITEGROUP_VIOLATION if more than one record exists

This is static method.

mgd :

MidgardConnection handler

guid :

guid string which should identify an object

Returns :

MgdObject object identified by given guid

midgard_object_class_get_object_by_path ()

MgdObject*          midgard_object_class_get_object_by_path
                                                        (MidgardConnection *mgd,
                                                         const gchar *classname,
                                                         const gchar *object_path);

This is static method.

Cases to set NULL: - object is not found by path - object's class has neither name nor id member - object's class doesn't have both: parent and up property

MidgardError set by this method: - MGD_ERR_INTERNAL - MGD_ERR_NOT_EXISTS

mgd :

MidgardConnection holder

classname :

name of the class for which object should be returned

object_path :

a path, at which object should be found

Returns :

MgdObject instance of classname or NULL if object is not found

midgard_object_class_undelete ()

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

Undelete midgard object identified by given guid

MidgardError set by this method: - MGD_ERR_NOT_EXISTS - MGD_ERR_OBJECT_PURGED - MGD_ERR_INTERNAL

mgd :

MidgardConnection object

guid :

string which should identify object

Returns :

TRUE on success, FALSE otherwise