Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public final class Scorm2004Organization implements Serializable {
*/
@JacksonXmlProperty(isAttribute = true, localName = "sharedDataGlobalToSystem", namespace = ADLCP.NAMESPACE_URI)
@JsonProperty("sharedDataGlobalToSystem")
private boolean sharedDataGlobalToSystem = false;
private Boolean sharedDataGlobalToSystem;

/**
* Metadata associated with this organization, providing details such as creation date, and other
Expand Down Expand Up @@ -216,7 +216,17 @@ public void setObjectivesGlobalToSystem(boolean objectivesGlobalToSystem) {
* @return true if the shared data is global to the system, false otherwise
*/
public boolean isSharedDataGlobalToSystem() {
return this.sharedDataGlobalToSystem;
return this.sharedDataGlobalToSystem == null || this.sharedDataGlobalToSystem;
}

/**
* Returns whether the manifest explicitly declared sharedDataGlobalToSystem.
*
* @return true when the attribute was present in the organization element
*/
@JsonIgnore
public boolean isSharedDataGlobalToSystemSpecified() {
return this.sharedDataGlobalToSystem != null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,40 @@ void objectivesGlobalToSystemPreservesExplicitFalse()
assertTrue(organization.isObjectivesGlobalToSystemSpecified());
}

@Test
void sharedDataGlobalToSystemDefaultsToTrueWhenOmitted()
throws IOException, XMLStreamException, ModuleParsingException, ManifestParseException {
String modulePath =
"src/test/resources/modules/scorm2004/ContentPackagingMetadata_SCORM20043rdEdition";
Scorm2004Manifest manifest = new Scorm2004Parser(new LocalFileAccess(modulePath))
.parseManifest(Scorm2004Parser.MANIFEST_FILE);

Scorm2004Organization organization = manifest
.getOrganizations()
.getOrganizationList()
.get(0);

assertTrue(organization.isSharedDataGlobalToSystem());
assertFalse(organization.isSharedDataGlobalToSystemSpecified());
}

@Test
void sharedDataGlobalToSystemPreservesExplicitFalse()
throws IOException, XMLStreamException, ModuleParsingException, ManifestParseException {
String modulePath =
"src/test/resources/modules/scorm2004/SequencingPostTestRollup4thEd_SCORM20044thEdition";
Scorm2004Manifest manifest = new Scorm2004Parser(new LocalFileAccess(modulePath))
.parseManifest(Scorm2004Parser.MANIFEST_FILE);

Scorm2004Organization organization = manifest
.getOrganizations()
.getOrganizationList()
.get(0);

assertFalse(organization.isSharedDataGlobalToSystem());
assertTrue(organization.isSharedDataGlobalToSystemSpecified());
}

/**
* Tests the getGlobalObjectiveIds method with a manifest that contains global objectives.
*/
Expand Down