2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 * @file FScl_OrganizationImpl.cpp
18 * @brief This is the implementation for _OrganizationImpl class.
20 * This file contains definitions of @e _OrganizationImpl class.
23 #include <FBaseSysLog.h>
24 #include <FSclOrganization.h>
26 #include "FScl_OrganizationImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Io;
31 namespace Tizen { namespace Social
34 _OrganizationImpl::_OrganizationImpl(void)
35 : __type(ORGANIZATION_TYPE_WORK)
36 , __isLogoPathChanged(false)
41 _OrganizationImpl::_OrganizationImpl(const _OrganizationImpl& rhs)
44 __jobTitle = rhs.__jobTitle;
45 __department = rhs.__department;
47 __agent = rhs.__agent;
48 __label = rhs.__label;
49 __location = rhs.__location;
50 __description = rhs.__description;
51 __phoneticName = rhs.__phoneticName;
52 __logoPath = rhs.__logoPath;
54 __isLogoPathChanged = rhs.__isLogoPathChanged;
57 _OrganizationImpl::~_OrganizationImpl(void)
63 _OrganizationImpl::operator =(const _OrganizationImpl& rhs)
71 __jobTitle = rhs.__jobTitle;
72 __department = rhs.__department;
74 __agent = rhs.__agent;
75 __label = rhs.__label;
76 __location = rhs.__location;
77 __description = rhs.__description;
78 __phoneticName = rhs.__phoneticName;
79 __logoPath = rhs.__logoPath;
81 __isLogoPathChanged = rhs.__isLogoPathChanged;
87 _OrganizationImpl::operator ==(const _OrganizationImpl& rhs) const
89 if (__name != rhs.__name)
94 if (__jobTitle != rhs.__jobTitle)
99 if (__department != rhs.__department)
104 if (__role != rhs.__role)
109 if (__agent != rhs.__agent)
114 if (__label != rhs.__label)
119 if (__location != rhs.__location)
124 if (__description != rhs.__description)
129 if (__phoneticName != rhs.__phoneticName)
134 if (__logoPath != rhs.__logoPath)
139 if (__type != rhs.__type)
148 _OrganizationImpl::operator !=(const _OrganizationImpl& rhs) const
150 return !(*this == rhs);
154 _OrganizationImpl::Equals(const Object& rhs) const
156 const _OrganizationImpl* pOrganization = dynamic_cast<const _OrganizationImpl*>(&rhs);
157 if (pOrganization == null)
162 return *this == *pOrganization;
166 _OrganizationImpl::GetHashCode(void) const
168 int hash = __name.GetHashCode();
169 hash += __jobTitle.GetHashCode();
170 hash += __department.GetHashCode();
171 hash += __role.GetHashCode();
172 hash += __agent.GetHashCode();
173 hash += __label.GetHashCode();
174 hash += __location.GetHashCode();
175 hash += __description.GetHashCode();
176 hash += __phoneticName.GetHashCode();
177 hash += __logoPath.GetHashCode();
184 _OrganizationImpl::GetName(void) const
190 _OrganizationImpl::GetJobTitle(void) const
196 _OrganizationImpl::GetDepartment(void) const
202 _OrganizationImpl::GetRole(void) const
208 _OrganizationImpl::GetAgent(void) const
214 _OrganizationImpl::GetType(void) const
220 _OrganizationImpl::GetLabel(void) const
226 _OrganizationImpl::GetLocation(void) const
232 _OrganizationImpl::GetDescription(void) const
234 return __description;
238 _OrganizationImpl::GetPhoneticName(void) const
240 return __phoneticName;
244 _OrganizationImpl::GetLogoPath(void) const
250 _OrganizationImpl::SetName(const String& name)
256 _OrganizationImpl::SetJobTitle(const String& jobTitle)
258 __jobTitle = jobTitle;
262 _OrganizationImpl::SetDepartment(const String& department)
264 __department = department;
268 _OrganizationImpl::SetRole(const String& role)
274 _OrganizationImpl::SetAgent(const String& agent)
280 _OrganizationImpl::SetType(OrganizationType type)
286 _OrganizationImpl::SetLabel(const String& label)
292 _OrganizationImpl::SetLocation(const String& location)
294 __location = location;
298 _OrganizationImpl::SetDescription(const String& description)
300 __description = description;
304 _OrganizationImpl::SetPhoneticName(const Tizen::Base::String& phoneticName)
306 __phoneticName = phoneticName;
310 _OrganizationImpl::SetLogo(const Tizen::Base::String& filePath)
312 if (!filePath.IsEmpty())
314 bool fileExist = File::IsFileExist(filePath);
315 SysTryReturn(NID_SCL, GetLastResult() != E_ILLEGAL_ACCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
316 SysTryReturn(NID_SCL, GetLastResult() != E_INVALID_ARG, E_INVALID_ARG, E_INVALID_ARG, "[%s] The length of the specified filePath exceeds system limitations..", GetErrorMessage(E_INVALID_ARG));
317 SysTryReturn(NID_SCL, fileExist, E_FILE_NOT_FOUND, E_FILE_NOT_FOUND, "[%s] The specified file is not found.", GetErrorMessage(E_FILE_NOT_FOUND));
320 __logoPath = filePath;
321 __isLogoPathChanged = true;
327 _OrganizationImpl::IsEmpty(void) const
329 if (!__name.IsEmpty())
334 if (!__jobTitle.IsEmpty())
339 if (!__role.IsEmpty())
344 if (!__agent.IsEmpty())
349 if (!__department.IsEmpty())
354 if (!__location.IsEmpty())
359 if (!__description.IsEmpty())
364 if (!__phoneticName.IsEmpty())
369 if (!__logoPath.IsEmpty())
378 _OrganizationImpl::IsLogoPathChanged(void) const
380 return __isLogoPathChanged;
384 _OrganizationImpl::SetLogoPath(const Tizen::Base::String& filePath)
386 __logoPath = filePath;
391 const _OrganizationImpl*
392 _OrganizationImpl::GetInstance(const Organization& organization)
394 return organization.__pOrganizationImpl;
398 _OrganizationImpl::GetInstance(Organization& organization)
400 return organization.__pOrganizationImpl;