Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xschildw committed Apr 3, 2013
2 parents 99b5af0 + 93f0b22 commit bababc5
Show file tree
Hide file tree
Showing 42 changed files with 790 additions and 1,721 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: synapseClient
Type: Package
Title: Synapse R Client from Sage Bionetworks
Version: 0.21
ReleaseNotes: This version introduces the 'synapseExecute' function, which creates provenance records while running code.
Date: 2013-03-20
Version: 0.22
ReleaseNotes: Upgrade for compliance with Synapse back-end.
Date: 2013-04-01
Author@R: c(
person("Bruce", "Hoff", email="[email protected]", role="aut"),
person("Chris", "Bare", email="[email protected]", role="aut"),
Expand Down
9 changes: 8 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ useDynLib(synapseClient)

export(onWeb) ##,attach, detach)

## public methods introduced with v 0.22, ...
export(
File,
synGet,
synStore
)

## S3 utility methods
export(
synapseResetEndpoints,
Expand All @@ -33,7 +40,7 @@ export(
export(as.environment.EnhancedEnvironment,as.environment.GlobalCache, as.list.SimplePropertyOwner,
as.list.SynapseAnnotations, as.list.TypedPropertyStore, as.environment.EnhancedEnvironment,
length.EnhancedEnvironment, names.CachingObjectOwner, names.EnhancedEnvironment, names.LocationableWithoutBinaries,
names.Locationable,FileEntity,getPackageName.EnhancedEnvironment, getPackageName.ArchiveOwner,
names.Locationable,File,getPackageName.EnhancedEnvironment, getPackageName.ArchiveOwner,
as.environment.ArchiveOwner, edit.Code, names.Entity,

names.QueryResult,
Expand Down
12 changes: 10 additions & 2 deletions R/AAAschema.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ defineEntityClass <-

if("org.sagebionetworks.repo.model.Locationable" %in% implements) {
contains <- "Locationable"
} else if ("org.sagebionetworks.repo.model.FileEntity" %in% implements) {
contains <- "FileEntity"
} else{
contains <- "Entity"
}
Expand All @@ -75,6 +73,16 @@ defineEntityClass <-
),
package=package
)

# now add the new class to the list of defined ones
addToEntityTypeMap(className=name, jsonSchemaName=which)
}

addToEntityTypeMap<-function(className, jsonSchemaName) {
synapseEntityTypeMap<-.getCache("synapseEntityTypeMap")
if (is.null(synapseEntityTypeMap)) synapseEntityTypeMap<-list()
synapseEntityTypeMap[[jsonSchemaName]]<-className
.setCache("synapseEntityTypeMap", synapseEntityTypeMap)
}

defineEntityConstructors <-
Expand Down
3 changes: 1 addition & 2 deletions R/AllClasses.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

##
## NOTE: this constructor is defined here because it is used in the definition of
## the Entity, FileEntity and Locationable classes
## the Entity and Locationable classes
##
setGeneric(
name = "SynapseProperties",
Expand Down Expand Up @@ -470,4 +470,3 @@ setRefClass(
}
)
)

18 changes: 8 additions & 10 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@

setGeneric(
name="Activity",
def = function(activity, ...){
def = function(activity, ...) {
standardGeneric("Activity")
}
)

setGeneric(
name="File",
def = function(filePathParam, synapseStoreParam, ...) {
standardGeneric("File")
}
)

setGeneric(
name = "cacheEntity",
def = function(entity){
Expand Down Expand Up @@ -195,7 +202,6 @@ setGeneric(
}
)


setGeneric(
name = "deleteEntity",
def = function(entity){
Expand Down Expand Up @@ -289,13 +295,6 @@ setGeneric(
}
)

setGeneric(
name = "FileEntity",
def = function(entity){
standardGeneric("FileEntity")
}
)

setGeneric(
name = "Code",
def = function(entity, ...){
Expand Down Expand Up @@ -822,4 +821,3 @@ setGeneric(
}
)


7 changes: 0 additions & 7 deletions R/AllMgetFileCache.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,3 @@ setMethod(
}
)

setMethod(
f = "getFileCache",
signature = signature("missing", "missing", "FileCacheFactory"),
definition = function(factory){
getFileCache(tempfile(), "load", factory)
}
)
42 changes: 28 additions & 14 deletions R/Entity.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,19 @@ setMethod(
}
)

setMethod(
f = "updateEntity",
signature = "Entity",
definition = function(entity)
updateEntityMethod<-function(entity, forceVersion)
{
if(is.null(entity$properties$id))
stop("entity ID was null so could not update. use createEntity instead.")

annots <- entity@annotations
updateUri<-entity$properties$uri

if (missing("forceVersion")) forceVersion=FALSE
if (forceVersion) {
updateUri <-sprintf("%s/version", updateUri)
}

generatingActivity <- generatedBy(entity)
if (!is.null(generatingActivity)) {
generatingActivity <-storeEntity(generatingActivity)
Expand Down Expand Up @@ -324,8 +326,16 @@ setMethod(
cacheEntity(ee)

ee
}
}

setMethod(
f = "updateEntity",
signature = signature("Entity"),
# signature = signature("Entity", "missing"),
definition = function(entity) {updateEntityMethod(entity)}
)



setMethod(
f = "downloadEntity",
Expand Down Expand Up @@ -375,17 +385,21 @@ setMethod(
}
)

storeEntityMethod<-function(entity, forceVersion) {
if (missing("forceVersion")) forceVersion=FALSE
if (is.null(propertyValue(entity, "id"))) {
entity <- createEntity(entity)
}
else {
entity <- updateEntityMethod(entity, forceVersion)
}
}

setMethod(
f = "storeEntity",
signature= "Entity",
definition = function(entity) {
if (is.null(propertyValue(entity, "id"))) {
entity <- createEntity(entity)
}
else {
entity <- updateEntity(entity)
}
}
# signature= signature("Entity", "missing"),
signature= signature("Entity"),
definition = function(entity){storeEntityMethod(entity)}
)

#####
Expand Down
Loading

0 comments on commit bababc5

Please sign in to comment.