Subversion Repositories SmartDukaan

Rev

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

Rev 9461 Rev 9466
Line 705... Line 705...
705
							campaign.setBudgetAmount(Double.parseDouble(campaignAmountUpdate));
705
							campaign.setBudgetAmount(Double.parseDouble(campaignAmountUpdate));
706
							amount = (long)(Double.parseDouble(campaignAmountUpdate) * Math.pow(10, 6));
706
							amount = (long)(Double.parseDouble(campaignAmountUpdate) * Math.pow(10, 6));
707
						}
707
						}
708
					}
708
					}
709
					Long updatedCampaignId = 0l;
709
					Long updatedCampaignId = 0l;
-
 
710
					if(!("").equalsIgnoreCase(name) || !("").equalsIgnoreCase(name) || amount!=-1l){
710
					try {
711
						try {
711
						updatedCampaignId = UpdateCampaign.runExample(Long.parseLong(campaignListUpdate1), status, name, amount);
712
							updatedCampaignId = UpdateCampaign.runExample(Long.parseLong(campaignListUpdate1), status, name, amount);
712
					} catch (NumberFormatException e) {
713
						} catch (NumberFormatException e) {
713
						addActionError("Number Format Exception for CampaignId (Google End).."+campaignListUpdate1);
714
							addActionError("Number Format Exception for CampaignId (Google End).."+campaignListUpdate1);
714
						logger.error("Number Format Exception for CampaignId (Google End).."+campaignListUpdate1, e);
715
							logger.error("Number Format Exception for CampaignId (Google End).."+campaignListUpdate1, e);
715
					} catch (Exception e) {
716
						} catch (Exception e) {
716
						addActionError("Campaign Service Mutate Operation Exception ");
717
							addActionError("Campaign Service Mutate Operation Exception ");
717
						logger.error("Error while Campaign Service Mutate Operation", e);
718
							logger.error("Error while Campaign Service Mutate Operation", e);
-
 
719
						}
718
					}
720
					}
719
					if(updatedCampaignId > 0l){
721
					if(updatedCampaignId > 0l){
720
						campaign.setCampaignId(updatedCampaignId);
722
						campaign.setCampaignId(updatedCampaignId);
721
						try {
723
						try {
722
							client.updateAdwordsCampaign(campaign);
724
							client.updateAdwordsCampaign(campaign);
Line 728... Line 730...
728
							addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while updating Data");
730
							addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while updating Data");
729
							logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while updating Data", e);
731
							logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while updating Data", e);
730
						}
732
						}
731
					}
733
					}
732
					else{
734
					else{
733
						addActionError("Error while processing Update Request for Google Campaign Service");
735
						addActionError("Either There is Nothing to Update for Campaign Or Some Error Occured");
734
					}
736
					}
735
				}
737
				}
736
			}
738
			}
737
		}
739
		}
738
		
740
		
Line 750... Line 752...
750
			Client client = adwordsServiceClient.getClient();
752
			Client client = adwordsServiceClient.getClient();
751
			if(adgroupListUpdate1!=null && !("-1").equalsIgnoreCase(adgroupListUpdate1)){
753
			if(adgroupListUpdate1!=null && !("-1").equalsIgnoreCase(adgroupListUpdate1)){
752
				String name="";
754
				String name="";
753
				String status ="";
755
				String status ="";
754
				long bidAmount = -1L;
756
				long bidAmount = -1L;
-
 
757
				boolean catalogItemIdChanged = false;
-
 
758
				boolean stockLinkedChanged = false;
755
				AdwordsAdGroup adgroup = null;
759
				AdwordsAdGroup adgroup = null;
756
				try {
760
				try {
757
					adgroup = client.getAdwordsAdGroupByAdGroupId(Long.parseLong(adgroupListUpdate1));
761
					adgroup = client.getAdwordsAdGroupByAdGroupId(Long.parseLong(adgroupListUpdate1));
758
				} catch (NumberFormatException e) {
762
				} catch (NumberFormatException e) {
759
					addActionError("Number Format Exception for AdGroupId.."+adgroupListUpdate1);
763
					addActionError("Number Format Exception for AdGroupId.."+adgroupListUpdate1);
Line 777... Line 781...
777
						status = AdwordsAdGroupStatus.findByValue(Integer.parseInt(adgroupStatusUpdate)).toString();
781
						status = AdwordsAdGroupStatus.findByValue(Integer.parseInt(adgroupStatusUpdate)).toString();
778
					}
782
					}
779
					if(catalogItemIdUpdate!=null && !("").equalsIgnoreCase(catalogItemIdUpdate)){
783
					if(catalogItemIdUpdate!=null && !("").equalsIgnoreCase(catalogItemIdUpdate)){
780
						if(adgroup.getCatalogItemId()!= Long.parseLong(catalogItemIdUpdate)){
784
						if(adgroup.getCatalogItemId()!= Long.parseLong(catalogItemIdUpdate)){
781
							adgroup.setCatalogItemId(Long.parseLong(catalogItemIdUpdate));
785
							adgroup.setCatalogItemId(Long.parseLong(catalogItemIdUpdate));
-
 
786
							catalogItemIdChanged = true;
782
						}
787
						}
783
					}
788
					}
784
					if(bidAmountUpdate!=null && !("").equalsIgnoreCase(bidAmountUpdate)){
789
					if(bidAmountUpdate!=null && !("").equalsIgnoreCase(bidAmountUpdate)){
785
						if(adgroup.getBidAmount()!=Double.parseDouble(bidAmountUpdate)){
790
						if(adgroup.getBidAmount()!=Double.parseDouble(bidAmountUpdate)){
786
							adgroup.setBidAmount(Double.parseDouble(bidAmountUpdate));
791
							adgroup.setBidAmount(Double.parseDouble(bidAmountUpdate));
787
							bidAmount = (long) (Double.parseDouble(bidAmountUpdate) * Math.pow(10, 6));
792
							bidAmount = (long) (Double.parseDouble(bidAmountUpdate) * Math.pow(10, 6));
788
						}
793
						}
789
					}
794
					}
790
					if(stocklinkedUpdate!=adgroup.getStockLinked()){
795
					if(stocklinkedUpdate!=adgroup.getStockLinked()){
791
						adgroup.setStockLinked(stocklinkedUpdate);
796
						adgroup.setStockLinked(stocklinkedUpdate);
-
 
797
						stockLinkedChanged = true;
792
					}
798
					}
793
					
799
					
794
					Long updatedAdgroupId = 0l;
800
					Long updatedAdgroupId = 0l;
-
 
801
					if(!("").equalsIgnoreCase(name) || !("").equalsIgnoreCase(name) || bidAmount != -1l){
795
					try {
802
						try {
796
						updatedAdgroupId = UpdateAdGroup.runExample(name, status, bidAmount, Long.parseLong(adgroupListUpdate1));
803
							updatedAdgroupId = UpdateAdGroup.runExample(name, status, bidAmount, Long.parseLong(adgroupListUpdate1));
797
					} catch (NumberFormatException e) {
804
						} catch (NumberFormatException e) {
798
						addActionError("Number Format Exception for AdGroupId (Google End).."+adgroupListUpdate1);
805
							addActionError("Number Format Exception for AdGroupId (Google End).."+adgroupListUpdate1);
799
						logger.error("Number Format Exception for AdGroupId (Google End).."+adgroupListUpdate1, e);
806
							logger.error("Number Format Exception for AdGroupId (Google End).."+adgroupListUpdate1, e);
800
					} catch (Exception e) {
807
						} catch (Exception e) {
801
						addActionError("AdGroup Service Mutate Operation Exception ");
808
							addActionError("AdGroup Service Mutate Operation Exception ");
802
						logger.error("Error while AdGroup Service Mutate Operation", e);
809
							logger.error("Error while AdGroup Service Mutate Operation", e);
-
 
810
						}
803
					}
811
					}
804
					if(updatedAdgroupId>0l){
812
					if(updatedAdgroupId>0l){
805
						adgroup.setAdgroupId(updatedAdgroupId);
813
						adgroup.setAdgroupId(updatedAdgroupId);
806
						try {
814
						try {
807
							client.updateAdwordsAdGroup(adgroup);
815
							client.updateAdwordsAdGroup(adgroup);
Line 813... Line 821...
813
							addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data");
821
							addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data");
814
							logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data", e);
822
							logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data", e);
815
						}
823
						}
816
					}
824
					}
817
					else{
825
					else{
-
 
826
						if(catalogItemIdChanged || stockLinkedChanged){
-
 
827
							try {
-
 
828
								client.updateAdwordsAdGroup(adgroup);
-
 
829
								return true;
-
 
830
							} catch (GoogleAdwordsServiceException e) {
-
 
831
								addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsAdGroup Method while updating Data");
-
 
832
								logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsAdGroup Method while updating Data", e); 
-
 
833
							} catch (TException e) {
-
 
834
								addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data");
-
 
835
								logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data", e);
-
 
836
							}
-
 
837
						}
-
 
838
						else{
818
						addActionError("Error while processing Update Request for Google AdGroup Service");
839
							addActionError("There is Nothing to Update for AdGroup at Google End(Local System Also) or Some Error Occured");
-
 
840
						}
819
					}
841
					}
820
				}
842
				}
821
				
843
				
822
			}
844
			}
823
		}
845
		}
Line 868... Line 890...
868
						adkeyword.setMatchType(KeywordMatchType.findByValue(Integer.parseInt(matchTypeUpdate)));
890
						adkeyword.setMatchType(KeywordMatchType.findByValue(Integer.parseInt(matchTypeUpdate)));
869
						type = KeywordMatchType.findByValue(Integer.parseInt(matchTypeUpdate)).toString();
891
						type = KeywordMatchType.findByValue(Integer.parseInt(matchTypeUpdate)).toString();
870
					}
892
					}
871
					
893
					
872
					Long updatedCriterionId = 0l;
894
					Long updatedCriterionId = 0l;
-
 
895
					if(!("").equalsIgnoreCase(text) || !("").equalsIgnoreCase(type) || bidAmount != -1l){
873
					try {
896
						try {
874
						updatedCriterionId = UpdateKeyword.runExample(Long.parseLong(adgroupListUpdate2), Long.parseLong(keywordListUpdate1), text, bidAmount, type);
897
							updatedCriterionId = UpdateKeyword.runExample(Long.parseLong(adgroupListUpdate2), Long.parseLong(keywordListUpdate1), text, bidAmount, type);
875
					} catch (NumberFormatException e) {
898
						} catch (NumberFormatException e) {
876
						addActionError("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2+ "(Google End)..");
899
							addActionError("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2+ "(Google End)..");
877
						logger.error("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2+ "(Google End)..", e);
900
							logger.error("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2+ "(Google End)..", e);
878
					} catch (Exception e) {
901
						} catch (Exception e) {
879
						addActionError("AdGroup Crierion Service Mutate Operation Exception ");
902
							addActionError("AdGroup Crierion Service Mutate Operation Exception ");
880
						e.printStackTrace();
903
							e.printStackTrace();
881
						logger.error("Error while AdGroup Crierion Service Mutate Operation", e);
904
							logger.error("Error while AdGroup Crierion Service Mutate Operation", e);
-
 
905
						}
882
					}
906
					}
883
					
907
					
884
					if(updatedCriterionId>0l){
908
					if(updatedCriterionId>0l){
885
						adkeyword.setCriterionId(updatedCriterionId);
909
						adkeyword.setCriterionId(updatedCriterionId);
886
						try {
910
						try {
Line 893... Line 917...
893
							addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while updating Data");
917
							addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while updating Data");
894
							logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while updating Data", e);
918
							logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while updating Data", e);
895
						}
919
						}
896
					}
920
					}
897
					else{
921
					else{
898
						addActionError("Error while processing Update Request for Google AdGroupCriterion Service");
922
						addActionError("Either There is Nothing to Update for Keyword Or Some Error Occured");
899
					}
923
					}
900
					
924
					
901
				}
925
				}
902
				
926
				
903
			}
927
			}