Fesapi  0.13.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
Relationship.h
1 /*-----------------------------------------------------------------------
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"; you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18 -----------------------------------------------------------------------*/
19 
20 
21 
22 #ifndef RELATIONSHIP_H
23 #define RELATIONSHIP_H
24 
25 #include <string>
26 
27 namespace epc
28 {
33  {
34  private:
35  bool internalTarget;
36  std::string target;
37  std::string type;
38  std::string id;
39 
40  public:
41  Relationship(const bool & internalTarget = true);
42  Relationship(const std::string & rsTarget, const std::string & rsType,const std::string & rsId, const bool & internalTarget = true);
43  ~Relationship() {}
44 
48  std::string toString() const;
49 
50  bool isInternalTarget() const;
51  const std::string& getTarget() const;
52  const std::string& getType() const;
53  const std::string& getId() const;
54 
55  void setIsExternalTarget();
56  void setIsInternalTarget();
57  void setTarget(const std::string & rsTarget);
58 
62  void setType(const std::string & rsType);
63 
64  // Set predefined types to the relationship
65  void setDestinationObjectType() {type = "http://schemas.energistics.org/package/2012/relationships/destinationObject";}
66  void setSourceObjectType() {type = "http://schemas.energistics.org/package/2012/relationships/sourceObject";}
67  void setDestinationMediaType() {type = "http://schemas.energistics.org/package/2012/relationships/destinationMedia";}
68  void setSourceMediaType() {type = "http://schemas.energistics.org/package/2012/relationships/sourceMedia";}
69  void setChunkedPartType() {type = "http://schemas.energistics.org/package/2012/relationships/chunkedPart";}
70  void setExternalPartProxyToMlType() {type = "http://schemas.energistics.org/package/2012/relationships/externalPartProxyToMl";}
71  void setMlToExternalPartProxyType() {type = "http://schemas.energistics.org/package/2012/relationships/mlToExternalPartProxy";}
72  void setExternalResourceType() {type = "http://schemas.energistics.org/package/2012/relationships/externalResource";}
73 
77  void setId(const std::string & rsId);
78  };
79 
80  bool operator==(const Relationship& r1, const Relationship& r2);
81 };
82 
83 #endif
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
void setId(const std::string &rsId)
Definition: Relationship.cpp:94
std::string toString() const
Definition: Relationship.cpp:41
Definition: ContentType.h:26
void setType(const std::string &rsType)
Definition: Relationship.cpp:89
Definition: Relationship.h:32
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:29