My Project
Relationship.h
1 /*-----------------------------------------------------------------------
2 Copyright F2I-CONSULTING, (2014-2017)
3 
4 philippe.verney@f2i-consulting.com
5 
6 This software is a computer program whose purpose is to access to data formatted using Energistics standards.
7 
8 This software is governed by the CeCILL-B license under French law and
9 abiding by the rules of distribution of free software. You can use,
10 modify and/ or redistribute the software under the terms of the CeCILL-B
11 license as circulated by CEA, CNRS and INRIA at the following URL
12 "http://www.cecill.info".
13 
14 As a counterpart to the access to the source code and rights to copy,
15 modify and redistribute granted by the license, users are provided only
16 with a limited warranty and the software's author, the holder of the
17 economic rights, and the successive licensors have only limited
18 liability.
19 
20 In this respect, the user's attention is drawn to the risks associated
21 with loading, using, modifying and/or developing or reproducing the
22 software by the user in light of its specific status of free software,
23 that may mean that it is complicated to manipulate, and that also
24 therefore means that it is reserved for developers and experienced
25 professionals having in-depth computer knowledge. Users are therefore
26 encouraged to load and test the software's suitability as regards their
27 requirements in conditions enabling the security of their systems and/or
28 data to be ensured and, more generally, to use and operate it in the
29 same conditions as regards security.
30 
31 The fact that you are presently reading this means that you have had
32 knowledge of the CeCILL-B license and that you accept its terms.
33 -----------------------------------------------------------------------*/
34 #ifndef RELATIONSHIP_H
35 #define RELATIONSHIP_H
36 
37 #include <string>
38 
39 namespace epc
40 {
45  {
46  private:
47  bool internalTarget;
48  std::string target;
49  std::string type;
50  std::string id;
51 
52  public:
53  Relationship(const bool & internalTarget = true);
54  Relationship(const std::string & rsTarget, const std::string & rsType,const std::string & rsId, const bool & internalTarget = true);
55  ~Relationship() {}
56 
60  std::string toString() const;
61 
62  bool isInternalTarget() const;
63  const std::string& getTarget() const;
64  const std::string& getType() const;
65  const std::string& getId() const;
66 
67  void setIsExternalTarget();
68  void setIsInternalTarget();
69  void setTarget(const std::string & rsTarget);
70 
74  void setType(const std::string & rsType);
75 
76  // Set predefined types to the relationship
77  void setDestinationObjectType() {type = "http://schemas.energistics.org/package/2012/relationships/destinationObject";}
78  void setSourceObjectType() {type = "http://schemas.energistics.org/package/2012/relationships/sourceObject";}
79  void setDestinationMediaType() {type = "http://schemas.energistics.org/package/2012/relationships/destinationMedia";}
80  void setSourceMediaType() {type = "http://schemas.energistics.org/package/2012/relationships/sourceMedia";}
81  void setChunkedPartType() {type = "http://schemas.energistics.org/package/2012/relationships/chunkedPart";}
82  void setExternalPartProxyToMlType() {type = "http://schemas.energistics.org/package/2012/relationships/externalPartProxyToMl";}
83  void setMlToExternalPartProxyType() {type = "http://schemas.energistics.org/package/2012/relationships/mlToExternalPartProxy";}
84  void setExternalResourceType() {type = "http://schemas.energistics.org/package/2012/relationships/externalResource";}
85 
89  void setId(const std::string & rsId);
90  };
91 
92  bool operator==(const Relationship& r1, const Relationship& r2);
93 };
94 
95 #endif
void setId(const std::string &rsId)
Definition: Relationship.cpp:106
std::string toString() const
Definition: Relationship.cpp:53
Definition: ContentType.h:39
void setType(const std::string &rsType)
Definition: Relationship.cpp:101
Definition: Relationship.h:44
Relationship(const bool &internalTarget=true)
The id uniquely identify the relationship in the context of the rel file. For epc, it also indicates the uuid of the destiantion object.
Definition: Relationship.cpp:41