def set_file_spdx_id(self, doc, spdx_id):
if self.has_package(doc) and self.has_file(doc):<EOL><INDENT>if not self.file_spdx_id_set:<EOL><INDENT>self.file_spdx_id_set = True<EOL>if validations.validate_file_spdx_id(spdx_id):<EOL><INDENT>self.file(doc).spdx_id = spdx_id<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>raise SPDXValueError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise CardinalityError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise OrderError('<STR_LIT>')<EOL><DEDENT>
Sets the file SPDX Identifier.
Raises OrderError if no package or no file defined.
Raises SPDXValueError if malformed value.
Raises CardinalityError if more than one spdx_id set.