2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FScl_OrganizationImpl.cpp
19 * @brief This is the implementation for _OrganizationImpl class.
21 * This file contains definitions of @e _OrganizationImpl class.
24 #include <FBaseSysLog.h>
25 #include <FSclOrganization.h>
27 #include "FScl_OrganizationImpl.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Io;
32 namespace Tizen { namespace Social
35 _OrganizationImpl::_OrganizationImpl(void)
36 : __type(ORGANIZATION_TYPE_WORK)
37 , __isLogoPathChanged(false)
42 _OrganizationImpl::_OrganizationImpl(const _OrganizationImpl& rhs)
45 __jobTitle = rhs.__jobTitle;
46 __department = rhs.__department;
48 __agent = rhs.__agent;
49 __label = rhs.__label;
50 __location = rhs.__location;
51 __description = rhs.__description;
52 __phoneticName = rhs.__phoneticName;
53 __logoPath = rhs.__logoPath;
55 __isLogoPathChanged = rhs.__isLogoPathChanged;
58 _OrganizationImpl::~_OrganizationImpl(void)
64 _OrganizationImpl::operator =(const _OrganizationImpl& rhs)
72 __jobTitle = rhs.__jobTitle;
73 __department = rhs.__department;
75 __agent = rhs.__agent;
76 __label = rhs.__label;
77 __location = rhs.__location;
78 __description = rhs.__description;
79 __phoneticName = rhs.__phoneticName;
80 __logoPath = rhs.__logoPath;
82 __isLogoPathChanged = rhs.__isLogoPathChanged;
88 _OrganizationImpl::operator ==(const _OrganizationImpl& rhs) const
90 if (__name != rhs.__name)
95 if (__jobTitle != rhs.__jobTitle)
100 if (__department != rhs.__department)
105 if (__role != rhs.__role)
110 if (__agent != rhs.__agent)
115 if (__label != rhs.__label)
120 if (__location != rhs.__location)
125 if (__description != rhs.__description)
130 if (__phoneticName != rhs.__phoneticName)
135 if (__logoPath != rhs.__logoPath)
140 if (__type != rhs.__type)
149 _OrganizationImpl::operator !=(const _OrganizationImpl& rhs) const
151 return !(*this == rhs);
155 _OrganizationImpl::Equals(const Object& rhs) const
157 const _OrganizationImpl* pOrganization = dynamic_cast<const _OrganizationImpl*>(&rhs);
158 if (pOrganization == null)
163 return *this == *pOrganization;
167 _OrganizationImpl::GetHashCode(void) const
169 int hash = __name.GetHashCode();
170 hash += __jobTitle.GetHashCode();
171 hash += __department.GetHashCode();
172 hash += __role.GetHashCode();
173 hash += __agent.GetHashCode();
174 hash += __label.GetHashCode();
175 hash += __location.GetHashCode();
176 hash += __description.GetHashCode();
177 hash += __phoneticName.GetHashCode();
178 hash += __logoPath.GetHashCode();
185 _OrganizationImpl::GetName(void) const
191 _OrganizationImpl::GetJobTitle(void) const
197 _OrganizationImpl::GetDepartment(void) const
203 _OrganizationImpl::GetRole(void) const
209 _OrganizationImpl::GetAgent(void) const
215 _OrganizationImpl::GetType(void) const
221 _OrganizationImpl::GetLabel(void) const
227 _OrganizationImpl::GetLocation(void) const
233 _OrganizationImpl::GetDescription(void) const
235 return __description;
239 _OrganizationImpl::GetPhoneticName(void) const
241 return __phoneticName;
245 _OrganizationImpl::GetLogoPath(void) const
251 _OrganizationImpl::SetName(const String& name)
257 _OrganizationImpl::SetJobTitle(const String& jobTitle)
259 __jobTitle = jobTitle;
263 _OrganizationImpl::SetDepartment(const String& department)
265 __department = department;
269 _OrganizationImpl::SetRole(const String& role)
275 _OrganizationImpl::SetAgent(const String& agent)
281 _OrganizationImpl::SetType(OrganizationType type)
287 _OrganizationImpl::SetLabel(const String& label)
293 _OrganizationImpl::SetLocation(const String& location)
295 __location = location;
299 _OrganizationImpl::SetDescription(const String& description)
301 __description = description;
305 _OrganizationImpl::SetPhoneticName(const Tizen::Base::String& phoneticName)
307 __phoneticName = phoneticName;
311 _OrganizationImpl::SetLogo(const Tizen::Base::String& filePath)
313 if (!filePath.IsEmpty())
315 bool fileExist = File::IsFileExist(filePath);
316 SysTryReturn(NID_SCL, GetLastResult() != E_ILLEGAL_ACCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has been occurred.", GetErrorMessage(E_SYSTEM));
317 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));
318 SysTryReturn(NID_SCL, fileExist, E_FILE_NOT_FOUND, E_FILE_NOT_FOUND, "[%s] The specified file is not found.", GetErrorMessage(E_FILE_NOT_FOUND));
321 __logoPath = filePath;
322 __isLogoPathChanged = true;
328 _OrganizationImpl::IsEmpty(void) const
330 if (!__name.IsEmpty())
335 if (!__jobTitle.IsEmpty())
340 if (!__role.IsEmpty())
345 if (!__agent.IsEmpty())
350 if (!__department.IsEmpty())
355 if (!__location.IsEmpty())
360 if (!__description.IsEmpty())
365 if (!__phoneticName.IsEmpty())
370 if (!__logoPath.IsEmpty())
379 _OrganizationImpl::IsLogoPathChanged(void) const
381 return __isLogoPathChanged;
385 _OrganizationImpl::SetLogoPath(const Tizen::Base::String& filePath)
387 __logoPath = filePath;
392 const _OrganizationImpl*
393 _OrganizationImpl::GetInstance(const Organization& organization)
395 return organization.__pOrganizationImpl;
399 _OrganizationImpl::GetInstance(Organization& organization)
401 return organization.__pOrganizationImpl;