new File(manager, tag, fileService, netManager, binaryConverter)
Creates a File instance.
Parameters:
| Name | Type | Description |
|---|---|---|
manager |
olympe.dc.Manager | Data cloud manager instance |
tag |
string | Instance tag |
fileService |
olympe.dc.FileServiceManager | |
netManager |
olympe.net.Manager | |
binaryConverter |
olympe.utils.BinaryConverter |
- Implements:
Extends
Members
-
<protected, non-null> db :olympe.dc.DBView
-
Type:
- Inherited From:
- Overrides:
-
<protected> graph :olympe.dc.GraphDB
-
Type:
- Inherited From:
- Overrides:
-
<protected> manager :olympe.dc.Manager
-
Type:
- Inherited From:
- Overrides:
-
<protected> tag :string
-
Type:
- string
- Inherited From:
- Overrides:
Methods
-
<static> createFile(model, transaction, name, content [, mimeType] [, tag])
-
Add the operations to create the specified file to the provided transaction.
Parameters:
Name Type Argument Default Description modelfunction The constructor of the file to create.
transactionolympe.dc.Transaction Transaction to update.
namestring Name of the file.
contentArrayBuffer Binary content of the file as ArrayBuffer.
mimeTypestring <optional>
'application/data' MIME type of the file.
tagstring <optional>
Tag of this file. If omitted, one will be automatically generated.
Returns:
The tag of the created instance.
- Type
- string
-
<static> createFileFromURL(model, transaction, name, url [, mimeType] [, tag])
-
Add the operations to create the specified file to the provided transaction. The content of the url is pointed by the specified URL. It can ONLY be an external URL or an object URL.
Parameters:
Name Type Argument Default Description modelfunction The constructor of the file to create.
transactionolympe.dc.Transaction Transaction to update.
namestring Name of the file.
urlstring URL that gives direct access to the file content.
mimeTypestring <optional>
'application/data' MIME type of the file.
tagstring <optional>
Tag of this file. If omitted, one will be automatically generated.
Returns:
The tag of the created instance.
- Type
- string
-
currentName()
-
- Inherited From:
- Overrides:
Returns:
The current name of this sync
- Type
- string
-
detachDelete( [transaction])
-
Remove all relations linked to the current sync and then remove the sync itself.
Parameters:
Name Type Argument Description transactionolympe.dc.Transaction <optional>
- Inherited From:
- Overrides:
-
equals(obj)
-
Checks whether 2 Syncs are equal.
Parameters:
Name Type Description obj* The object to compare with.
- Inherited From:
- Overrides:
Returns:
trueif this Sync is the same as theobj- Type
- boolean
-
forEachRelated(relation, callback)
-
Register a callback to be called each time a specific relation is added to this object.
Note: If relations are already established at the time of calling, then the callback will be immediately invoked for each existing relation.
Parameters:
Name Type Description relationolympe.dc.registry.Relation The relation to follow
callbackfunction The function to invoke.
- Inherited From:
- Overrides:
-
getContainer()
-
Gets the container of this instance.
- Inherited From:
- Overrides:
Returns:
The container.
- Type
- olympe.dc.Sync | olympe.df.Proxy.<olympe.dc.Sync>
-
getContentAsBinary(onSuccess [, onFailure])
-
Gets the file content as an ArrayBuffer.
Parameters:
Name Type Argument Description onSuccessfunction The function to call on completion with the binary content.
onFailurefunction <optional>
The function to call on failure with the error reason.
- Implements:
-
getContentAsString(onSuccess [, onFailure])
-
Retrieves the content of this file and returns it as an UTF-8 string. Note: this method should be used only when the file is a text file.
Parameters:
Name Type Argument Description onSuccessfunction The function to call on completion with the text content.
onFailurefunction <optional>
The function to call on failure with the error reason.
- Implements:
-
getContents()
-
Get the instances set as content by this instance.
- Inherited From:
- Overrides:
Returns:
The set of instances.
- Type
- olympe.dc.ListDef.<!olympe.dc.Sync>
-
getContentUrl(onSuccess [, onFailure])
-
Gets the URL that gives direct access to the file content:
- For files that are external to Olympe, gives the normal URL
- For the files stored by Olympe, provides a dataURL.
Note: The method
getUrlreturns the url property of this file, without taking into account if the content is directly accessible with this URL (without any authentication process).
Parameters:
Name Type Argument Description onSuccessfunction The function to call on completion with the URL to access to the file content.
onFailurefunction <optional>
The function to call on failure with the error reason.
- Implements:
- See:
-
getCreationDate()
-
Gets the file creation date.
Returns:
The creation date and time.
- Type
- olympe.df.PODateTime
-
getCurrentFirstRelated(relation [, tagsOnly])
-
Get the currently first related object, or its tag, matching the specified transformer.
Parameters:
Name Type Argument Default Description relationolympe.dc.registry.Relation Relation to follow
tagsOnlyboolean <optional>
false trueto return a tag (string),falsefor aSync.- Inherited From:
- Overrides:
- Deprecated:
-
- Yes
Returns:
The tag or
Sync.nullif there is no match.- Type
- olympe.dc.Sync | string
-
getCurrentRelated(relation [, tagsOnly])
-
Gets the currently related objects, or their tags, matching the specified transformer.
Parameters:
Name Type Argument Default Description relationolympe.dc.registry.Relation Relation to follow
tagsOnlyboolean <optional>
false trueto return an array of tags (strings),falsefor an array ofSyncs.- Inherited From:
- Overrides:
- Deprecated:
-
- Yes
Returns:
The resulting array of tags or
Syncs.- Type
- Array.<olympe.dc.Sync> | Array.<string>
-
getDeleteOperation()
-
Gets an
Operationto delete this instance, and all its dependencies. This implementation is based on the follow rules stored into the datamodel. It aims at still offering a "deleteOperation" while maintaining coherency with follow rules.- Inherited From:
- Overrides:
- Deprecated:
-
- use
olympe.dc.Transaction#deletewith a follow rule instead
- use
Returns:
A transaction operation that will delete this model and all its instances.
-
getDisplayName()
-
Gets the name of this
Sync, defaulting to a string representation of this object.- Inherited From:
- Overrides:
Returns:
The display name of this
Sync.- Type
- olympe.df.POString
-
getDomain()
-
Gets the domain for this
Sync.- Inherited From:
- Overrides:
Returns:
The domain for this
Sync. -
getExtendedModels()
-
Gets all the parent models for this model, recursively.
- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.ModelInfo.getExtendedModelsFrom()instead.
- Use
Returns:
A list of all the parent models.
- Type
- olympe.dc.ListDef
-
getFirstRelated(related [, valueType])
-
Gets the first object related to this one by the specified relation.
Parameters:
Name Type Argument Description relatedolympe.dc.registry.Relation The transformer specifying the type of relation.
valueTypefunction <optional>
Type of the values, must be sub-class of
Sync.- Inherited From:
- Overrides:
Returns:
The first object matching the request.
- Type
- olympe.dc.Sync | T | olympe.df.Proxy.<T>
-
getGroupOfObjects()
-
Gets the Group of Objects this
Syncbelongs to.- Inherited From:
- Overrides:
Returns:
The list of
GroupOfObject. -
getIncomingPropertiesDefs()
-
Gets all properties definitions that have this
Syncas a type.- Inherited From:
- Overrides:
- Deprecated:
-
- Yes
Returns:
The list of property definitions
-
getInheritedPropertiesDefs()
-
Gets all properties definitions inherited by this
Sync.- Inherited From:
- Overrides:
- Deprecated:
-
- Yes
Returns:
The list of property definitions.
-
getInstances()
-
Gets all instances of this model.
- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.ListDefBuilder.instances()instead.
- Use
Returns:
The list of instances.
- Type
- olympe.dc.ListDef
-
getManager()
-
Gets the related DataCloud manger.
- Inherited From:
- Overrides:
Returns:
The manager.
- Type
- olympe.dc.Manager
-
getMimeType()
-
Gets the file MIME type.
- Implements:
Returns:
The MIME type.
- Type
- olympe.df.POString
-
getModel()
-
Gets the model of this
Sync.- Inherited From:
- Overrides:
Returns:
The model of this
Sync.- Type
- olympe.dc.Sync
-
getModelAndParentModels()
-
Returns the model of this instance, and any parent models of this model.
- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.ModelInfoinstead.
- Use
Returns:
- Type
- olympe.dc.ListDef.<olympe.dc.Sync>
-
getModelTag()
-
Gets the tag of the model of this
Sync.- Inherited From:
- Overrides:
Returns:
The tag of the model.
- Type
- string
-
getModificationDate()
-
Gets the file modification date.
Returns:
The modification date and time.
- Type
- olympe.df.PODateTime
-
getName()
-
Gets the file name.
- Inherited From:
- Overrides:
- Implements:
Returns:
The name.
- Type
- olympe.df.POString
-
getOwner()
-
Gets the owner for this
Sync.- Inherited From:
- Overrides:
Returns:
The user who owns this
Sync. -
getOwnPropertiesDefs()
-
Gets all properties definitions defined on this
Sync.- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.ModelInfo.getOwnPropertiesFrom()andolympe.dc.ModelInfo.getOwnRelationsFrom()instead.
- Use
Returns:
The list of property definitions
-
getParentModel()
-
Gets the immediate parent model for this model.
- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.ModelInfo.getExtendedModelFrom()instead.
- Use
Returns:
The parent model.
- Type
- olympe.dc.Sync | olympe.df.Proxy.<olympe.dc.Sync>
-
getPropertiesDefs()
-
Gets all properties definitions inherited and defined by this
Sync.- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.ModelInfo.getPropertiesFrom()andolympe.dc.ModelInfo.getRelationsFrom()instead.
- Use
Returns:
The list of property definitions.
-
getPropertyAsBoolean(tag)
-
Gets a property value as an
OBoolean.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
- Inherited From:
- Overrides:
Returns:
The value of the property.
- Type
- olympe.df.POBoolean
-
getPropertyAsColor(tag)
-
Gets a property value as a
Color.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
- Inherited From:
- Overrides:
Returns:
The value of the property.
- Type
- olympe.df.PColor
-
getPropertyAsDateTime(tag)
-
Gets a property value as an
ODateTime.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
- Inherited From:
- Overrides:
Returns:
The value of the property.
- Type
- olympe.df.PODateTime
-
getPropertyAsNumber(tag)
-
Gets a property value as an
ONumber.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
- Inherited From:
- Overrides:
Returns:
The value of the property.
- Type
- olympe.df.PONumber
-
getPropertyAsString(tag)
-
Gets a property value as an
OString.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of the property.
- Inherited From:
- Overrides:
Returns:
The value of the property.
- Type
- olympe.df.POString
-
getPropertyAsSync(tag)
-
Gets a property value as a
Sync.Parameters:
Name Type Description tagolympe.dc.InstanceTag The tag of property.
- Inherited From:
- Overrides:
Returns:
The value of the property.
- Type
- olympe.df.Proxy.<olympe.dc.Sync> | olympe.dc.Sync
-
<package> getRawProperty(prop, valueCaster, valueType)
-
Gets a property raw value, optionally processing it with the specified callback.
Parameters:
Name Type Description propolympe.dc.InstanceTag Property.
valueCasterolympe.dc.Sync.ValueCaster Optional 'casting' function.
valueTypefunction The Type for the property.
- Inherited From:
- Overrides:
Returns:
The created node.
- Type
- olympe.df.Node.<T>
-
getRelated(relation [, valueType])
-
Gets all the objects related to this one by the specified relation.
Parameters:
Name Type Argument Description relationolympe.dc.registry.Relation The relation to follow.
valueTypefunction <optional>
Type of the values, must be sub-class of
Sync.- Inherited From:
- Overrides:
Returns:
A list of objects matching the request.
- Type
- olympe.dc.ListDef.<T>
-
getSource()
-
Gets the source of this
Sync.- Inherited From:
- Overrides:
Returns:
The source.
- Type
- string
-
getTag()
-
Gets the unique tag of this
Sync.- Inherited From:
- Overrides:
- Implements:
Returns:
The tag.
- Type
- string
-
getUrl()
-
Gets the URL for this file. Note: Some files won't be accessible via the URL alone because they will need authentication for permission checking.
getContentURLwill, on the other hand, always return a directly accessible URL.- Implements:
- See:
Returns:
The URL.
- Type
- olympe.df.POString
-
getVersion()
-
Gets the version of this
Sync.- Inherited From:
- Overrides:
Returns:
The version.
- Type
- number
-
isManaged()
-
Checks whether this file is 'managed' or not. A 'managed' file can only be accessed through the dc manager functions. Its URL is most likely not enough for access due to access control.
Returns:
- Type
- olympe.df.POBoolean
-
isModel()
-
Checks whether this
Syncis a model (i.e. it has a parent model).- Inherited From:
- Overrides:
- Deprecated:
-
- Use
olympe.dc.utils.isAModel()instead.
- Use
Returns:
trueif thisSyncis a model.- Type
- olympe.df.POBoolean
-
rename(newName [, callback])
-
Rename the file
Parameters:
Name Type Argument Description newNamestring | olympe.df.POString The new name.
callbackfunction <optional>
Function that will be called on completion.
- Implements:
-
saveAs(name)
-
Save the file to the disk with the provided name.
Parameters:
Name Type Description namestring The name under which to save the file.
-
toListDef()
-
Returns a ListDef whose query has only the current sync as start point.
- Inherited From:
- Overrides:
Returns:
The created
ListDef.- Type
- olympe.dc.ListDef
-
toOString()
-
Convert current object to a string representation. By default, this function simply returns what getDisplayName() returns, but this simplistic behavior should typically overridden by sibling classes.
- Inherited From:
- Overrides:
Returns:
The string representation.
- Type
- olympe.df.POString
-
toString()
-
- Inherited From:
-
transform(transformers)
-
Creates a
ListDefrepresenting a query which will apply the provided transformers to thisSync.Parameters:
Name Type Argument Description transformersolympe.dc.Transformer | Array.<olympe.dc.Transformer> <repeatable>
The transformers to apply. Note that an error is thrown if an array is passed as first argument, there is more than one arguments
- Inherited From:
- Overrides:
Returns:
The created
ListDef.- Type
- olympe.dc.ListDef
Olympe SDK