001
014
015 package com.liferay.portlet.expando.service.impl;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.security.auth.CompanyThreadLocal;
020 import com.liferay.portal.util.PortalUtil;
021 import com.liferay.portlet.expando.model.ExpandoColumn;
022 import com.liferay.portlet.expando.model.ExpandoColumnConstants;
023 import com.liferay.portlet.expando.model.ExpandoRow;
024 import com.liferay.portlet.expando.model.ExpandoTable;
025 import com.liferay.portlet.expando.model.ExpandoTableConstants;
026 import com.liferay.portlet.expando.model.ExpandoValue;
027 import com.liferay.portlet.expando.model.impl.ExpandoValueImpl;
028 import com.liferay.portlet.expando.service.base.ExpandoValueLocalServiceBaseImpl;
029
030 import java.io.Serializable;
031
032 import java.util.Collection;
033 import java.util.Collections;
034 import java.util.Date;
035 import java.util.HashMap;
036 import java.util.List;
037 import java.util.Map;
038
039 import jodd.typeconverter.TypeConverterManager;
040
041
046 public class ExpandoValueLocalServiceImpl
047 extends ExpandoValueLocalServiceBaseImpl {
048
049 @Override
050 public ExpandoValue addValue(
051 long classNameId, long tableId, long columnId, long classPK,
052 String data)
053 throws PortalException, SystemException {
054
055 ExpandoTable table = expandoTablePersistence.findByPrimaryKey(tableId);
056
057 return doAddValue(
058 table.getCompanyId(), classNameId, tableId, columnId, classPK,
059 data);
060 }
061
062 @Override
063 public ExpandoValue addValue(
064 long companyId, String className, String tableName,
065 String columnName, long classPK, boolean data)
066 throws PortalException, SystemException {
067
068 ExpandoTable table = expandoTableLocalService.getTable(
069 companyId, className, tableName);
070
071 ExpandoColumn column = expandoColumnLocalService.getColumn(
072 table.getTableId(), columnName);
073
074 ExpandoValue value = new ExpandoValueImpl();
075
076 value.setCompanyId(table.getCompanyId());
077 value.setColumnId(column.getColumnId());
078 value.setBoolean(data);
079
080 return expandoValueLocalService.addValue(
081 table.getClassNameId(), table.getTableId(), column.getColumnId(),
082 classPK, value.getData());
083 }
084
085 @Override
086 public ExpandoValue addValue(
087 long companyId, String className, String tableName,
088 String columnName, long classPK, boolean[] data)
089 throws PortalException, SystemException {
090
091 ExpandoTable table = expandoTableLocalService.getTable(
092 companyId, className, tableName);
093
094 ExpandoColumn column = expandoColumnLocalService.getColumn(
095 table.getTableId(), columnName);
096
097 ExpandoValue value = new ExpandoValueImpl();
098
099 value.setCompanyId(table.getCompanyId());
100 value.setColumnId(column.getColumnId());
101 value.setBooleanArray(data);
102
103 return expandoValueLocalService.addValue(
104 table.getClassNameId(), table.getTableId(), column.getColumnId(),
105 classPK, value.getData());
106 }
107
108 @Override
109 public ExpandoValue addValue(
110 long companyId, String className, String tableName,
111 String columnName, long classPK, Date data)
112 throws PortalException, SystemException {
113
114 ExpandoTable table = expandoTableLocalService.getTable(
115 companyId, className, tableName);
116
117 ExpandoColumn column = expandoColumnLocalService.getColumn(
118 table.getTableId(), columnName);
119
120 ExpandoValue value = new ExpandoValueImpl();
121
122 value.setCompanyId(table.getCompanyId());
123 value.setColumnId(column.getColumnId());
124 value.setDate(data);
125
126 return expandoValueLocalService.addValue(
127 table.getClassNameId(), table.getTableId(), column.getColumnId(),
128 classPK, value.getData());
129 }
130
131 @Override
132 public ExpandoValue addValue(
133 long companyId, String className, String tableName,
134 String columnName, long classPK, Date[] data)
135 throws PortalException, SystemException {
136
137 ExpandoTable table = expandoTableLocalService.getTable(
138 companyId, className, tableName);
139
140 ExpandoColumn column = expandoColumnLocalService.getColumn(
141 table.getTableId(), columnName);
142
143 ExpandoValue value = new ExpandoValueImpl();
144
145 value.setCompanyId(table.getCompanyId());
146 value.setColumnId(column.getColumnId());
147 value.setDateArray(data);
148
149 return expandoValueLocalService.addValue(
150 table.getClassNameId(), table.getTableId(), column.getColumnId(),
151 classPK, value.getData());
152 }
153
154 @Override
155 public ExpandoValue addValue(
156 long companyId, String className, String tableName,
157 String columnName, long classPK, double data)
158 throws PortalException, SystemException {
159
160 ExpandoTable table = expandoTableLocalService.getTable(
161 companyId, className, tableName);
162
163 ExpandoColumn column = expandoColumnLocalService.getColumn(
164 table.getTableId(), columnName);
165
166 ExpandoValue value = new ExpandoValueImpl();
167
168 value.setCompanyId(table.getCompanyId());
169 value.setColumnId(column.getColumnId());
170 value.setDouble(data);
171
172 return expandoValueLocalService.addValue(
173 table.getClassNameId(), table.getTableId(), column.getColumnId(),
174 classPK, value.getData());
175 }
176
177 @Override
178 public ExpandoValue addValue(
179 long companyId, String className, String tableName,
180 String columnName, long classPK, double[] data)
181 throws PortalException, SystemException {
182
183 ExpandoTable table = expandoTableLocalService.getTable(
184 companyId, className, tableName);
185
186 ExpandoColumn column = expandoColumnLocalService.getColumn(
187 table.getTableId(), columnName);
188
189 ExpandoValue value = new ExpandoValueImpl();
190
191 value.setCompanyId(table.getCompanyId());
192 value.setColumnId(column.getColumnId());
193 value.setDoubleArray(data);
194
195 return expandoValueLocalService.addValue(
196 table.getClassNameId(), table.getTableId(), column.getColumnId(),
197 classPK, value.getData());
198 }
199
200 @Override
201 public ExpandoValue addValue(
202 long companyId, String className, String tableName,
203 String columnName, long classPK, float data)
204 throws PortalException, SystemException {
205
206 ExpandoTable table = expandoTableLocalService.getTable(
207 companyId, className, tableName);
208
209 ExpandoColumn column = expandoColumnLocalService.getColumn(
210 table.getTableId(), columnName);
211
212 ExpandoValue value = new ExpandoValueImpl();
213
214 value.setCompanyId(table.getCompanyId());
215 value.setColumnId(column.getColumnId());
216 value.setFloat(data);
217
218 return expandoValueLocalService.addValue(
219 table.getClassNameId(), table.getTableId(), column.getColumnId(),
220 classPK, value.getData());
221 }
222
223 @Override
224 public ExpandoValue addValue(
225 long companyId, String className, String tableName,
226 String columnName, long classPK, float[] data)
227 throws PortalException, SystemException {
228
229 ExpandoTable table = expandoTableLocalService.getTable(
230 companyId, className, tableName);
231
232 ExpandoColumn column = expandoColumnLocalService.getColumn(
233 table.getTableId(), columnName);
234
235 ExpandoValue value = new ExpandoValueImpl();
236
237 value.setCompanyId(table.getCompanyId());
238 value.setColumnId(column.getColumnId());
239 value.setFloatArray(data);
240
241 return expandoValueLocalService.addValue(
242 table.getClassNameId(), table.getTableId(), column.getColumnId(),
243 classPK, value.getData());
244 }
245
246 @Override
247 public ExpandoValue addValue(
248 long companyId, String className, String tableName,
249 String columnName, long classPK, int data)
250 throws PortalException, SystemException {
251
252 ExpandoTable table = expandoTableLocalService.getTable(
253 companyId, className, tableName);
254
255 ExpandoColumn column = expandoColumnLocalService.getColumn(
256 table.getTableId(), columnName);
257
258 ExpandoValue value = new ExpandoValueImpl();
259
260 value.setCompanyId(table.getCompanyId());
261 value.setColumnId(column.getColumnId());
262 value.setInteger(data);
263
264 return expandoValueLocalService.addValue(
265 table.getClassNameId(), table.getTableId(), column.getColumnId(),
266 classPK, value.getData());
267 }
268
269 @Override
270 public ExpandoValue addValue(
271 long companyId, String className, String tableName,
272 String columnName, long classPK, int[] data)
273 throws PortalException, SystemException {
274
275 ExpandoTable table = expandoTableLocalService.getTable(
276 companyId, className, tableName);
277
278 ExpandoColumn column = expandoColumnLocalService.getColumn(
279 table.getTableId(), columnName);
280
281 ExpandoValue value = new ExpandoValueImpl();
282
283 value.setCompanyId(table.getCompanyId());
284 value.setColumnId(column.getColumnId());
285 value.setIntegerArray(data);
286
287 return expandoValueLocalService.addValue(
288 table.getClassNameId(), table.getTableId(), column.getColumnId(),
289 classPK, value.getData());
290 }
291
292 @Override
293 public ExpandoValue addValue(
294 long companyId, String className, String tableName,
295 String columnName, long classPK, long data)
296 throws PortalException, SystemException {
297
298 ExpandoTable table = expandoTableLocalService.getTable(
299 companyId, className, tableName);
300
301 ExpandoColumn column = expandoColumnLocalService.getColumn(
302 table.getTableId(), columnName);
303
304 ExpandoValue value = new ExpandoValueImpl();
305
306 value.setCompanyId(table.getCompanyId());
307 value.setColumnId(column.getColumnId());
308 value.setLong(data);
309
310 return expandoValueLocalService.addValue(
311 table.getClassNameId(), table.getTableId(), column.getColumnId(),
312 classPK, value.getData());
313 }
314
315 @Override
316 public ExpandoValue addValue(
317 long companyId, String className, String tableName,
318 String columnName, long classPK, long[] data)
319 throws PortalException, SystemException {
320
321 ExpandoTable table = expandoTableLocalService.getTable(
322 companyId, className, tableName);
323
324 ExpandoColumn column = expandoColumnLocalService.getColumn(
325 table.getTableId(), columnName);
326
327 ExpandoValue value = new ExpandoValueImpl();
328
329 value.setCompanyId(table.getCompanyId());
330 value.setColumnId(column.getColumnId());
331 value.setLongArray(data);
332
333 return expandoValueLocalService.addValue(
334 table.getClassNameId(), table.getTableId(), column.getColumnId(),
335 classPK, value.getData());
336 }
337
338 @Override
339 public ExpandoValue addValue(
340 long companyId, String className, String tableName,
341 String columnName, long classPK, Number data)
342 throws PortalException, SystemException {
343
344 ExpandoTable table = expandoTableLocalService.getTable(
345 companyId, className, tableName);
346
347 ExpandoColumn column = expandoColumnLocalService.getColumn(
348 table.getTableId(), columnName);
349
350 ExpandoValue value = new ExpandoValueImpl();
351
352 value.setCompanyId(table.getCompanyId());
353 value.setColumnId(column.getColumnId());
354 value.setNumber(data);
355
356 return expandoValueLocalService.addValue(
357 table.getClassNameId(), table.getTableId(), column.getColumnId(),
358 classPK, value.getData());
359 }
360
361 @Override
362 public ExpandoValue addValue(
363 long companyId, String className, String tableName,
364 String columnName, long classPK, Number[] data)
365 throws PortalException, SystemException {
366
367 ExpandoTable table = expandoTableLocalService.getTable(
368 companyId, className, tableName);
369
370 ExpandoColumn column = expandoColumnLocalService.getColumn(
371 table.getTableId(), columnName);
372
373 ExpandoValue value = new ExpandoValueImpl();
374
375 value.setCompanyId(table.getCompanyId());
376 value.setColumnId(column.getColumnId());
377 value.setNumberArray(data);
378
379 return expandoValueLocalService.addValue(
380 table.getClassNameId(), table.getTableId(), column.getColumnId(),
381 classPK, value.getData());
382 }
383
384 @Override
385 public ExpandoValue addValue(
386 long companyId, String className, String tableName,
387 String columnName, long classPK, Object data)
388 throws PortalException, SystemException {
389
390 ExpandoColumn column = expandoColumnLocalService.getColumn(
391 companyId, className, tableName, columnName);
392
393 int type = column.getType();
394
395 if (type == ExpandoColumnConstants.BOOLEAN) {
396 return expandoValueLocalService.addValue(
397 companyId, className, tableName, columnName, classPK,
398 ((Boolean)data).booleanValue());
399 }
400 else if (type == ExpandoColumnConstants.BOOLEAN_ARRAY) {
401 return expandoValueLocalService.addValue(
402 companyId, className, tableName, columnName, classPK,
403 (boolean[])data);
404 }
405 else if (type == ExpandoColumnConstants.DATE) {
406 Date date = TypeConverterManager.convertType(data, Date.class);
407
408 return expandoValueLocalService.addValue(
409 companyId, className, tableName, columnName, classPK, date);
410 }
411 else if (type == ExpandoColumnConstants.DATE_ARRAY) {
412 Date[] dates = TypeConverterManager.convertType(data, Date[].class);
413
414 return expandoValueLocalService.addValue(
415 companyId, className, tableName, columnName, classPK, dates);
416 }
417 else if (type == ExpandoColumnConstants.DOUBLE) {
418 return expandoValueLocalService.addValue(
419 companyId, className, tableName, columnName, classPK,
420 ((Double)data).doubleValue());
421 }
422 else if (type == ExpandoColumnConstants.DOUBLE_ARRAY) {
423 return expandoValueLocalService.addValue(
424 companyId, className, tableName, columnName, classPK,
425 (double[])data);
426 }
427 else if (type == ExpandoColumnConstants.FLOAT) {
428 return expandoValueLocalService.addValue(
429 companyId, className, tableName, columnName, classPK,
430 ((Float)data).floatValue());
431 }
432 else if (type == ExpandoColumnConstants.FLOAT_ARRAY) {
433 return expandoValueLocalService.addValue(
434 companyId, className, tableName, columnName, classPK,
435 (float[])data);
436 }
437 else if (type == ExpandoColumnConstants.INTEGER) {
438 return expandoValueLocalService.addValue(
439 companyId, className, tableName, columnName, classPK,
440 ((Integer)data).intValue());
441 }
442 else if (type == ExpandoColumnConstants.INTEGER_ARRAY) {
443 return expandoValueLocalService.addValue(
444 companyId, className, tableName, columnName, classPK,
445 (int[])data);
446 }
447 else if (type == ExpandoColumnConstants.LONG) {
448 return expandoValueLocalService.addValue(
449 companyId, className, tableName, columnName, classPK,
450 ((Long)data).longValue());
451 }
452 else if (type == ExpandoColumnConstants.LONG_ARRAY) {
453 return expandoValueLocalService.addValue(
454 companyId, className, tableName, columnName, classPK,
455 (long[])data);
456 }
457 else if (type == ExpandoColumnConstants.NUMBER) {
458 return expandoValueLocalService.addValue(
459 companyId, className, tableName, columnName, classPK,
460 (Number)data);
461 }
462 else if (type == ExpandoColumnConstants.NUMBER_ARRAY) {
463 return expandoValueLocalService.addValue(
464 companyId, className, tableName, columnName, classPK,
465 (Number[])data);
466 }
467 else if (type == ExpandoColumnConstants.SHORT) {
468 return expandoValueLocalService.addValue(
469 companyId, className, tableName, columnName, classPK,
470 ((Short)data).shortValue());
471 }
472 else if (type == ExpandoColumnConstants.SHORT_ARRAY) {
473 return expandoValueLocalService.addValue(
474 companyId, className, tableName, columnName, classPK,
475 (short[])data);
476 }
477 else if (type == ExpandoColumnConstants.STRING_ARRAY) {
478 return expandoValueLocalService.addValue(
479 companyId, className, tableName, columnName, classPK,
480 (String[])data);
481 }
482 else {
483 return expandoValueLocalService.addValue(
484 companyId, className, tableName, columnName, classPK,
485 (String)data);
486 }
487 }
488
489 @Override
490 public ExpandoValue addValue(
491 long companyId, String className, String tableName,
492 String columnName, long classPK, short data)
493 throws PortalException, SystemException {
494
495 ExpandoTable table = expandoTableLocalService.getTable(
496 companyId, className, tableName);
497
498 ExpandoColumn column = expandoColumnLocalService.getColumn(
499 table.getTableId(), columnName);
500
501 ExpandoValue value = new ExpandoValueImpl();
502
503 value.setCompanyId(table.getCompanyId());
504 value.setColumnId(column.getColumnId());
505 value.setShort(data);
506
507 return expandoValueLocalService.addValue(
508 table.getClassNameId(), table.getTableId(), column.getColumnId(),
509 classPK, value.getData());
510 }
511
512 @Override
513 public ExpandoValue addValue(
514 long companyId, String className, String tableName,
515 String columnName, long classPK, short[] data)
516 throws PortalException, SystemException {
517
518 ExpandoTable table = expandoTableLocalService.getTable(
519 companyId, className, tableName);
520
521 ExpandoColumn column = expandoColumnLocalService.getColumn(
522 table.getTableId(), columnName);
523
524 ExpandoValue value = new ExpandoValueImpl();
525
526 value.setCompanyId(table.getCompanyId());
527 value.setColumnId(column.getColumnId());
528 value.setShortArray(data);
529
530 return expandoValueLocalService.addValue(
531 table.getClassNameId(), table.getTableId(), column.getColumnId(),
532 classPK, value.getData());
533 }
534
535 @Override
536 public ExpandoValue addValue(
537 long companyId, String className, String tableName,
538 String columnName, long classPK, String data)
539 throws PortalException, SystemException {
540
541 ExpandoTable table = expandoTableLocalService.getTable(
542 companyId, className, tableName);
543
544 ExpandoColumn column = expandoColumnLocalService.getColumn(
545 table.getTableId(), columnName);
546
547 ExpandoValue value = new ExpandoValueImpl();
548
549 value.setCompanyId(table.getCompanyId());
550 value.setColumnId(column.getColumnId());
551 value.setString(data);
552
553 return expandoValueLocalService.addValue(
554 table.getClassNameId(), table.getTableId(), column.getColumnId(),
555 classPK, value.getData());
556 }
557
558 @Override
559 public ExpandoValue addValue(
560 long companyId, String className, String tableName,
561 String columnName, long classPK, String[] data)
562 throws PortalException, SystemException {
563
564 ExpandoTable table = expandoTableLocalService.getTable(
565 companyId, className, tableName);
566
567 ExpandoColumn column = expandoColumnLocalService.getColumn(
568 table.getTableId(), columnName);
569
570 ExpandoValue value = new ExpandoValueImpl();
571
572 value.setCompanyId(table.getCompanyId());
573 value.setColumnId(column.getColumnId());
574 value.setStringArray(data);
575
576 return expandoValueLocalService.addValue(
577 table.getClassNameId(), table.getTableId(), column.getColumnId(),
578 classPK, value.getData());
579 }
580
581
585 @Override
586 public ExpandoValue addValue(
587 String className, String tableName, String columnName, long classPK,
588 boolean data)
589 throws PortalException, SystemException {
590
591 long companyId = CompanyThreadLocal.getCompanyId();
592
593 return expandoValueLocalService.addValue(
594 companyId, className, tableName, columnName, classPK, data);
595 }
596
597
601 @Override
602 public ExpandoValue addValue(
603 String className, String tableName, String columnName, long classPK,
604 boolean[] data)
605 throws PortalException, SystemException {
606
607 long companyId = CompanyThreadLocal.getCompanyId();
608
609 return expandoValueLocalService.addValue(
610 companyId, className, tableName, columnName, classPK, data);
611 }
612
613
616 @Override
617 public ExpandoValue addValue(
618 String className, String tableName, String columnName, long classPK,
619 Date data)
620 throws PortalException, SystemException {
621
622 long companyId = CompanyThreadLocal.getCompanyId();
623
624 return expandoValueLocalService.addValue(
625 companyId, className, tableName, columnName, classPK, data);
626 }
627
628
631 @Override
632 public ExpandoValue addValue(
633 String className, String tableName, String columnName, long classPK,
634 Date[] data)
635 throws PortalException, SystemException {
636
637 long companyId = CompanyThreadLocal.getCompanyId();
638
639 return expandoValueLocalService.addValue(
640 companyId, className, tableName, columnName, classPK, data);
641 }
642
643
647 @Override
648 public ExpandoValue addValue(
649 String className, String tableName, String columnName, long classPK,
650 double data)
651 throws PortalException, SystemException {
652
653 long companyId = CompanyThreadLocal.getCompanyId();
654
655 return expandoValueLocalService.addValue(
656 companyId, className, tableName, columnName, classPK, data);
657 }
658
659
663 @Override
664 public ExpandoValue addValue(
665 String className, String tableName, String columnName, long classPK,
666 double[] data)
667 throws PortalException, SystemException {
668
669 long companyId = CompanyThreadLocal.getCompanyId();
670
671 return expandoValueLocalService.addValue(
672 companyId, className, tableName, columnName, classPK, data);
673 }
674
675
679 @Override
680 public ExpandoValue addValue(
681 String className, String tableName, String columnName, long classPK,
682 float data)
683 throws PortalException, SystemException {
684
685 long companyId = CompanyThreadLocal.getCompanyId();
686
687 return expandoValueLocalService.addValue(
688 companyId, className, tableName, columnName, classPK, data);
689 }
690
691
695 @Override
696 public ExpandoValue addValue(
697 String className, String tableName, String columnName, long classPK,
698 float[] data)
699 throws PortalException, SystemException {
700
701 long companyId = CompanyThreadLocal.getCompanyId();
702
703 return expandoValueLocalService.addValue(
704 companyId, className, tableName, columnName, classPK, data);
705 }
706
707
710 @Override
711 public ExpandoValue addValue(
712 String className, String tableName, String columnName, long classPK,
713 int data)
714 throws PortalException, SystemException {
715
716 long companyId = CompanyThreadLocal.getCompanyId();
717
718 return expandoValueLocalService.addValue(
719 companyId, className, tableName, columnName, classPK, data);
720 }
721
722
725 @Override
726 public ExpandoValue addValue(
727 String className, String tableName, String columnName, long classPK,
728 int[] data)
729 throws PortalException, SystemException {
730
731 long companyId = CompanyThreadLocal.getCompanyId();
732
733 return expandoValueLocalService.addValue(
734 companyId, className, tableName, columnName, classPK, data);
735 }
736
737
740 @Override
741 public ExpandoValue addValue(
742 String className, String tableName, String columnName, long classPK,
743 long data)
744 throws PortalException, SystemException {
745
746 long companyId = CompanyThreadLocal.getCompanyId();
747
748 return expandoValueLocalService.addValue(
749 companyId, className, tableName, columnName, classPK, data);
750 }
751
752
755 @Override
756 public ExpandoValue addValue(
757 String className, String tableName, String columnName, long classPK,
758 long[] data)
759 throws PortalException, SystemException {
760
761 long companyId = CompanyThreadLocal.getCompanyId();
762
763 return expandoValueLocalService.addValue(
764 companyId, className, tableName, columnName, classPK, data);
765 }
766
767
770 @Override
771 public ExpandoValue addValue(
772 String className, String tableName, String columnName, long classPK,
773 Object data)
774 throws PortalException, SystemException {
775
776 long companyId = CompanyThreadLocal.getCompanyId();
777
778 return expandoValueLocalService.addValue(
779 companyId, className, tableName, columnName, classPK, data);
780 }
781
782
786 @Override
787 public ExpandoValue addValue(
788 String className, String tableName, String columnName, long classPK,
789 short data)
790 throws PortalException, SystemException {
791
792 long companyId = CompanyThreadLocal.getCompanyId();
793
794 return expandoValueLocalService.addValue(
795 companyId, className, tableName, columnName, classPK, data);
796 }
797
798
802 @Override
803 public ExpandoValue addValue(
804 String className, String tableName, String columnName, long classPK,
805 short[] data)
806 throws PortalException, SystemException {
807
808 long companyId = CompanyThreadLocal.getCompanyId();
809
810 return expandoValueLocalService.addValue(
811 companyId, className, tableName, columnName, classPK, data);
812 }
813
814
818 @Override
819 public ExpandoValue addValue(
820 String className, String tableName, String columnName, long classPK,
821 String data)
822 throws PortalException, SystemException {
823
824 long companyId = CompanyThreadLocal.getCompanyId();
825
826 return expandoValueLocalService.addValue(
827 companyId, className, tableName, columnName, classPK, data);
828 }
829
830
834 @Override
835 public ExpandoValue addValue(
836 String className, String tableName, String columnName, long classPK,
837 String[] data)
838 throws PortalException, SystemException {
839
840 long companyId = CompanyThreadLocal.getCompanyId();
841
842 return expandoValueLocalService.addValue(
843 companyId, className, tableName, columnName, classPK, data);
844 }
845
846 @Override
847 public void addValues(
848 long classNameId, long tableId, List<ExpandoColumn> columns,
849 long classPK, Map<String, String> data)
850 throws PortalException, SystemException {
851
852 ExpandoTable table = expandoTablePersistence.findByPrimaryKey(tableId);
853
854 ExpandoRow row = expandoRowPersistence.fetchByT_C(tableId, classPK);
855
856 if (row == null) {
857 long rowId = counterLocalService.increment();
858
859 row = expandoRowPersistence.create(rowId);
860
861 row.setCompanyId(table.getCompanyId());
862 row.setTableId(tableId);
863 row.setClassPK(classPK);
864
865 expandoRowPersistence.update(row, false);
866 }
867
868 for (ExpandoColumn column : columns) {
869 String dataString = data.get(column.getName());
870
871 if (dataString == null) {
872 continue;
873 }
874
875 ExpandoValue value = expandoValuePersistence.fetchByC_R(
876 column.getColumnId(), row.getRowId());
877
878 if (value == null) {
879 long valueId = counterLocalService.increment();
880
881 value = expandoValuePersistence.create(valueId);
882
883 value.setCompanyId(table.getCompanyId());
884 value.setTableId(tableId);
885 value.setColumnId(column.getColumnId());
886 value.setRowId(row.getRowId());
887 value.setClassNameId(classNameId);
888 value.setClassPK(classPK);
889 }
890
891 value.setData(dataString);
892
893 expandoValuePersistence.update(value, false);
894 }
895 }
896
897 @Override
898 public void addValues(
899 long companyId, long classNameId, String tableName, long classPK,
900 Map<String, Serializable> attributes)
901 throws PortalException, SystemException {
902
903 ExpandoTable table = expandoTableLocalService.getTable(
904 companyId, classNameId, tableName);
905
906 List<ExpandoColumn> columns = expandoColumnLocalService.getColumns(
907 table.getTableId(), attributes.keySet());
908
909 ExpandoValue value = new ExpandoValueImpl();
910
911 value.setCompanyId(companyId);
912
913 for (ExpandoColumn column : columns) {
914 Serializable attributeValue = attributes.get(column.getName());
915
916 value.setColumn(column);
917
918 int type = column.getType();
919
920 if (type == ExpandoColumnConstants.BOOLEAN) {
921 value.setBoolean((Boolean)attributeValue);
922 }
923 else if (type == ExpandoColumnConstants.BOOLEAN_ARRAY) {
924 value.setBooleanArray((boolean[])attributeValue);
925 }
926 else if (type == ExpandoColumnConstants.DATE) {
927 value.setDate((Date)attributeValue);
928 }
929 else if (type == ExpandoColumnConstants.DATE_ARRAY) {
930 value.setDateArray((Date[])attributeValue);
931 }
932 else if (type == ExpandoColumnConstants.DOUBLE) {
933 value.setDouble((Double)attributeValue);
934 }
935 else if (type == ExpandoColumnConstants.DOUBLE_ARRAY) {
936 value.setDoubleArray((double[])attributeValue);
937 }
938 else if (type == ExpandoColumnConstants.FLOAT) {
939 value.setFloat((Float)attributeValue);
940 }
941 else if (type == ExpandoColumnConstants.FLOAT_ARRAY) {
942 value.setFloatArray((float[])attributeValue);
943 }
944 else if (type == ExpandoColumnConstants.INTEGER) {
945 value.setInteger((Integer)attributeValue);
946 }
947 else if (type == ExpandoColumnConstants.INTEGER_ARRAY) {
948 value.setIntegerArray((int[])attributeValue);
949 }
950 else if (type == ExpandoColumnConstants.LONG) {
951 value.setLong((Long)attributeValue);
952 }
953 else if (type == ExpandoColumnConstants.LONG_ARRAY) {
954 value.setLongArray((long[])attributeValue);
955 }
956 else if (type == ExpandoColumnConstants.NUMBER) {
957 value.setNumber((Number)attributeValue);
958 }
959 else if (type == ExpandoColumnConstants.NUMBER_ARRAY) {
960 value.setNumberArray((Number[])attributeValue);
961 }
962 else if (type == ExpandoColumnConstants.SHORT) {
963 value.setShort((Short)attributeValue);
964 }
965 else if (type == ExpandoColumnConstants.SHORT_ARRAY) {
966 value.setShortArray((short[])attributeValue);
967 }
968 else if (type == ExpandoColumnConstants.STRING_ARRAY) {
969 value.setStringArray((String[])attributeValue);
970 }
971 else {
972 value.setString((String)attributeValue);
973 }
974
975 doAddValue(
976 companyId, classNameId, table.getTableId(),
977 column.getColumnId(), classPK, value.getData());
978 }
979 }
980
981 @Override
982 public void addValues(
983 long companyId, String className, String tableName, long classPK,
984 Map<String, Serializable> attributes)
985 throws PortalException, SystemException {
986
987 long classNameId = PortalUtil.getClassNameId(className);
988
989 addValues(companyId, classNameId, tableName, classPK, attributes);
990 }
991
992 @Override
993 public void deleteColumnValues(long columnId) throws SystemException {
994 List<ExpandoValue> values = expandoValuePersistence.findByColumnId(
995 columnId);
996
997 for (ExpandoValue value : values) {
998 deleteValue(value);
999 }
1000 }
1001
1002 @Override
1003 public void deleteRowValues(long rowId) throws SystemException {
1004 List<ExpandoValue> values = expandoValuePersistence.findByRowId(rowId);
1005
1006 for (ExpandoValue value : values) {
1007 deleteValue(value);
1008 }
1009 }
1010
1011 @Override
1012 public void deleteTableValues(long tableId) throws SystemException {
1013 List<ExpandoValue> values = expandoValuePersistence.findByTableId(
1014 tableId);
1015
1016 for (ExpandoValue value : values) {
1017 deleteValue(value);
1018 }
1019 }
1020
1021 @Override
1022 public void deleteValue(ExpandoValue value) throws SystemException {
1023 expandoValuePersistence.remove(value);
1024 }
1025
1026 @Override
1027 public void deleteValue(long valueId)
1028 throws PortalException, SystemException {
1029
1030 ExpandoValue value = expandoValuePersistence.findByPrimaryKey(valueId);
1031
1032 deleteValue(value);
1033 }
1034
1035 @Override
1036 public void deleteValue(long columnId, long rowId)
1037 throws PortalException, SystemException {
1038
1039 ExpandoValue value = expandoValuePersistence.findByC_R(columnId, rowId);
1040
1041 deleteValue(value);
1042 }
1043
1044 @Override
1045 public void deleteValue(
1046 long companyId, long classNameId, String tableName,
1047 String columnName, long classPK)
1048 throws PortalException, SystemException {
1049
1050 ExpandoTable table = expandoTablePersistence.fetchByC_C_N(
1051 companyId, classNameId, tableName);
1052
1053 if (table == null) {
1054 return;
1055 }
1056
1057 List<ExpandoColumn> columns = expandoColumnPersistence.findByT_N(
1058 table.getTableId(), columnName);
1059
1060 if (columns.isEmpty()) {
1061 return;
1062 }
1063
1064 ExpandoColumn column = columns.get(0);
1065
1066 ExpandoValue value = expandoValuePersistence.fetchByT_C_C(
1067 table.getTableId(), column.getColumnId(), classPK);
1068
1069 if (value != null) {
1070 deleteValue(value.getValueId());
1071 }
1072 }
1073
1074 @Override
1075 public void deleteValue(
1076 long companyId, String className, String tableName,
1077 String columnName, long classPK)
1078 throws PortalException, SystemException {
1079
1080 long classNameId = PortalUtil.getClassNameId(className);
1081
1082 expandoValueLocalService.deleteValue(
1083 companyId, classNameId, tableName, columnName, classPK);
1084 }
1085
1086 @Override
1087 public void deleteValues(long classNameId, long classPK)
1088 throws SystemException {
1089
1090 List<ExpandoValue> values = expandoValuePersistence.findByC_C(
1091 classNameId, classPK);
1092
1093 for (ExpandoValue value : values) {
1094 deleteValue(value);
1095 }
1096 }
1097
1098 @Override
1099 public void deleteValues(String className, long classPK)
1100 throws SystemException {
1101
1102 long classNameId = PortalUtil.getClassNameId(className);
1103
1104 expandoValueLocalService.deleteValues(classNameId, classPK);
1105 }
1106
1107 @Override
1108 public List<ExpandoValue> getColumnValues(long columnId, int start, int end)
1109 throws SystemException {
1110
1111 return expandoValuePersistence.findByColumnId(columnId, start, end);
1112 }
1113
1114 @Override
1115 public List<ExpandoValue> getColumnValues(
1116 long companyId, long classNameId, String tableName,
1117 String columnName, int start, int end)
1118 throws SystemException {
1119
1120 return expandoValueLocalService.getColumnValues(
1121 companyId, classNameId, tableName, columnName, null, start, end);
1122 }
1123
1124 @Override
1125 public List<ExpandoValue> getColumnValues(
1126 long companyId, long classNameId, String tableName,
1127 String columnName, String data, int start, int end)
1128 throws SystemException {
1129
1130 ExpandoTable table = expandoTablePersistence.fetchByC_C_N(
1131 companyId, classNameId, tableName);
1132
1133 if (table == null) {
1134 return Collections.emptyList();
1135 }
1136
1137 List<ExpandoColumn> columns = expandoColumnPersistence.findByT_N(
1138 table.getTableId(), columnName);
1139
1140 if (columns.isEmpty()) {
1141 return Collections.emptyList();
1142 }
1143
1144 ExpandoColumn column = columns.get(0);
1145
1146 if (data == null) {
1147 return expandoValuePersistence.findByT_C(
1148 table.getTableId(), column.getColumnId(), start, end);
1149 }
1150 else {
1151 return expandoValuePersistence.findByT_C_D(
1152 table.getTableId(), column.getColumnId(), data, start, end);
1153 }
1154 }
1155
1156 @Override
1157 public List<ExpandoValue> getColumnValues(
1158 long companyId, String className, String tableName,
1159 String columnName, int start, int end)
1160 throws SystemException {
1161
1162 long classNameId = PortalUtil.getClassNameId(className);
1163
1164 return expandoValueLocalService.getColumnValues(
1165 companyId, classNameId, tableName, columnName, start, end);
1166 }
1167
1168 @Override
1169 public List<ExpandoValue> getColumnValues(
1170 long companyId, String className, String tableName,
1171 String columnName, String data, int start, int end)
1172 throws SystemException {
1173
1174 long classNameId = PortalUtil.getClassNameId(className);
1175
1176 return expandoValueLocalService.getColumnValues(
1177 companyId, classNameId, tableName, columnName, data, start, end);
1178 }
1179
1180
1184 @Override
1185 public List<ExpandoValue> getColumnValues(
1186 String className, String tableName, String columnName, String data,
1187 int start, int end)
1188 throws SystemException {
1189
1190 long companyId = CompanyThreadLocal.getCompanyId();
1191
1192 return expandoValueLocalService.getColumnValues(
1193 companyId, className, tableName, columnName, data, start, end);
1194 }
1195
1196 @Override
1197 public int getColumnValuesCount(long columnId) throws SystemException {
1198 return expandoValuePersistence.countByColumnId(columnId);
1199 }
1200
1201 @Override
1202 public int getColumnValuesCount(
1203 long companyId, long classNameId, String tableName,
1204 String columnName)
1205 throws SystemException {
1206
1207 return expandoValueLocalService.getColumnValuesCount(
1208 companyId, classNameId, tableName, columnName, null);
1209 }
1210
1211 @Override
1212 public int getColumnValuesCount(
1213 long companyId, long classNameId, String tableName,
1214 String columnName, String data)
1215 throws SystemException {
1216
1217 ExpandoTable table = expandoTablePersistence.fetchByC_C_N(
1218 companyId, classNameId, tableName);
1219
1220 if (table == null) {
1221 return 0;
1222 }
1223
1224 List<ExpandoColumn> columns = expandoColumnPersistence.findByT_N(
1225 table.getTableId(), columnName);
1226
1227 if (columns.isEmpty()) {
1228 return 0;
1229 }
1230
1231 ExpandoColumn column = columns.get(0);
1232
1233 if (data == null) {
1234 return expandoValuePersistence.countByT_C(
1235 table.getTableId(), column.getColumnId());
1236 }
1237 else {
1238 return expandoValuePersistence.countByT_C_D(
1239 table.getTableId(), column.getColumnId(), data);
1240 }
1241 }
1242
1243 @Override
1244 public int getColumnValuesCount(
1245 long companyId, String className, String tableName,
1246 String columnName)
1247 throws SystemException {
1248
1249 long classNameId = PortalUtil.getClassNameId(className);
1250
1251 return expandoValueLocalService.getColumnValuesCount(
1252 companyId, classNameId, tableName, columnName);
1253 }
1254
1255 @Override
1256 public int getColumnValuesCount(
1257 long companyId, String className, String tableName,
1258 String columnName, String data)
1259 throws SystemException {
1260
1261 long classNameId = PortalUtil.getClassNameId(className);
1262
1263 return expandoValueLocalService.getColumnValuesCount(
1264 companyId, classNameId, tableName, columnName, data);
1265 }
1266
1267
1271 @Override
1272 public int getColumnValuesCount(
1273 String className, String tableName, String columnName, String data)
1274 throws SystemException {
1275
1276 long companyId = CompanyThreadLocal.getCompanyId();
1277
1278 return expandoValueLocalService.getColumnValuesCount(
1279 companyId, className, tableName, columnName, data);
1280 }
1281
1282 @Override
1283 public Map<String, Serializable> getData(
1284 long companyId, String className, String tableName,
1285 Collection<String> columnNames, long classPK)
1286 throws PortalException, SystemException {
1287
1288 List<ExpandoColumn> columns = expandoColumnLocalService.getColumns(
1289 companyId, className, tableName, columnNames);
1290
1291 Map<String, Serializable> attributeValues =
1292 new HashMap<String, Serializable>((int)(columnNames.size() * 1.4));
1293
1294 ExpandoValue value = new ExpandoValueImpl();
1295
1296 for (ExpandoColumn column : columns) {
1297 value.setColumn(column);
1298 value.setData(column.getDefaultData());
1299
1300 Serializable attributeValue = doGetData(
1301 companyId, className, tableName, column.getName(), classPK,
1302 value, column.getType());
1303
1304 attributeValues.put(column.getName(), attributeValue);
1305 }
1306
1307 return attributeValues;
1308 }
1309
1310 @Override
1311 public Serializable getData(
1312 long companyId, String className, String tableName,
1313 String columnName, long classPK)
1314 throws PortalException, SystemException {
1315
1316 ExpandoColumn column = expandoColumnLocalService.getColumn(
1317 companyId, className, tableName, columnName);
1318
1319 ExpandoValue value = new ExpandoValueImpl();
1320
1321 value.setColumn(column);
1322 value.setData(column.getDefaultData());
1323
1324 return doGetData(
1325 companyId, className, tableName, columnName, classPK, value,
1326 column.getType());
1327 }
1328
1329 @Override
1330 public boolean getData(
1331 long companyId, String className, String tableName,
1332 String columnName, long classPK, boolean defaultData)
1333 throws PortalException, SystemException {
1334
1335 ExpandoValue value = expandoValueLocalService.getValue(
1336 companyId, className, tableName, columnName, classPK);
1337
1338 if (value == null) {
1339 return defaultData;
1340 }
1341 else {
1342 return value.getBoolean();
1343 }
1344 }
1345
1346 @Override
1347 public boolean[] getData(
1348 long companyId, String className, String tableName,
1349 String columnName, long classPK, boolean[] defaultData)
1350 throws PortalException, SystemException {
1351
1352 ExpandoValue value = expandoValueLocalService.getValue(
1353 companyId, className, tableName, columnName, classPK);
1354
1355 if (value == null) {
1356 return defaultData;
1357 }
1358 else {
1359 return value.getBooleanArray();
1360 }
1361 }
1362
1363 @Override
1364 public Date getData(
1365 long companyId, String className, String tableName,
1366 String columnName, long classPK, Date defaultData)
1367 throws PortalException, SystemException {
1368
1369 ExpandoValue value = expandoValueLocalService.getValue(
1370 companyId, className, tableName, columnName, classPK);
1371
1372 if (value == null) {
1373 return defaultData;
1374 }
1375 else {
1376 return value.getDate();
1377 }
1378 }
1379
1380 @Override
1381 public Date[] getData(
1382 long companyId, String className, String tableName,
1383 String columnName, long classPK, Date[] defaultData)
1384 throws PortalException, SystemException {
1385
1386 ExpandoValue value = expandoValueLocalService.getValue(
1387 companyId, className, tableName, columnName, classPK);
1388
1389 if (value == null) {
1390 return defaultData;
1391 }
1392 else {
1393 return value.getDateArray();
1394 }
1395 }
1396
1397 @Override
1398 public double getData(
1399 long companyId, String className, String tableName,
1400 String columnName, long classPK, double defaultData)
1401 throws PortalException, SystemException {
1402
1403 ExpandoValue value = expandoValueLocalService.getValue(
1404 companyId, className, tableName, columnName, classPK);
1405
1406 if (value == null) {
1407 return defaultData;
1408 }
1409 else {
1410 return value.getDouble();
1411 }
1412 }
1413
1414 @Override
1415 public double[] getData(
1416 long companyId, String className, String tableName,
1417 String columnName, long classPK, double[] defaultData)
1418 throws PortalException, SystemException {
1419
1420 ExpandoValue value = expandoValueLocalService.getValue(
1421 companyId, className, tableName, columnName, classPK);
1422
1423 if (value == null) {
1424 return defaultData;
1425 }
1426 else {
1427 return value.getDoubleArray();
1428 }
1429 }
1430
1431 @Override
1432 public float getData(
1433 long companyId, String className, String tableName,
1434 String columnName, long classPK, float defaultData)
1435 throws PortalException, SystemException {
1436
1437 ExpandoValue value = expandoValueLocalService.getValue(
1438 companyId, className, tableName, columnName, classPK);
1439
1440 if (value == null) {
1441 return defaultData;
1442 }
1443 else {
1444 return value.getFloat();
1445 }
1446 }
1447
1448 @Override
1449 public float[] getData(
1450 long companyId, String className, String tableName,
1451 String columnName, long classPK, float[] defaultData)
1452 throws PortalException, SystemException {
1453
1454 ExpandoValue value = expandoValueLocalService.getValue(
1455 companyId, className, tableName, columnName, classPK);
1456
1457 if (value == null) {
1458 return defaultData;
1459 }
1460 else {
1461 return value.getFloatArray();
1462 }
1463 }
1464
1465 @Override
1466 public int getData(
1467 long companyId, String className, String tableName,
1468 String columnName, long classPK, int defaultData)
1469 throws PortalException, SystemException {
1470
1471 ExpandoValue value = expandoValueLocalService.getValue(
1472 companyId, className, tableName, columnName, classPK);
1473
1474 if (value == null) {
1475 return defaultData;
1476 }
1477 else {
1478 return value.getInteger();
1479 }
1480 }
1481
1482 @Override
1483 public int[] getData(
1484 long companyId, String className, String tableName,
1485 String columnName, long classPK, int[] defaultData)
1486 throws PortalException, SystemException {
1487
1488 ExpandoValue value = expandoValueLocalService.getValue(
1489 companyId, className, tableName, columnName, classPK);
1490
1491 if (value == null) {
1492 return defaultData;
1493 }
1494 else {
1495 return value.getIntegerArray();
1496 }
1497 }
1498
1499 @Override
1500 public long getData(
1501 long companyId, String className, String tableName,
1502 String columnName, long classPK, long defaultData)
1503 throws PortalException, SystemException {
1504
1505 ExpandoValue value = expandoValueLocalService.getValue(
1506 companyId, className, tableName, columnName, classPK);
1507
1508 if (value == null) {
1509 return defaultData;
1510 }
1511 else {
1512 return value.getLong();
1513 }
1514 }
1515
1516 @Override
1517 public long[] getData(
1518 long companyId, String className, String tableName,
1519 String columnName, long classPK, long[] defaultData)
1520 throws PortalException, SystemException {
1521
1522 ExpandoValue value = expandoValueLocalService.getValue(
1523 companyId, className, tableName, columnName, classPK);
1524
1525 if (value == null) {
1526 return defaultData;
1527 }
1528 else {
1529 return value.getLongArray();
1530 }
1531 }
1532
1533 @Override
1534 public Number getData(
1535 long companyId, String className, String tableName,
1536 String columnName, long classPK, Number defaultData)
1537 throws PortalException, SystemException {
1538
1539 ExpandoValue value = expandoValueLocalService.getValue(
1540 companyId, className, tableName, columnName, classPK);
1541
1542 if (value == null) {
1543 return defaultData;
1544 }
1545 else {
1546 return value.getNumber();
1547 }
1548 }
1549
1550 @Override
1551 public Number[] getData(
1552 long companyId, String className, String tableName,
1553 String columnName, long classPK, Number[] defaultData)
1554 throws PortalException, SystemException {
1555
1556 ExpandoValue value = expandoValueLocalService.getValue(
1557 companyId, className, tableName, columnName, classPK);
1558
1559 if (value == null) {
1560 return defaultData;
1561 }
1562 else {
1563 return value.getNumberArray();
1564 }
1565 }
1566
1567 @Override
1568 public short getData(
1569 long companyId, String className, String tableName,
1570 String columnName, long classPK, short defaultData)
1571 throws PortalException, SystemException {
1572
1573 ExpandoValue value = expandoValueLocalService.getValue(
1574 companyId, className, tableName, columnName, classPK);
1575
1576 if (value == null) {
1577 return defaultData;
1578 }
1579 else {
1580 return value.getShort();
1581 }
1582 }
1583
1584 @Override
1585 public short[] getData(
1586 long companyId, String className, String tableName,
1587 String columnName, long classPK, short[] defaultData)
1588 throws PortalException, SystemException {
1589
1590 ExpandoValue value = expandoValueLocalService.getValue(
1591 companyId, className, tableName, columnName, classPK);
1592
1593 if (value == null) {
1594 return defaultData;
1595 }
1596 else {
1597 return value.getShortArray();
1598 }
1599 }
1600
1601 @Override
1602 public String getData(
1603 long companyId, String className, String tableName,
1604 String columnName, long classPK, String defaultData)
1605 throws PortalException, SystemException {
1606
1607 ExpandoValue value = expandoValueLocalService.getValue(
1608 companyId, className, tableName, columnName, classPK);
1609
1610 if (value == null) {
1611 return defaultData;
1612 }
1613 else {
1614 return value.getString();
1615 }
1616 }
1617
1618 @Override
1619 public String[] getData(
1620 long companyId, String className, String tableName,
1621 String columnName, long classPK, String[] defaultData)
1622 throws PortalException, SystemException {
1623
1624 ExpandoValue value = expandoValueLocalService.getValue(
1625 companyId, className, tableName, columnName, classPK);
1626
1627 if (value == null) {
1628 return defaultData;
1629 }
1630 else {
1631 return value.getStringArray();
1632 }
1633 }
1634
1635
1638 @Override
1639 public Serializable getData(
1640 String className, String tableName, String columnName, long classPK)
1641 throws PortalException, SystemException {
1642
1643 long companyId = CompanyThreadLocal.getCompanyId();
1644
1645 return expandoValueLocalService.getData(
1646 companyId, className, tableName, columnName, classPK);
1647 }
1648
1649
1653 @Override
1654 public boolean getData(
1655 String className, String tableName, String columnName, long classPK,
1656 boolean defaultData)
1657 throws PortalException, SystemException {
1658
1659 long companyId = CompanyThreadLocal.getCompanyId();
1660
1661 return expandoValueLocalService.getData(
1662 companyId, className, tableName, columnName, classPK, defaultData);
1663 }
1664
1665
1669 @Override
1670 public boolean[] getData(
1671 String className, String tableName, String columnName, long classPK,
1672 boolean[] defaultData)
1673 throws PortalException, SystemException {
1674
1675 long companyId = CompanyThreadLocal.getCompanyId();
1676
1677 return expandoValueLocalService.getData(
1678 companyId, className, tableName, columnName, classPK, defaultData);
1679 }
1680
1681
1684 @Override
1685 public Date getData(
1686 String className, String tableName, String columnName, long classPK,
1687 Date defaultData)
1688 throws PortalException, SystemException {
1689
1690 long companyId = CompanyThreadLocal.getCompanyId();
1691
1692 return expandoValueLocalService.getData(
1693 companyId, className, tableName, columnName, classPK, defaultData);
1694 }
1695
1696
1699 @Override
1700 public Date[] getData(
1701 String className, String tableName, String columnName, long classPK,
1702 Date[] defaultData)
1703 throws PortalException, SystemException {
1704
1705 long companyId = CompanyThreadLocal.getCompanyId();
1706
1707 return expandoValueLocalService.getData(
1708 companyId, className, tableName, columnName, classPK, defaultData);
1709 }
1710
1711
1715 @Override
1716 public double getData(
1717 String className, String tableName, String columnName, long classPK,
1718 double defaultData)
1719 throws PortalException, SystemException {
1720
1721 long companyId = CompanyThreadLocal.getCompanyId();
1722
1723 return expandoValueLocalService.getData(
1724 companyId, className, tableName, columnName, classPK, defaultData);
1725 }
1726
1727
1731 @Override
1732 public double[] getData(
1733 String className, String tableName, String columnName, long classPK,
1734 double[] defaultData)
1735 throws PortalException, SystemException {
1736
1737 long companyId = CompanyThreadLocal.getCompanyId();
1738
1739 return expandoValueLocalService.getData(
1740 companyId, className, tableName, columnName, classPK, defaultData);
1741 }
1742
1743
1746 @Override
1747 public float getData(
1748 String className, String tableName, String columnName, long classPK,
1749 float defaultData)
1750 throws PortalException, SystemException {
1751
1752 long companyId = CompanyThreadLocal.getCompanyId();
1753
1754 return expandoValueLocalService.getData(
1755 companyId, className, tableName, columnName, classPK, defaultData);
1756 }
1757
1758
1761 @Override
1762 public float[] getData(
1763 String className, String tableName, String columnName, long classPK,
1764 float[] defaultData)
1765 throws PortalException, SystemException {
1766
1767 long companyId = CompanyThreadLocal.getCompanyId();
1768
1769 return expandoValueLocalService.getData(
1770 companyId, className, tableName, columnName, classPK, defaultData);
1771 }
1772
1773
1776 @Override
1777 public int getData(
1778 String className, String tableName, String columnName, long classPK,
1779 int defaultData)
1780 throws PortalException, SystemException {
1781
1782 long companyId = CompanyThreadLocal.getCompanyId();
1783
1784 return expandoValueLocalService.getData(
1785 companyId, className, tableName, columnName, classPK, defaultData);
1786 }
1787
1788
1791 @Override
1792 public int[] getData(
1793 String className, String tableName, String columnName, long classPK,
1794 int[] defaultData)
1795 throws PortalException, SystemException {
1796
1797 long companyId = CompanyThreadLocal.getCompanyId();
1798
1799 return expandoValueLocalService.getData(
1800 companyId, className, tableName, columnName, classPK, defaultData);
1801 }
1802
1803
1806 @Override
1807 public long getData(
1808 String className, String tableName, String columnName, long classPK,
1809 long defaultData)
1810 throws PortalException, SystemException {
1811
1812 long companyId = CompanyThreadLocal.getCompanyId();
1813
1814 return expandoValueLocalService.getData(
1815 companyId, className, tableName, columnName, classPK, defaultData);
1816 }
1817
1818
1821 @Override
1822 public long[] getData(
1823 String className, String tableName, String columnName, long classPK,
1824 long[] defaultData)
1825 throws PortalException, SystemException {
1826
1827 long companyId = CompanyThreadLocal.getCompanyId();
1828
1829 return expandoValueLocalService.getData(
1830 companyId, className, tableName, columnName, classPK, defaultData);
1831 }
1832
1833
1836 @Override
1837 public short getData(
1838 String className, String tableName, String columnName, long classPK,
1839 short defaultData)
1840 throws PortalException, SystemException {
1841
1842 long companyId = CompanyThreadLocal.getCompanyId();
1843
1844 return expandoValueLocalService.getData(
1845 companyId, className, tableName, columnName, classPK, defaultData);
1846 }
1847
1848
1851 @Override
1852 public short[] getData(
1853 String className, String tableName, String columnName, long classPK,
1854 short[] defaultData)
1855 throws PortalException, SystemException {
1856
1857 long companyId = CompanyThreadLocal.getCompanyId();
1858
1859 return expandoValueLocalService.getData(
1860 companyId, className, tableName, columnName, classPK, defaultData);
1861 }
1862
1863
1867 @Override
1868 public String getData(
1869 String className, String tableName, String columnName, long classPK,
1870 String defaultData)
1871 throws PortalException, SystemException {
1872
1873 long companyId = CompanyThreadLocal.getCompanyId();
1874
1875 return expandoValueLocalService.getData(
1876 companyId, className, tableName, columnName, classPK, defaultData);
1877 }
1878
1879
1883 @Override
1884 public String[] getData(
1885 String className, String tableName, String columnName, long classPK,
1886 String[] defaultData)
1887 throws PortalException, SystemException {
1888
1889 long companyId = CompanyThreadLocal.getCompanyId();
1890
1891 return expandoValueLocalService.getData(
1892 companyId, className, tableName, columnName, classPK, defaultData);
1893 }
1894
1895 @Override
1896 public List<ExpandoValue> getDefaultTableColumnValues(
1897 long companyId, long classNameId, String columnName, int start,
1898 int end)
1899 throws SystemException {
1900
1901 return expandoValueLocalService.getColumnValues(
1902 companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME,
1903 columnName, start, end);
1904 }
1905
1906 @Override
1907 public List<ExpandoValue> getDefaultTableColumnValues(
1908 long companyId, String className, String columnName, int start,
1909 int end)
1910 throws SystemException {
1911
1912 long classNameId = PortalUtil.getClassNameId(className);
1913
1914 return expandoValueLocalService.getDefaultTableColumnValues(
1915 companyId, classNameId, columnName, start, end);
1916 }
1917
1918 @Override
1919 public int getDefaultTableColumnValuesCount(
1920 long companyId, long classNameId, String columnName)
1921 throws SystemException {
1922
1923 return expandoValueLocalService.getColumnValuesCount(
1924 companyId, classNameId, ExpandoTableConstants.DEFAULT_TABLE_NAME,
1925 columnName);
1926 }
1927
1928 @Override
1929 public int getDefaultTableColumnValuesCount(
1930 long companyId, String className, String columnName)
1931 throws SystemException {
1932
1933 long classNameId = PortalUtil.getClassNameId(className);
1934
1935 return expandoValueLocalService.getDefaultTableColumnValuesCount(
1936 companyId, classNameId, columnName);
1937 }
1938
1939 @Override
1940 public List<ExpandoValue> getRowValues(long rowId) throws SystemException {
1941 return expandoValuePersistence.findByRowId(rowId);
1942 }
1943
1944 @Override
1945 public List<ExpandoValue> getRowValues(long rowId, int start, int end)
1946 throws SystemException {
1947
1948 return expandoValuePersistence.findByRowId(rowId, start, end);
1949 }
1950
1951 @Override
1952 public List<ExpandoValue> getRowValues(
1953 long companyId, long classNameId, String tableName, long classPK,
1954 int start, int end)
1955 throws SystemException {
1956
1957 ExpandoTable table = expandoTablePersistence.fetchByC_C_N(
1958 companyId, classNameId, tableName);
1959
1960 if (table == null) {
1961 return Collections.emptyList();
1962 }
1963
1964 return expandoValuePersistence.findByT_CPK(
1965 table.getTableId(), classPK, start, end);
1966 }
1967
1968 @Override
1969 public List<ExpandoValue> getRowValues(
1970 long companyId, String className, String tableName, long classPK,
1971 int start, int end)
1972 throws SystemException {
1973
1974 long classNameId = PortalUtil.getClassNameId(className);
1975
1976 return expandoValueLocalService.getRowValues(
1977 companyId, classNameId, tableName, classPK, start, end);
1978 }
1979
1980 @Override
1981 public int getRowValuesCount(long rowId) throws SystemException {
1982 return expandoValuePersistence.countByRowId(rowId);
1983 }
1984
1985 @Override
1986 public int getRowValuesCount(
1987 long companyId, long classNameId, String tableName, long classPK)
1988 throws SystemException {
1989
1990 ExpandoTable table = expandoTablePersistence.fetchByC_C_N(
1991 companyId, classNameId, tableName);
1992
1993 if (table == null) {
1994 return 0;
1995 }
1996
1997 return expandoValuePersistence.countByT_CPK(
1998 table.getTableId(), classPK);
1999 }
2000
2001 @Override
2002 public int getRowValuesCount(
2003 long companyId, String className, String tableName, long classPK)
2004 throws SystemException {
2005
2006 long classNameId = PortalUtil.getClassNameId(className);
2007
2008 return expandoValueLocalService.getRowValuesCount(
2009 companyId, classNameId, tableName, classPK);
2010 }
2011
2012 @Override
2013 public ExpandoValue getValue(long valueId)
2014 throws PortalException, SystemException {
2015
2016 return expandoValuePersistence.findByPrimaryKey(valueId);
2017 }
2018
2019 @Override
2020 public ExpandoValue getValue(long columnId, long rowId)
2021 throws PortalException, SystemException {
2022
2023 return expandoValuePersistence.findByC_R(columnId, rowId);
2024 }
2025
2026 @Override
2027 public ExpandoValue getValue(long tableId, long columnId, long classPK)
2028 throws SystemException {
2029
2030 return expandoValuePersistence.fetchByT_C_C(tableId, columnId, classPK);
2031 }
2032
2033 @Override
2034 public ExpandoValue getValue(
2035 long companyId, long classNameId, String tableName,
2036 String columnName, long classPK)
2037 throws SystemException {
2038
2039 ExpandoTable table = expandoTablePersistence.fetchByC_C_N(
2040 companyId, classNameId, tableName);
2041
2042 if (table == null) {
2043 return null;
2044 }
2045
2046 List<ExpandoColumn> columns = expandoColumnPersistence.findByT_N(
2047 table.getTableId(), columnName);
2048
2049 if (columns.isEmpty()) {
2050 return null;
2051 }
2052
2053 ExpandoColumn column = columns.get(0);
2054
2055 return expandoValuePersistence.fetchByT_C_C(
2056 table.getTableId(), column.getColumnId(), classPK);
2057 }
2058
2059
2062 @Override
2063 public ExpandoValue getValue(
2064 long classNameId, String tableName, String columnName, long classPK)
2065 throws SystemException {
2066
2067 long companyId = CompanyThreadLocal.getCompanyId();
2068
2069 return expandoValueLocalService.getValue(
2070 companyId, classNameId, tableName, columnName, classPK);
2071 }
2072
2073 @Override
2074 public ExpandoValue getValue(
2075 long companyId, String className, String tableName,
2076 String columnName, long classPK)
2077 throws SystemException {
2078
2079 long classNameId = PortalUtil.getClassNameId(className);
2080
2081 return expandoValueLocalService.getValue(
2082 companyId, classNameId, tableName, columnName, classPK);
2083 }
2084
2085
2088 @Override
2089 public ExpandoValue getValue(
2090 String className, String tableName, String columnName, long classPK)
2091 throws SystemException {
2092
2093 long companyId = CompanyThreadLocal.getCompanyId();
2094
2095 return expandoValueLocalService.getValue(
2096 companyId, className, tableName, columnName, classPK);
2097 }
2098
2099 protected ExpandoValue doAddValue(
2100 long companyId, long classNameId, long tableId, long columnId,
2101 long classPK, String data)
2102 throws SystemException {
2103
2104 ExpandoRow row = expandoRowPersistence.fetchByT_C(tableId, classPK);
2105
2106 if (row == null) {
2107 long rowId = counterLocalService.increment();
2108
2109 row = expandoRowPersistence.create(rowId);
2110
2111 row.setCompanyId(companyId);
2112 row.setTableId(tableId);
2113 row.setClassPK(classPK);
2114
2115 expandoRowPersistence.update(row, false);
2116 }
2117
2118 ExpandoValue value = expandoValuePersistence.fetchByC_R(
2119 columnId, row.getRowId());
2120
2121 if (value == null) {
2122 long valueId = counterLocalService.increment();
2123
2124 value = expandoValuePersistence.create(valueId);
2125
2126 value.setCompanyId(companyId);
2127 value.setTableId(tableId);
2128 value.setColumnId(columnId);
2129 value.setRowId(row.getRowId());
2130 value.setClassNameId(classNameId);
2131 value.setClassPK(classPK);
2132 }
2133
2134 value.setData(data);
2135
2136 expandoValuePersistence.update(value, false);
2137
2138 return value;
2139 }
2140
2141 protected Serializable doGetData(
2142 long companyId, String className, String tableName,
2143 String columnName, long classPK, ExpandoValue value, int type)
2144 throws PortalException, SystemException {
2145
2146 if (type == ExpandoColumnConstants.BOOLEAN) {
2147 return expandoValueLocalService.getData(
2148 companyId, className, tableName, columnName, classPK,
2149 value.getBoolean());
2150 }
2151 else if (type == ExpandoColumnConstants.BOOLEAN_ARRAY) {
2152 return expandoValueLocalService.getData(
2153 companyId, className, tableName, columnName, classPK,
2154 new boolean[0]);
2155 }
2156 else if (type == ExpandoColumnConstants.DATE) {
2157 return expandoValueLocalService.getData(
2158 companyId, className, tableName, columnName, classPK,
2159 value.getDate());
2160 }
2161 else if (type == ExpandoColumnConstants.DATE_ARRAY) {
2162 return expandoValueLocalService.getData(
2163 companyId, className, tableName, columnName, classPK,
2164 new Date[0]);
2165 }
2166 else if (type == ExpandoColumnConstants.DOUBLE) {
2167 return expandoValueLocalService.getData(
2168 companyId, className, tableName, columnName, classPK,
2169 value.getDouble());
2170 }
2171 else if (type == ExpandoColumnConstants.DOUBLE_ARRAY) {
2172 return expandoValueLocalService.getData(
2173 companyId, className, tableName, columnName, classPK,
2174 new double[0]);
2175 }
2176 else if (type == ExpandoColumnConstants.FLOAT) {
2177 return expandoValueLocalService.getData(
2178 companyId, className, tableName, columnName, classPK,
2179 value.getFloat());
2180 }
2181 else if (type == ExpandoColumnConstants.FLOAT_ARRAY) {
2182 return expandoValueLocalService.getData(
2183 companyId, className, tableName, columnName, classPK,
2184 new float[0]);
2185 }
2186 else if (type == ExpandoColumnConstants.INTEGER) {
2187 return expandoValueLocalService.getData(
2188 companyId, className, tableName, columnName, classPK,
2189 value.getInteger());
2190 }
2191 else if (type == ExpandoColumnConstants.INTEGER_ARRAY) {
2192 return expandoValueLocalService.getData(
2193 companyId, className, tableName, columnName, classPK,
2194 new int[0]);
2195 }
2196 else if (type == ExpandoColumnConstants.LONG) {
2197 return expandoValueLocalService.getData(
2198 companyId, className, tableName, columnName, classPK,
2199 value.getLong());
2200 }
2201 else if (type == ExpandoColumnConstants.LONG_ARRAY) {
2202 return expandoValueLocalService.getData(
2203 companyId, className, tableName, columnName, classPK,
2204 new long[0]);
2205 }
2206 else if (type == ExpandoColumnConstants.NUMBER) {
2207 return expandoValueLocalService.getData(
2208 companyId, className, tableName, columnName, classPK,
2209 value.getNumber());
2210 }
2211 else if (type == ExpandoColumnConstants.NUMBER_ARRAY) {
2212 return expandoValueLocalService.getData(
2213 companyId, className, tableName, columnName, classPK,
2214 new Number[0]);
2215 }
2216 else if (type == ExpandoColumnConstants.SHORT) {
2217 return expandoValueLocalService.getData(
2218 companyId, className, tableName, columnName, classPK,
2219 value.getShort());
2220 }
2221 else if (type == ExpandoColumnConstants.SHORT_ARRAY) {
2222 return expandoValueLocalService.getData(
2223 companyId, className, tableName, columnName, classPK,
2224 new short[0]);
2225 }
2226 else if (type == ExpandoColumnConstants.STRING_ARRAY) {
2227 return expandoValueLocalService.getData(
2228 companyId, className, tableName, columnName, classPK,
2229 new String[0]);
2230 }
2231 else {
2232 return expandoValueLocalService.getData(
2233 companyId, className, tableName, columnName, classPK,
2234 value.getString());
2235 }
2236 }
2237
2238 }