Fesapi  1.1.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 #ifndef RELATIONSHIP_H
20 #define RELATIONSHIP_H
21 
22 #include <string>
23 
24 namespace epc
25 {
30  {
31  private:
32  bool internalTarget;
33  std::string target;
34  std::string type;
35  std::string id;
36 
37  public:
38  Relationship(const bool & internalTarget = true);
39  Relationship(const std::string & rsTarget, const std::string & rsType,const std::string & rsId, const bool & internalTarget = true);
40  ~Relationship() {}
41 
45  std::string toString() const;
46 
47  bool isInternalTarget() const;
48  const std::string& getTarget() const;
49  const std::string& getType() const;
50  const std::string& getId() const;
51 
52  void setIsExternalTarget();
53  void setIsInternalTarget();
54  void setTarget(const std::string & rsTarget);
55 
59  void setType(const std::string & rsType);
60 
61  // Set predefined types to the relationship
62  void setDestinationObjectType() {type = "http://schemas.energistics.org/package/2012/relationships/destinationObject";}
63  void setSourceObjectType() {type = "http://schemas.energistics.org/package/2012/relationships/sourceObject";}
64  void setDestinationMediaType() {type = "http://schemas.energistics.org/package/2012/relationships/destinationMedia";}
65  void setSourceMediaType() {type = "http://schemas.energistics.org/package/2012/relationships/sourceMedia";}
66  void setChunkedPartType() {type = "http://schemas.energistics.org/package/2012/relationships/chunkedPart";}
67  void setExternalPartProxyToMlType() {type = "http://schemas.energistics.org/package/2012/relationships/externalPartProxyToMl";}
68  void setMlToExternalPartProxyType() {type = "http://schemas.energistics.org/package/2012/relationships/mlToExternalPartProxy";}
69  void setExternalResourceType() {type = "http://schemas.energistics.org/package/2012/relationships/externalResource";}
70 
74  void setId(const std::string & rsId);
75  };
76 
77  bool operator==(const Relationship& r1, const Relationship& r2);
78 }
79 
80 #endif
epc::Relationship::toString
std::string toString() const
epc::Relationship
Definition: Relationship.h:29
epc::Relationship::setType
void setType(const std::string &rsType)
epc::Relationship::Relationship
Relationship(const bool &internalTarget=true)
The id uniquely identify the relationship in the context of the rel file. For epc,...
epc::Relationship::setId
void setId(const std::string &rsId)