Subversion Repositories SmartDukaan

Rev

Rev 204 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 204 Rev 206
Line 431... Line 431...
431
				new ExpandedFeatureDefinition(featureDef);
431
				new ExpandedFeatureDefinition(featureDef);
432
			
432
			
433
			ExpandedBulletDefinition expBulletDef = 
433
			ExpandedBulletDefinition expBulletDef = 
434
				expFeatureDef.getExpandedBulletDefinition();
434
				expFeatureDef.getExpandedBulletDefinition();
435
			
435
			
-
 
436
			// Collect unit
-
 
437
			String[] unitIDs = this.reqparams.get(featureDefIDString + "_unit");
-
 
438
			long unitID = 0L;
-
 
439
			if(unitIDs != null && unitIDs.length > 0) {
-
 
440
				unitID = Long.parseLong(unitIDs[0]);
-
 
441
			}
-
 
442
			
436
			// Composite
443
			// Composite
437
			if(expBulletDef.isComposite()) {
444
			if(expBulletDef.isComposite()) {
438
				log.info("Composite");
445
				log.info("Composite");
439
				
446
				
440
				CompositeDataObject compositeDataObject = 
447
				CompositeDataObject compositeDataObject = 
Line 456... Line 463...
456
					}
463
					}
457
				}
464
				}
458
				
465
				
459
				Bullet bullet = new Bullet(compositeDataObject);
466
				Bullet bullet = new Bullet(compositeDataObject);
460
				
467
				
-
 
468
				if(unitID != 0L) {
-
 
469
					bullet.setUnitID(unitID);
-
 
470
				}
-
 
471
				
461
				bullets.add(bullet);
472
				bullets.add(bullet);
462
			}
473
			}
463
			
474
			
464
			// Enumerated
475
			// Enumerated
465
			else if(expBulletDef.isEnumerated()) {
476
			else if(expBulletDef.isEnumerated()) {
Line 469... Line 480...
469
				if(bulletValues == null || bulletValues.length == 0) {
480
				if(bulletValues == null || bulletValues.length == 0) {
470
					continue;
481
					continue;
471
				}
482
				}
472
				
483
				
473
				log.info("bulletValues:" + Arrays.toString(bulletValues));
484
				log.info("bulletValues:" + Arrays.toString(bulletValues));
-
 
485
 
474
				
486
				
-
 
487
				for(int i=0;i<bulletValues.length;i++) {
475
				EnumDataObject enumDataObject = 
488
					EnumDataObject enumDataObject = 
476
					new EnumDataObject(Long.parseLong(bulletValues[0]));
489
						new EnumDataObject(Long.parseLong(bulletValues[i]));
477
				
490
					
478
				Bullet bullet = new Bullet(enumDataObject);
491
					Bullet bullet = new Bullet(enumDataObject);
-
 
492
					
-
 
493
					if(unitID != 0L) {
-
 
494
						bullet.setUnitID(unitID);
-
 
495
					}
479
				
496
					
480
				bullets.add(bullet);
497
					bullets.add(bullet);
-
 
498
				}
481
			}
499
			}
482
			
500
			
483
			// Primitive
501
			// Primitive
484
			else {
502
			else {
485
				log.info("Primitive");
503
				log.info("Primitive");
Line 489... Line 507...
489
					continue;
507
					continue;
490
				}
508
				}
491
				
509
				
492
				log.info("bulletValues:" + Arrays.toString(bulletValues));
510
				log.info("bulletValues:" + Arrays.toString(bulletValues));
493
				
511
				
-
 
512
				for(int i=0;i<bulletValues.length;i++) {
494
				Bullet bullet = new Bullet(
513
					Bullet bullet = new Bullet(
495
						new PrimitiveDataObject(bulletValues[0]));
514
							new PrimitiveDataObject(bulletValues[i]));
-
 
515
					
-
 
516
					if(unitID != 0L) {
-
 
517
						bullet.setUnitID(unitID);
-
 
518
					}
496
				
519
					
497
				bullets.add(bullet);
520
					bullets.add(bullet);
-
 
521
				}
498
			}
522
			}
499
			
523
			
500
			feature.setBullets(bullets);
524
			feature.setBullets(bullets);
501
			
525
			
502
			// FFC
526
			// FFC
Line 768... Line 792...
768
	 * @return
792
	 * @return
769
	 * @throws Exception
793
	 * @throws Exception
770
	 */
794
	 */
771
	public String getLearnedValuesString(long featureDefinitionID) 
795
	public String getLearnedValuesString(long featureDefinitionID) 
772
			throws Exception {
796
			throws Exception {
-
 
797
		List<String> learnedValues = this.getLearnedValues(featureDefinitionID);
-
 
798
		if(learnedValues == null) {
-
 
799
			return "";
-
 
800
		}
-
 
801
		
-
 
802
		return "\"" + StringUtils.join(learnedValues, "\", \"") + "\"";
-
 
803
	}
-
 
804
 
-
 
805
	/**
-
 
806
	 * 
-
 
807
	 * @param featureDefinitionID
-
 
808
	 * @return
-
 
809
	 * @throws Exception
-
 
810
	 */
-
 
811
	public List<String> getLearnedValues(long featureDefinitionID) 
-
 
812
			throws Exception {
773
		EntityContainer ents = this.getEntityContainer();
813
		EntityContainer ents = this.getEntityContainer();
774
		List<ExpandedBullet> learnedBullets = 
814
		List<ExpandedBullet> learnedBullets = 
775
			ents.getLearnedBullets(featureDefinitionID);
815
			ents.getLearnedBullets(featureDefinitionID);
776
		
816
		
777
		if(learnedBullets == null) {
817
		if(learnedBullets == null) {
778
			return "";
818
			return null;
779
		}
819
		}
780
		
820
		
781
		List<String> learnedValues = new ArrayList<String>();
821
		List<String> learnedValues = new ArrayList<String>();
782
		for(ExpandedBullet expBullet : learnedBullets) {
822
		for(ExpandedBullet expBullet : learnedBullets) {
783
			learnedValues.add(expBullet.getValue());
823
			learnedValues.add(expBullet.getValue());
784
		}
824
		}
785
		
825
		
786
		return "\"" + StringUtils.join(learnedValues, "\", \"") + "\"";
826
		return learnedValues;
787
	}
827
	}
788
 
828
 
789
	/**
829
	/**
790
	 * 
830
	 * 
791
	 * @param featureDefinitionID
831
	 * @param featureDefinitionID