| Line 73... |
Line 73... |
| 73 |
} catch (Exception e) {
|
73 |
} catch (Exception e) {
|
| 74 |
e.printStackTrace();
|
74 |
e.printStackTrace();
|
| 75 |
errorAdgroups.add(adgroupId);
|
75 |
errorAdgroups.add(adgroupId);
|
| 76 |
continue;
|
76 |
continue;
|
| 77 |
}
|
77 |
}
|
| - |
|
78 |
if(adgroupAdDataMainList!=null){
|
| 78 |
for(int i=0;i<adgroupAdDataMainList.size();i++){
|
79 |
for(int i=0;i<adgroupAdDataMainList.size();i++){
|
| 79 |
Map<String,String> adgroupAdDataMap = adgroupAdDataMainList.get(i);
|
80 |
Map<String,String> adgroupAdDataMap = adgroupAdDataMainList.get(i);
|
| 80 |
if(adgroupAdDataMap!=null){
|
81 |
if(adgroupAdDataMap!=null){
|
| 81 |
System.out.println(adgroupAdDataMap.get("AdgroupId")+" "
|
82 |
System.out.println(adgroupAdDataMap.get("AdgroupId")+" "
|
| 82 |
+adgroupAdDataMap.get("AdgroupAdId")+" "
|
83 |
+adgroupAdDataMap.get("AdgroupAdId")+" "
|
| 83 |
+adgroupAdDataMap.get("Headline")+ " "
|
84 |
+adgroupAdDataMap.get("Headline")+ " "
|
| 84 |
+adgroupAdDataMap.get("DisplayUrl")+" "
|
85 |
+adgroupAdDataMap.get("DisplayUrl")+" "
|
| 85 |
+adgroupAdDataMap.get("Descrption1")+" "
|
86 |
+adgroupAdDataMap.get("Descrption1")+" "
|
| 86 |
+adgroupAdDataMap.get("Descrption2")+" "
|
87 |
+adgroupAdDataMap.get("Descrption2")+" "
|
| 87 |
+adgroupAdDataMap.get("Url"));
|
88 |
+adgroupAdDataMap.get("Url"));
|
| 88 |
AdwordsAdGroupAd adgroupadDB = null;
|
89 |
AdwordsAdGroupAd adgroupadDB = null;
|
| 89 |
try {
|
- |
|
| 90 |
adgroupadDB = client.getAdwordsAdgroupAdByAdId(Long.parseLong(adgroupAdDataMap.get("AdgroupAdId")));
|
- |
|
| 91 |
} catch (NumberFormatException e1) {
|
- |
|
| 92 |
System.out.println(e1.getMessage());
|
- |
|
| 93 |
} catch (GoogleAdwordsServiceException e1) {
|
- |
|
| 94 |
System.out.println("Error while requesting TextAd Google Adwords Service.."+e1.getMessage());
|
- |
|
| 95 |
logger.error("Error while requesting TextAd Google Adwords Service.."+e1.getMessage());
|
- |
|
| 96 |
} catch (TException e1) {
|
- |
|
| 97 |
System.out.println("Error while getting TextAd Google Adwords Service.."+e1.getMessage());
|
- |
|
| 98 |
logger.error("Error while getting TextAd Google Adwords Service.."+e1.getMessage());
|
- |
|
| 99 |
}
|
- |
|
| 100 |
AdwordsAdGroupAd adgroupad= new AdwordsAdGroupAd();
|
- |
|
| 101 |
adgroupad.setAdgroupId(Long.parseLong(adgroupAdDataMap.get("AdgroupId")));
|
- |
|
| 102 |
adgroupad.setCampaignId(adgroup.getCampaignId());
|
- |
|
| 103 |
adgroupad.setAdgroupadId(Long.parseLong(adgroupAdDataMap.get("AdgroupAdId")));
|
- |
|
| 104 |
adgroupad.setHeadline(adgroupAdDataMap.get("Headline"));
|
- |
|
| 105 |
adgroupad.setDisplayUrl(adgroupAdDataMap.get("DisplayUrl"));
|
- |
|
| 106 |
adgroupad.setDescription1(adgroupAdDataMap.get("Descrption1"));
|
- |
|
| 107 |
adgroupad.setDescription2(adgroupAdDataMap.get("Descrption2"));
|
- |
|
| 108 |
adgroupad.setUrl(adgroupAdDataMap.get("Url"));
|
- |
|
| 109 |
if(adgroupadDB!=null){
|
- |
|
| 110 |
adgroupad.setId(adgroupadDB.getId());
|
- |
|
| 111 |
try {
|
90 |
try {
|
| - |
|
91 |
adgroupadDB = client.getAdwordsAdgroupAdByAdId(Long.parseLong(adgroupAdDataMap.get("AdgroupAdId")));
|
| - |
|
92 |
} catch (NumberFormatException e1) {
|
| 112 |
client.updateAdwordsAdGroupAd(adgroupad);
|
93 |
System.out.println(e1.getMessage());
|
| 113 |
} catch (GoogleAdwordsServiceException e) {
|
94 |
} catch (GoogleAdwordsServiceException e1) {
|
| 114 |
System.out.println("Error while Requesting Updation TextAd Google Adwords Service.."+e.getMessage());
|
95 |
System.out.println("Error while requesting TextAd Google Adwords Service.."+e1.getMessage());
|
| 115 |
logger.error("Error while Requesting Updation TextAd Google Adwords Service.."+e.getMessage());
|
96 |
logger.error("Error while requesting TextAd Google Adwords Service.."+e1.getMessage());
|
| 116 |
} catch (TException e) {
|
97 |
} catch (TException e1) {
|
| 117 |
System.out.println("Error while Updating TextAd Google Adwords Service.."+e.getMessage());
|
98 |
System.out.println("Error while getting TextAd Google Adwords Service.."+e1.getMessage());
|
| 118 |
logger.error("Error while Updating TextAd Google Adwords Service.."+e.getMessage());
|
99 |
logger.error("Error while getting TextAd Google Adwords Service.."+e1.getMessage());
|
| 119 |
}
|
100 |
}
|
| - |
|
101 |
AdwordsAdGroupAd adgroupad= new AdwordsAdGroupAd();
|
| - |
|
102 |
adgroupad.setAdgroupId(Long.parseLong(adgroupAdDataMap.get("AdgroupId")));
|
| - |
|
103 |
adgroupad.setCampaignId(adgroup.getCampaignId());
|
| - |
|
104 |
adgroupad.setAdgroupadId(Long.parseLong(adgroupAdDataMap.get("AdgroupAdId")));
|
| - |
|
105 |
adgroupad.setHeadline(adgroupAdDataMap.get("Headline"));
|
| - |
|
106 |
adgroupad.setDisplayUrl(adgroupAdDataMap.get("DisplayUrl"));
|
| - |
|
107 |
adgroupad.setDescription1(adgroupAdDataMap.get("Descrption1"));
|
| - |
|
108 |
adgroupad.setDescription2(adgroupAdDataMap.get("Descrption2"));
|
| - |
|
109 |
adgroupad.setUrl(adgroupAdDataMap.get("Url"));
|
| - |
|
110 |
if(adgroupadDB.getAdgroupadId()>0l){
|
| - |
|
111 |
adgroupad.setId(adgroupadDB.getId());
|
| - |
|
112 |
try {
|
| - |
|
113 |
client.updateAdwordsAdGroupAd(adgroupad);
|
| - |
|
114 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
115 |
System.out.println("Error while Requesting Updation TextAd Google Adwords Service.."+e.getMessage());
|
| - |
|
116 |
logger.error("Error while Requesting Updation TextAd Google Adwords Service.."+e.getMessage());
|
| - |
|
117 |
} catch (TException e) {
|
| - |
|
118 |
System.out.println("Error while Updating TextAd Google Adwords Service.."+e.getMessage());
|
| - |
|
119 |
logger.error("Error while Updating TextAd Google Adwords Service.."+e.getMessage());
|
| - |
|
120 |
}
|
| 120 |
}
|
121 |
}
|
| 121 |
else{
|
122 |
else{
|
| 122 |
try {
|
123 |
try {
|
| 123 |
client.addAdwordsAdGroupAd(adgroupad);
|
124 |
client.addAdwordsAdGroupAd(adgroupad);
|
| 124 |
} catch (GoogleAdwordsServiceException e) {
|
125 |
} catch (GoogleAdwordsServiceException e) {
|
| 125 |
System.out.println("Error while Requesting Addition TextAd Google Adwords Service.."+e.getMessage());
|
126 |
System.out.println("Error while Requesting Addition TextAd Google Adwords Service.."+e.getMessage());
|
| 126 |
logger.error("Error while Requesting Addition TextAd Google Adwords Service.."+e.getMessage());
|
127 |
logger.error("Error while Requesting Addition TextAd Google Adwords Service.."+e.getMessage());
|
| 127 |
} catch (TException e) {
|
128 |
} catch (TException e) {
|
| 128 |
System.out.println("Error while Adding TextAd Google Adwords Service.."+e.getMessage());
|
129 |
System.out.println("Error while Adding TextAd Google Adwords Service.."+e.getMessage());
|
| 129 |
logger.error("Error while Adding TextAd Google Adwords Service.."+e.getMessage());
|
130 |
logger.error("Error while Adding TextAd Google Adwords Service.."+e.getMessage());
|
| - |
|
131 |
}
|
| 130 |
}
|
132 |
}
|
| 131 |
}
|
133 |
}
|
| 132 |
}
|
134 |
}
|
| 133 |
}
|
135 |
}
|
| 134 |
|
- |
|
| 135 |
}
|
136 |
}
|
| 136 |
System.out.println("$$$$$$$$$$$$$$$$$$ Error AdGroups List $$$$$$$$$$$$$$$$$$$$$$$$$");
|
137 |
System.out.println("$$$$$$$$$$$$$$$$$$ Error AdGroups List $$$$$$$$$$$$$$$$$$$$$$$$$");
|
| 137 |
for(Long l : errorAdgroups){
|
138 |
for(Long l : errorAdgroups){
|
| 138 |
System.out.println(l);
|
139 |
System.out.println(l);
|
| 139 |
}
|
140 |
}
|