Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F12661964
node_modules_prometheus-association_association.js.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
node_modules_prometheus-association_association.js.html
View Options
<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>
JSDoc: Source: node_modules/prometheus-association/association.js
</
title
>
<
script
src
=
"scripts/prettify/prettify.js"
>
</
script
>
<
script
src
=
"scripts/prettify/lang-css.js"
>
</
script
>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<
link
type
=
"text/css"
rel
=
"stylesheet"
href
=
"styles/prettify-tomorrow.css"
>
<
link
type
=
"text/css"
rel
=
"stylesheet"
href
=
"styles/jsdoc-default.css"
>
</
head
>
<
body
>
<
div
id
=
"main"
>
<
h1
class
=
"page-title"
>
Source: node_modules/prometheus-association/association.js
</
h1
>
<
section
>
<
article
>
<
pre
class
=
"prettyprint source linenums"
><
code
>
var ResourceTypeManager = require("prometheus-resource-type-manager");
var FieldTypeManager = require("prometheus-field-type-manager");
var ResourceTypeField = require("prometheus-resource-type-field");
/**
* An interface for module developers that makes it easy to create a new association.
* @alias AssociationInterface
* @class
* @static
*/
var AssociationInterface = new function(){
/**
* Creates an association with given options
* @alias AssociationInterface.create
* @param {object} options
*/
this.create = function(options){
var from_type_name = options.left_type;
var to_type_name = options.right_type;
var bidirectional = options.bidirectional || false;
var from_field_name = options.name_ltr;
var to_field_name = options.name_rtl;
ResourceTypeManager.enforce_correct_type_name(from_type_name);
ResourceTypeManager.enforce_correct_type_name(to_type_name);
var from_type = ResourceTypeManager.getByName(from_type_name);
var to_type = ResourceTypeManager.getByName(to_type_name);
var field_type_ltr = new FieldTypeManager.getFieldTypeConstructorByName("association")(from_type_name, to_type_name);
var from_field_options = {
type: "association",
required: options.left_required || false
};
var from_field = new ResourceTypeField(from_field_name, from_field_options);
from_type.addField(from_field);
}
}
module.exports = AssociationInterface;
</
code
></
pre
>
</
article
>
</
section
>
</
div
>
<
nav
>
<
h2
><
a
href
=
"index.html"
>
Home
</
a
></
h2
><
h3
>
Modules
</
h3
><
ul
><
li
><
a
href
=
"module-database-accessor.html"
>
database-accessor
</
a
></
li
><
li
><
a
href
=
"module-field-type-manager.html"
>
field-type-manager
</
a
></
li
><
li
><
a
href
=
"module-resource-type-manager.html"
>
resource-type-manager
</
a
></
li
></
ul
><
h3
>
Classes
</
h3
><
ul
><
li
><
a
href
=
"AssociationInterface.html"
>
AssociationInterface
</
a
></
li
><
li
><
a
href
=
"field-type-manager-Association.html"
>
Association
</
a
></
li
><
li
><
a
href
=
"FieldType.html"
>
FieldType
</
a
></
li
><
li
><
a
href
=
"Resource.html"
>
Resource
</
a
></
li
><
li
><
a
href
=
"ResourceManager.html"
>
ResourceManager
</
a
></
li
><
li
><
a
href
=
"ResourceType.html"
>
ResourceType
</
a
></
li
><
li
><
a
href
=
"ResourceTypeField.html"
>
ResourceTypeField
</
a
></
li
></
ul
><
h3
>
Global
</
h3
><
ul
><
li
><
a
href
=
"global.html#construct_resource_type"
>
construct_resource_type
</
a
></
li
></
ul
>
</
nav
>
<
br
clear
=
"both"
>
<
footer
>
Documentation generated by
<
a
href
=
"https://github.com/jsdoc3/jsdoc"
>
JSDoc 3.3.0-alpha11
</
a
>
on Mon Dec 08 2014 13:12:25 GMT+0100 (CET)
</
footer
>
<
script
>
prettyPrint
();
</
script
>
<
script
src
=
"scripts/linenumber.js"
>
</
script
>
</
body
>
</
html
>
File Metadata
Details
Attached
Mime Type
text/html
Expires
Fri, Nov 28, 15:49 (9 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1063984
Default Alt Text
node_modules_prometheus-association_association.js.html (3 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment