Source Code Cross Referenced for TagsPropertyLocalServiceImpl.java in  » Portal » liferay-portal-4.4.2 » com » liferay » portlet » tags » service » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » liferay portal 4.4.2 » com.liferay.portlet.tags.service.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003:         *
004:         * Permission is hereby granted, free of charge, to any person obtaining a copy
005:         * of this software and associated documentation files (the "Software"), to deal
006:         * in the Software without restriction, including without limitation the rights
007:         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008:         * copies of the Software, and to permit persons to whom the Software is
009:         * furnished to do so, subject to the following conditions:
010:         *
011:         * The above copyright notice and this permission notice shall be included in
012:         * all copies or substantial portions of the Software.
013:         *
014:         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015:         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016:         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017:         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018:         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019:         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020:         * SOFTWARE.
021:         */package com.liferay.portlet.tags.service.impl;
022:
023:        import com.liferay.portal.PortalException;
024:        import com.liferay.portal.SystemException;
025:        import com.liferay.portal.model.User;
026:        import com.liferay.portlet.tags.PropertyKeyException;
027:        import com.liferay.portlet.tags.PropertyValueException;
028:        import com.liferay.portlet.tags.model.TagsEntry;
029:        import com.liferay.portlet.tags.model.TagsProperty;
030:        import com.liferay.portlet.tags.service.base.TagsPropertyLocalServiceBaseImpl;
031:        import com.liferay.portlet.tags.util.TagsUtil;
032:
033:        import java.util.Date;
034:        import java.util.Iterator;
035:        import java.util.List;
036:
037:        /**
038:         * <a href="TagsPropertyLocalServiceImpl.java.html"><b><i>View Source</i></b>
039:         * </a>
040:         *
041:         * @author Brian Wing Shun Chan
042:         *
043:         */
044:        public class TagsPropertyLocalServiceImpl extends
045:                TagsPropertyLocalServiceBaseImpl {
046:
047:            public TagsProperty addProperty(long userId, long entryId,
048:                    String key, String value) throws PortalException,
049:                    SystemException {
050:
051:                User user = userPersistence.findByPrimaryKey(userId);
052:                Date now = new Date();
053:
054:                validate(key, value);
055:
056:                long propertyId = counterLocalService.increment();
057:
058:                TagsProperty property = tagsPropertyPersistence
059:                        .create(propertyId);
060:
061:                property.setCompanyId(user.getCompanyId());
062:                property.setUserId(user.getUserId());
063:                property.setUserName(user.getFullName());
064:                property.setCreateDate(now);
065:                property.setModifiedDate(now);
066:                property.setEntryId(entryId);
067:                property.setKey(key);
068:                property.setValue(value);
069:
070:                tagsPropertyPersistence.update(property);
071:
072:                return property;
073:            }
074:
075:            public TagsProperty addProperty(long userId, String entryName,
076:                    String key, String value) throws PortalException,
077:                    SystemException {
078:
079:                User user = userPersistence.findByPrimaryKey(userId);
080:
081:                TagsEntry entry = tagsEntryLocalService.getEntry(user
082:                        .getCompanyId(), entryName);
083:
084:                return addProperty(userId, entry.getEntryId(), key, value);
085:            }
086:
087:            public void deleteProperties(long entryId) throws PortalException,
088:                    SystemException {
089:
090:                Iterator itr = tagsPropertyPersistence.findByEntryId(entryId)
091:                        .iterator();
092:
093:                while (itr.hasNext()) {
094:                    TagsProperty property = (TagsProperty) itr.next();
095:
096:                    deleteProperty(property);
097:                }
098:            }
099:
100:            public void deleteProperty(long propertyId) throws PortalException,
101:                    SystemException {
102:
103:                TagsProperty property = tagsPropertyPersistence
104:                        .findByPrimaryKey(propertyId);
105:
106:                deleteProperty(property);
107:            }
108:
109:            public void deleteProperty(TagsProperty property)
110:                    throws PortalException, SystemException {
111:
112:                tagsPropertyPersistence.remove(property.getPropertyId());
113:            }
114:
115:            public List getProperties() throws SystemException {
116:                return tagsPropertyPersistence.findAll();
117:            }
118:
119:            public List getProperties(long entryId) throws SystemException {
120:                return tagsPropertyPersistence.findByEntryId(entryId);
121:            }
122:
123:            public TagsProperty getProperty(long propertyId)
124:                    throws PortalException, SystemException {
125:
126:                return tagsPropertyPersistence.findByPrimaryKey(propertyId);
127:            }
128:
129:            public TagsProperty getProperty(long entryId, String key)
130:                    throws PortalException, SystemException {
131:
132:                return tagsPropertyPersistence.findByE_K(entryId, key);
133:            }
134:
135:            public String[] getPropertyKeys(long companyId)
136:                    throws SystemException {
137:                return tagsPropertyKeyFinder.findByCompanyId(companyId);
138:            }
139:
140:            public List getPropertyValues(long companyId, String key)
141:                    throws SystemException {
142:
143:                return tagsPropertyFinder.findByC_K(companyId, key);
144:            }
145:
146:            public TagsProperty updateProperty(long propertyId, String key,
147:                    String value) throws PortalException, SystemException {
148:
149:                validate(key, value);
150:
151:                TagsProperty property = tagsPropertyPersistence
152:                        .findByPrimaryKey(propertyId);
153:
154:                property.setModifiedDate(new Date());
155:                property.setKey(key);
156:                property.setValue(value);
157:
158:                tagsPropertyPersistence.update(property);
159:
160:                return property;
161:            }
162:
163:            protected void validate(String key, String value)
164:                    throws PortalException, SystemException {
165:
166:                if (!TagsUtil.isValidWord(key)) {
167:                    throw new PropertyKeyException();
168:                }
169:
170:                if (!TagsUtil.isValidWord(value)) {
171:                    throw new PropertyValueException();
172:                }
173:            }
174:
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.