| Line 17... |
Line 17... |
| 17 |
import in.shop2020.googleadwords.AdwordsCampaignStatus;
|
17 |
import in.shop2020.googleadwords.AdwordsCampaignStatus;
|
| 18 |
import in.shop2020.googleadwords.GoogleAdwordsService.Client;
|
18 |
import in.shop2020.googleadwords.GoogleAdwordsService.Client;
|
| 19 |
import in.shop2020.googleadwords.GoogleAdwordsServiceException;
|
19 |
import in.shop2020.googleadwords.GoogleAdwordsServiceException;
|
| 20 |
import in.shop2020.googleadwords.KeywordMatchType;
|
20 |
import in.shop2020.googleadwords.KeywordMatchType;
|
| 21 |
import in.shop2020.googleadwords.NetworkSettingType;
|
21 |
import in.shop2020.googleadwords.NetworkSettingType;
|
| - |
|
22 |
import in.shop2020.model.v1.catalog.CatalogServiceException;
|
| - |
|
23 |
import in.shop2020.model.v1.catalog.Item;
|
| - |
|
24 |
import in.shop2020.model.v1.catalog.status;
|
| 22 |
import in.shop2020.support.utils.ReportsUtils;
|
25 |
import in.shop2020.support.utils.ReportsUtils;
|
| 23 |
import in.shop2020.thrift.clients.AdwordsClient;
|
26 |
import in.shop2020.thrift.clients.AdwordsClient;
|
| - |
|
27 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 24 |
|
28 |
|
| 25 |
import javax.servlet.ServletContext;
|
29 |
import javax.servlet.ServletContext;
|
| 26 |
import javax.servlet.http.HttpServletRequest;
|
30 |
import javax.servlet.http.HttpServletRequest;
|
| 27 |
import javax.servlet.http.HttpSession;
|
31 |
import javax.servlet.http.HttpSession;
|
| 28 |
|
32 |
|
| Line 36... |
Line 40... |
| 36 |
import org.apache.thrift.transport.TTransportException;
|
40 |
import org.apache.thrift.transport.TTransportException;
|
| 37 |
import org.json.JSONObject;
|
41 |
import org.json.JSONObject;
|
| 38 |
import org.slf4j.Logger;
|
42 |
import org.slf4j.Logger;
|
| 39 |
import org.slf4j.LoggerFactory;
|
43 |
import org.slf4j.LoggerFactory;
|
| 40 |
|
44 |
|
| - |
|
45 |
import adwords.axis.v201309.basicoperations.UpdateKeyword;
|
| 41 |
import adwords.axis.v201309.basicoperations.AddAdGroups;
|
46 |
import adwords.axis.v201309.basicoperations.AddAdGroups;
|
| 42 |
import adwords.axis.v201309.basicoperations.AddCampaigns;
|
47 |
import adwords.axis.v201309.basicoperations.AddCampaigns;
|
| 43 |
import adwords.axis.v201309.basicoperations.AddKeywords;
|
48 |
import adwords.axis.v201309.basicoperations.AddKeywords;
|
| 44 |
import adwords.axis.v201309.basicoperations.AddTextAds;
|
49 |
import adwords.axis.v201309.basicoperations.AddTextAds;
|
| - |
|
50 |
import adwords.axis.v201309.basicoperations.UpdateAdGroup;
|
| - |
|
51 |
import adwords.axis.v201309.basicoperations.UpdateCampaign;
|
| 45 |
|
52 |
|
| 46 |
import com.opensymphony.xwork2.ActionSupport;
|
53 |
import com.opensymphony.xwork2.ActionSupport;
|
| 47 |
|
54 |
|
| 48 |
@InterceptorRefs({
|
55 |
@InterceptorRefs({
|
| 49 |
@InterceptorRef("defaultStack"),
|
56 |
@InterceptorRef("defaultStack"),
|
| Line 65... |
Line 72... |
| 65 |
private ServletContext context;
|
72 |
private ServletContext context;
|
| 66 |
|
73 |
|
| 67 |
private String errorMsg = "";
|
74 |
private String errorMsg = "";
|
| 68 |
private String successmsg = "";
|
75 |
private String successmsg = "";
|
| 69 |
private String campaignId = "";
|
76 |
private String campaignId = "";
|
| - |
|
77 |
private String adgroupId = "";
|
| - |
|
78 |
private String keywordId = "";
|
| 70 |
private JSONObject jsonData = null;
|
79 |
private JSONObject jsonData = null;
|
| - |
|
80 |
private JSONObject jsonCampaignData = null;
|
| - |
|
81 |
private JSONObject jsonAdgroupData = null;
|
| - |
|
82 |
private JSONObject jsonKeywordList = null;
|
| - |
|
83 |
private JSONObject jsonKeywordData = null;
|
| 71 |
|
84 |
|
| 72 |
private AdwordsCampaignStatus campStatus;
|
85 |
private AdwordsCampaignStatus campStatus;
|
| 73 |
private AdwordsAdGroupStatus adgrpStatus;
|
86 |
private AdwordsAdGroupStatus adgrpStatus;
|
| 74 |
private KeywordMatchType keywordMatchType1;
|
87 |
private KeywordMatchType keywordMatchType1;
|
| 75 |
private KeywordMatchType keywordMatchType2;
|
88 |
private KeywordMatchType keywordMatchType2;
|
| 76 |
private KeywordMatchType keywordMatchType3;
|
89 |
private KeywordMatchType keywordMatchType3;
|
| Line 122... |
Line 135... |
| 122 |
private String matchType1;
|
135 |
private String matchType1;
|
| 123 |
private String matchType2;
|
136 |
private String matchType2;
|
| 124 |
private String matchType3;
|
137 |
private String matchType3;
|
| 125 |
private String matchType4;
|
138 |
private String matchType4;
|
| 126 |
private String matchType5;
|
139 |
private String matchType5;
|
| 127 |
|
140 |
|
| - |
|
141 |
private String adwordUpdateRadio;
|
| - |
|
142 |
private String campaignListUpdate1;
|
| - |
|
143 |
private String campaignNameUpdate;
|
| - |
|
144 |
private String campaignStatusUpdate;
|
| - |
|
145 |
private String campaignAmountUpdate;
|
| - |
|
146 |
private String campaignListUpdate2;
|
| - |
|
147 |
private String adgroupListUpdate1;
|
| - |
|
148 |
private String adgroupNameUpdate;
|
| - |
|
149 |
private String adgroupStatusUpdate;
|
| - |
|
150 |
private String catalogItemIdUpdate;
|
| - |
|
151 |
private String bidAmountUpdate;
|
| - |
|
152 |
private String campaignListUpdate3;
|
| - |
|
153 |
private String adgroupListUpdate2;
|
| - |
|
154 |
private String keywordListUpdate1;
|
| - |
|
155 |
private String keywordUpdate;
|
| - |
|
156 |
private String bidUpdate;
|
| - |
|
157 |
private String matchTypeUpdate;
|
| - |
|
158 |
|
| 128 |
|
159 |
|
| 129 |
public String index() {
|
160 |
public String index() {
|
| 130 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getServletPath()))
|
161 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getServletPath()))
|
| 131 |
return "authfail";
|
162 |
return "authfail";
|
| 132 |
checkForErrors();
|
163 |
checkForErrors();
|
| Line 222... |
Line 253... |
| 222 |
if(addAdKeywordResult){
|
253 |
if(addAdKeywordResult){
|
| 223 |
successmsg = "Adwords AdGroup Ad Keyword Added Successfully";
|
254 |
successmsg = "Adwords AdGroup Ad Keyword Added Successfully";
|
| 224 |
}
|
255 |
}
|
| 225 |
}
|
256 |
}
|
| 226 |
}
|
257 |
}
|
| - |
|
258 |
if(adwordOpRadio!=null && ("updateOpRadio").equalsIgnoreCase(adwordOpRadio)){
|
| - |
|
259 |
if(adwordUpdateRadio!=null && ("campaignRdoUpdate").equalsIgnoreCase(adwordUpdateRadio)){
|
| - |
|
260 |
boolean updateCamapaignResult = updateAdwordsCampaign();
|
| - |
|
261 |
if(updateCamapaignResult){
|
| - |
|
262 |
successmsg = "Adwords Campaign Updated Successfully";
|
| - |
|
263 |
}
|
| - |
|
264 |
}
|
| - |
|
265 |
if(adwordUpdateRadio!=null && ("adgroupRdoUpdate").equalsIgnoreCase(adwordUpdateRadio)){
|
| - |
|
266 |
boolean updateAdGroupResult = updateAdwordsAdGroup();
|
| - |
|
267 |
if(updateAdGroupResult){
|
| - |
|
268 |
successmsg = "Adwords AdGroup Updated Successfully";
|
| - |
|
269 |
}
|
| - |
|
270 |
}
|
| - |
|
271 |
if(adwordUpdateRadio!=null && ("keywordRdoUpdate").equalsIgnoreCase(adwordUpdateRadio)){
|
| - |
|
272 |
boolean updateKeywordResult = updateAdwordsAdKeyword();
|
| - |
|
273 |
if(updateKeywordResult){
|
| - |
|
274 |
successmsg = "Adwords AdKeyword Updated Successfully";
|
| - |
|
275 |
}
|
| - |
|
276 |
}
|
| - |
|
277 |
}
|
| 227 |
|
278 |
|
| 228 |
return index();
|
279 |
return index();
|
| 229 |
}
|
280 |
}
|
| 230 |
|
281 |
|
| 231 |
public KeywordMatchType processAdKeywordMatchType(String value){
|
282 |
public KeywordMatchType processAdKeywordMatchType(String value){
|
| Line 235... |
Line 286... |
| 235 |
public AdwordsAdGroup getAdwordsAdgroup(long adgroupId){
|
286 |
public AdwordsAdGroup getAdwordsAdgroup(long adgroupId){
|
| 236 |
AdwordsAdGroup adgroup = new AdwordsAdGroup();
|
287 |
AdwordsAdGroup adgroup = new AdwordsAdGroup();
|
| 237 |
try {
|
288 |
try {
|
| 238 |
adgroup = new AdwordsClient().getClient().getAdwordsAdGroupByAdGroupId(adgroupId);
|
289 |
adgroup = new AdwordsClient().getClient().getAdwordsAdGroupByAdGroupId(adgroupId);
|
| 239 |
} catch (TTransportException e) {
|
290 |
} catch (TTransportException e) {
|
| 240 |
// TODO Auto-generated catch block
|
- |
|
| 241 |
e.printStackTrace();
|
291 |
e.printStackTrace();
|
| 242 |
} catch (GoogleAdwordsServiceException e) {
|
292 |
} catch (GoogleAdwordsServiceException e) {
|
| 243 |
// TODO Auto-generated catch block
|
- |
|
| 244 |
e.printStackTrace();
|
293 |
e.printStackTrace();
|
| 245 |
} catch (TException e) {
|
294 |
} catch (TException e) {
|
| 246 |
// TODO Auto-generated catch block
|
- |
|
| 247 |
e.printStackTrace();
|
295 |
e.printStackTrace();
|
| 248 |
}
|
296 |
}
|
| 249 |
return adgroup;
|
297 |
return adgroup;
|
| 250 |
}
|
298 |
}
|
| 251 |
|
299 |
|
| Line 374... |
Line 422... |
| 374 |
}
|
422 |
}
|
| 375 |
catch(ParseException pe){
|
423 |
catch(ParseException pe){
|
| 376 |
addActionError("Unable to parse proper Data");
|
424 |
addActionError("Unable to parse proper Data");
|
| 377 |
logger.error("Error while parsing proper Data", pe);
|
425 |
logger.error("Error while parsing proper Data", pe);
|
| 378 |
} catch (TTransportException e) {
|
426 |
} catch (TTransportException e) {
|
| 379 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services");
|
427 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services in addAdwordsCampaign Method");
|
| 380 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services", e);
|
428 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services in addAdwordsCampaign Method", e);
|
| 381 |
} catch (GoogleAdwordsServiceException e) {
|
429 |
} catch (GoogleAdwordsServiceException e) {
|
| 382 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services");
|
430 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in addAdwordsCampaign Method");
|
| 383 |
logger.error("Error while performing operations with Saholic Google Adowrds Services", e);
|
431 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in addAdwordsCampaign Method", e);
|
| 384 |
} catch (TException e) {
|
432 |
} catch (TException e) {
|
| 385 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client");
|
433 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in addAdwordsCampaign Method");
|
| 386 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client", e);
|
434 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in addAdwordsCampaign Method", e);
|
| 387 |
}
|
435 |
}
|
| 388 |
|
436 |
|
| 389 |
return false;
|
437 |
return false;
|
| 390 |
}
|
438 |
}
|
| 391 |
|
439 |
|
| Line 419... |
Line 467... |
| 419 |
adgroup.setStockLinked(stocklinked);
|
467 |
adgroup.setStockLinked(stocklinked);
|
| 420 |
new AdwordsClient().getClient().addAdwordsAdGroup(adgroup);
|
468 |
new AdwordsClient().getClient().addAdwordsAdGroup(adgroup);
|
| 421 |
return true;
|
469 |
return true;
|
| 422 |
}
|
470 |
}
|
| 423 |
catch (TTransportException e) {
|
471 |
catch (TTransportException e) {
|
| 424 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services");
|
472 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services in addAdwordsAdGroup Method");
|
| 425 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services", e);
|
473 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services in addAdwordsAdGroup Method", e);
|
| 426 |
} catch (GoogleAdwordsServiceException e) {
|
474 |
} catch (GoogleAdwordsServiceException e) {
|
| 427 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services");
|
475 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in addAdwordsAdGroup Method");
|
| 428 |
logger.error("Error while performing operations with Saholic Google Adowrds Services", e);
|
476 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in addAdwordsAdGroup Method", e);
|
| 429 |
} catch (TException e) {
|
477 |
} catch (TException e) {
|
| 430 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client");
|
478 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in addAdwordsAdGroup Method");
|
| 431 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client", e);
|
479 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in addAdwordsAdGroup Method", e);
|
| 432 |
}
|
480 |
}
|
| 433 |
return false;
|
481 |
return false;
|
| 434 |
}
|
482 |
}
|
| 435 |
|
483 |
|
| 436 |
public boolean addAdwordsAdGroupAd(){
|
484 |
public boolean addAdwordsAdGroupAd(){
|
| 437 |
Long adGroupAdId = 0L;
|
485 |
Long adGroupAdId = 0L;
|
| 438 |
int attempt =0;
|
486 |
int attempt =0;
|
| 439 |
boolean retry = true;
|
487 |
boolean retry = true;
|
| - |
|
488 |
if(description1.contains("#price")){
|
| - |
|
489 |
description1 = description1.replace("#price", "Rs"+getTextAdItemPrice()+"#");
|
| - |
|
490 |
}
|
| - |
|
491 |
if(description1.length()>35){
|
| - |
|
492 |
addActionError("Description1 length is greater than 35. Final String is given as.... "+description1);
|
| - |
|
493 |
return false;
|
| - |
|
494 |
}
|
| 440 |
while(retry && attempt<2){
|
495 |
while(retry && attempt<2){
|
| 441 |
try{
|
496 |
try{
|
| 442 |
attempt = attempt+1;
|
497 |
attempt = attempt+1;
|
| 443 |
adGroupAdId = AddTextAds.runExample(Long.parseLong(adgroupList1), headline, description1, description2, url, displayUrl);
|
498 |
adGroupAdId = AddTextAds.runExample(Long.parseLong(adgroupList1), headline, description1, description2, url, displayUrl);
|
| 444 |
retry = false;
|
499 |
retry = false;
|
| Line 464... |
Line 519... |
| 464 |
adgroupad.setUrl(url);
|
519 |
adgroupad.setUrl(url);
|
| 465 |
new AdwordsClient().getClient().addAdwordsAdGroupAd(adgroupad);
|
520 |
new AdwordsClient().getClient().addAdwordsAdGroupAd(adgroupad);
|
| 466 |
return true;
|
521 |
return true;
|
| 467 |
}
|
522 |
}
|
| 468 |
catch (TTransportException e) {
|
523 |
catch (TTransportException e) {
|
| 469 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services");
|
524 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services in addAdwordsAdGroupAd Method");
|
| 470 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services", e);
|
525 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services in addAdwordsAdGroupAd Method", e);
|
| 471 |
} catch (GoogleAdwordsServiceException e) {
|
526 |
} catch (GoogleAdwordsServiceException e) {
|
| 472 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services");
|
527 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in addAdwordsAdGroupAd Method");
|
| 473 |
logger.error("Error while performing operations with Saholic Google Adowrds Services", e);
|
528 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in addAdwordsAdGroupAd Method", e);
|
| 474 |
} catch (TException e) {
|
529 |
} catch (TException e) {
|
| 475 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client");
|
530 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in addAdwordsAdGroupAd Method");
|
| 476 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client", e);
|
531 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in addAdwordsAdGroupAd Method", e);
|
| 477 |
}
|
532 |
}
|
| 478 |
|
533 |
|
| 479 |
return false;
|
534 |
return false;
|
| 480 |
}
|
535 |
}
|
| 481 |
|
536 |
|
| Line 509... |
Line 564... |
| 509 |
client.addAdwordsAdKeyword(adkeyword);
|
564 |
client.addAdwordsAdKeyword(adkeyword);
|
| 510 |
}
|
565 |
}
|
| 511 |
return true;
|
566 |
return true;
|
| 512 |
}
|
567 |
}
|
| 513 |
catch (TTransportException e) {
|
568 |
catch (TTransportException e) {
|
| 514 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services");
|
569 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services in addAdwordsAdKeyword Method");
|
| 515 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services", e);
|
570 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services in addAdwordsAdKeyword Method", e);
|
| 516 |
} catch (GoogleAdwordsServiceException e) {
|
571 |
} catch (GoogleAdwordsServiceException e) {
|
| 517 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services");
|
572 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in addAdwordsAdKeyword Method");
|
| 518 |
logger.error("Error while performing operations with Saholic Google Adowrds Services", e);
|
573 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in addAdwordsAdKeyword Method", e);
|
| 519 |
} catch (TException e) {
|
574 |
} catch (TException e) {
|
| 520 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client");
|
575 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in addAdwordsAdKeyword Method");
|
| 521 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client", e);
|
576 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in addAdwordsAdKeyword Method", e);
|
| - |
|
577 |
}
|
| - |
|
578 |
}
|
| - |
|
579 |
else{
|
| - |
|
580 |
addActionError("Error while processing Add Request for Google AdGroupCriterion Service");
|
| - |
|
581 |
}
|
| - |
|
582 |
return false;
|
| - |
|
583 |
}
|
| - |
|
584 |
|
| - |
|
585 |
public boolean updateAdwordsCampaign(){
|
| - |
|
586 |
AdwordsClient adwordsServiceClient = null;
|
| - |
|
587 |
try {
|
| - |
|
588 |
adwordsServiceClient = new AdwordsClient();
|
| - |
|
589 |
} catch (TTransportException e) {
|
| - |
|
590 |
addActionError("Unable to get Connection with Saholic Google Adowrds Services in updateAdwordsCampaign Method");
|
| - |
|
591 |
logger.error("Error while getting Connection with Saholic Google Adowrds Services in updateAdwordsCampaign Method", e);
|
| - |
|
592 |
}
|
| - |
|
593 |
if(adwordsServiceClient!=null){
|
| - |
|
594 |
Client client = adwordsServiceClient.getClient();
|
| - |
|
595 |
if(campaignListUpdate1!=null && !("-1").equalsIgnoreCase(campaignListUpdate1)){
|
| - |
|
596 |
long amount= -1l;
|
| - |
|
597 |
String status = "";
|
| - |
|
598 |
String name = "";
|
| - |
|
599 |
AdwordsCampaign campaign = null;
|
| - |
|
600 |
try {
|
| - |
|
601 |
campaign = client.getAdwordsCampaignByCampaignId(Long.parseLong(campaignListUpdate1));
|
| - |
|
602 |
} catch (NumberFormatException e) {
|
| - |
|
603 |
addActionError("Number Format Exception for CampaignId.."+campaignListUpdate1);
|
| - |
|
604 |
logger.error("Number Format Exception for CampaignId.."+campaignListUpdate1, e);
|
| - |
|
605 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
606 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsCampaign Method while getting Data");
|
| - |
|
607 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsCampaign Method while getting Data", e);
|
| - |
|
608 |
} catch (TException e) {
|
| - |
|
609 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while getting Data");
|
| - |
|
610 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while getting Data", e);
|
| - |
|
611 |
}
|
| - |
|
612 |
if(campaign!=null){
|
| - |
|
613 |
if(campaignNameUpdate!=null && !("").equalsIgnoreCase(campaignNameUpdate)){
|
| - |
|
614 |
if(!campaign.getName().equalsIgnoreCase(campaignNameUpdate)){
|
| - |
|
615 |
campaign.setName(campaignNameUpdate);
|
| - |
|
616 |
name = campaignNameUpdate;
|
| - |
|
617 |
}
|
| - |
|
618 |
}
|
| - |
|
619 |
if(!campaign.getStatus().toString().equalsIgnoreCase(AdwordsCampaignStatus.valueOf(campaignStatusUpdate).toString())){
|
| - |
|
620 |
campaign.setStatus(AdwordsCampaignStatus.valueOf(campaignStatusUpdate));
|
| - |
|
621 |
status = AdwordsCampaignStatus.valueOf(campaignStatusUpdate).toString();
|
| - |
|
622 |
}
|
| - |
|
623 |
if(campaignAmountUpdate!=null && !("").equalsIgnoreCase(campaignAmountUpdate)){
|
| - |
|
624 |
if(campaign.getBudgetAmount()!=Double.parseDouble(campaignAmountUpdate)){
|
| - |
|
625 |
campaign.setBudgetAmount(Double.parseDouble(campaignAmountUpdate));
|
| - |
|
626 |
amount = (long)(Double.parseDouble(campaignAmountUpdate) * Math.pow(10, 6));
|
| - |
|
627 |
}
|
| - |
|
628 |
}
|
| - |
|
629 |
Long updatedCampaignId = 0l;
|
| - |
|
630 |
try {
|
| - |
|
631 |
updatedCampaignId = UpdateCampaign.runExample(Long.parseLong(campaignListUpdate1), status, name, amount);
|
| - |
|
632 |
} catch (NumberFormatException e) {
|
| - |
|
633 |
addActionError("Number Format Exception for CampaignId (Google End).."+campaignListUpdate1);
|
| - |
|
634 |
logger.error("Number Format Exception for CampaignId (Google End).."+campaignListUpdate1, e);
|
| - |
|
635 |
} catch (Exception e) {
|
| - |
|
636 |
addActionError("Campaign Service Mutate Operation Exception ");
|
| - |
|
637 |
logger.error("Error while Campaign Service Mutate Operation", e);
|
| - |
|
638 |
}
|
| - |
|
639 |
if(updatedCampaignId > 0l){
|
| - |
|
640 |
campaign.setCampaignId(updatedCampaignId);
|
| - |
|
641 |
try {
|
| - |
|
642 |
client.updateAdwordsCampaign(campaign);
|
| - |
|
643 |
return true;
|
| - |
|
644 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
645 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsCampaign Method while updating Data");
|
| - |
|
646 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsCampaign Method while updating Data", e);
|
| - |
|
647 |
} catch (TException e) {
|
| - |
|
648 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while updating Data");
|
| - |
|
649 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsCampaign Method while updating Data", e);
|
| - |
|
650 |
}
|
| - |
|
651 |
}
|
| - |
|
652 |
else{
|
| - |
|
653 |
addActionError("Error while processing Update Request for Google Campaign Service");
|
| - |
|
654 |
}
|
| - |
|
655 |
}
|
| - |
|
656 |
}
|
| - |
|
657 |
}
|
| - |
|
658 |
|
| - |
|
659 |
return false;
|
| - |
|
660 |
}
|
| - |
|
661 |
|
| - |
|
662 |
public boolean updateAdwordsAdGroup(){
|
| - |
|
663 |
AdwordsClient adwordsServiceClient = null;
|
| - |
|
664 |
try {
|
| - |
|
665 |
adwordsServiceClient = new AdwordsClient();
|
| - |
|
666 |
} catch (TTransportException e) {
|
| - |
|
667 |
e.printStackTrace();
|
| - |
|
668 |
}
|
| - |
|
669 |
if(adwordsServiceClient!=null){
|
| - |
|
670 |
Client client = adwordsServiceClient.getClient();
|
| - |
|
671 |
if(adgroupListUpdate1!=null && !("-1").equalsIgnoreCase(adgroupListUpdate1)){
|
| - |
|
672 |
String name="";
|
| - |
|
673 |
String status ="";
|
| - |
|
674 |
long bidAmount = -1L;
|
| - |
|
675 |
AdwordsAdGroup adgroup = null;
|
| - |
|
676 |
try {
|
| - |
|
677 |
adgroup = client.getAdwordsAdGroupByAdGroupId(Long.parseLong(adgroupListUpdate1));
|
| - |
|
678 |
} catch (NumberFormatException e) {
|
| - |
|
679 |
addActionError("Number Format Exception for AdGroupId.."+adgroupListUpdate1);
|
| - |
|
680 |
logger.error("Number Format Exception for AdGroupId.."+adgroupListUpdate1, e);
|
| - |
|
681 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
682 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsAdGroup Method while getting Data");
|
| - |
|
683 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsAdGroup Method while getting Data", e);
|
| - |
|
684 |
} catch (TException e) {
|
| - |
|
685 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while getting Data");
|
| - |
|
686 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while getting Data", e);
|
| - |
|
687 |
}
|
| - |
|
688 |
if(adgroup!=null){
|
| - |
|
689 |
if(adgroupNameUpdate!=null && !("").equalsIgnoreCase(adgroupNameUpdate)){
|
| - |
|
690 |
if(!adgroup.getName().equalsIgnoreCase(adgroupNameUpdate)){
|
| - |
|
691 |
adgroup.setName(adgroupNameUpdate);
|
| - |
|
692 |
name = adgroupNameUpdate;
|
| - |
|
693 |
}
|
| - |
|
694 |
}
|
| - |
|
695 |
if(!adgroup.getStatus().toString().equalsIgnoreCase(AdwordsAdGroupStatus.valueOf(adgroupStatusUpdate).toString())){
|
| - |
|
696 |
adgroup.setStatus(AdwordsAdGroupStatus.valueOf(adgroupStatusUpdate));
|
| - |
|
697 |
status = AdwordsAdGroupStatus.valueOf(adgroupStatusUpdate).toString();
|
| - |
|
698 |
}
|
| - |
|
699 |
if(catalogItemIdUpdate!=null && !("").equalsIgnoreCase(catalogItemIdUpdate)){
|
| - |
|
700 |
if(adgroup.getCatalogItemId()!= Long.parseLong(catalogItemIdUpdate)){
|
| - |
|
701 |
adgroup.setCatalogItemId(Long.parseLong(catalogItemIdUpdate));
|
| - |
|
702 |
}
|
| - |
|
703 |
}
|
| - |
|
704 |
if(bidAmountUpdate!=null && !("").equalsIgnoreCase(bidAmountUpdate)){
|
| - |
|
705 |
if(adgroup.getBidAmount()!=Double.parseDouble(bidAmountUpdate)){
|
| - |
|
706 |
adgroup.setBidAmount(Double.parseDouble(bidAmountUpdate));
|
| - |
|
707 |
bidAmount = (long) (Double.parseDouble(bidAmountUpdate) * Math.pow(10, 6));
|
| - |
|
708 |
}
|
| - |
|
709 |
}
|
| - |
|
710 |
|
| - |
|
711 |
Long updatedAdgroupId = 0l;
|
| - |
|
712 |
try {
|
| - |
|
713 |
updatedAdgroupId = UpdateAdGroup.runExample(name, status, bidAmount, Long.parseLong(adgroupListUpdate1));
|
| - |
|
714 |
} catch (NumberFormatException e) {
|
| - |
|
715 |
addActionError("Number Format Exception for AdGroupId (Google End).."+adgroupListUpdate1);
|
| - |
|
716 |
logger.error("Number Format Exception for AdGroupId (Google End).."+adgroupListUpdate1, e);
|
| - |
|
717 |
} catch (Exception e) {
|
| - |
|
718 |
addActionError("AdGroup Service Mutate Operation Exception ");
|
| - |
|
719 |
logger.error("Error while AdGroup Service Mutate Operation", e);
|
| - |
|
720 |
}
|
| - |
|
721 |
if(updatedAdgroupId>0l){
|
| - |
|
722 |
adgroup.setAdgroupId(updatedAdgroupId);
|
| - |
|
723 |
try {
|
| - |
|
724 |
client.updateAdwordsAdGroup(adgroup);
|
| - |
|
725 |
return true;
|
| - |
|
726 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
727 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsAdGroup Method while updating Data");
|
| - |
|
728 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsAdGroup Method while updating Data", e);
|
| - |
|
729 |
} catch (TException e) {
|
| - |
|
730 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data");
|
| - |
|
731 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdGroup Method while updating Data", e);
|
| - |
|
732 |
}
|
| - |
|
733 |
}
|
| - |
|
734 |
else{
|
| - |
|
735 |
addActionError("Error while processing Update Request for Google AdGroup Service");
|
| - |
|
736 |
}
|
| - |
|
737 |
}
|
| - |
|
738 |
|
| - |
|
739 |
}
|
| - |
|
740 |
}
|
| - |
|
741 |
return false;
|
| - |
|
742 |
}
|
| - |
|
743 |
|
| - |
|
744 |
public boolean updateAdwordsAdKeyword(){
|
| - |
|
745 |
AdwordsClient adwordsServiceClient = null;
|
| - |
|
746 |
try {
|
| - |
|
747 |
adwordsServiceClient = new AdwordsClient();
|
| - |
|
748 |
} catch (TTransportException e) {
|
| - |
|
749 |
e.printStackTrace();
|
| - |
|
750 |
}
|
| - |
|
751 |
if(adwordsServiceClient!=null){
|
| - |
|
752 |
Client client = adwordsServiceClient.getClient();
|
| - |
|
753 |
if(adgroupListUpdate2!=null && !("-1").equalsIgnoreCase(adgroupListUpdate2) && keywordListUpdate1!=null && ("-1").equalsIgnoreCase(keywordListUpdate1)){
|
| - |
|
754 |
String text = "";
|
| - |
|
755 |
String type = "";
|
| - |
|
756 |
long bidAmount = -1l;
|
| - |
|
757 |
|
| - |
|
758 |
AdwordsAdKeyword adkeyword = null;
|
| - |
|
759 |
try {
|
| - |
|
760 |
adkeyword = client.getAdwordsAdKeywordByCriterionIdAndAdGroupId(Long.parseLong(keywordListUpdate1), Long.parseLong(adgroupListUpdate2));
|
| - |
|
761 |
} catch (NumberFormatException e) {
|
| - |
|
762 |
addActionError("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2);
|
| - |
|
763 |
logger.error("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2, e);
|
| - |
|
764 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
765 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsAdKeyword Method while getting Data");
|
| - |
|
766 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsAdKeyword Method while getting Data", e);
|
| - |
|
767 |
} catch (TException e) {
|
| - |
|
768 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while getting Data");
|
| - |
|
769 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while getting Data", e);
|
| - |
|
770 |
}
|
| - |
|
771 |
|
| - |
|
772 |
if(adkeyword!=null){
|
| - |
|
773 |
if(keywordUpdate!=null && !("").equalsIgnoreCase(keywordUpdate)){
|
| - |
|
774 |
if(!adkeyword.getText().equalsIgnoreCase(keywordUpdate)){
|
| - |
|
775 |
adkeyword.setText(keywordUpdate);
|
| - |
|
776 |
text = keywordUpdate;
|
| - |
|
777 |
}
|
| - |
|
778 |
}
|
| - |
|
779 |
if(bidUpdate!=null && !("").equalsIgnoreCase(bidUpdate)){
|
| - |
|
780 |
if(adkeyword.getBidAmount()!=Double.parseDouble(bidUpdate)){
|
| - |
|
781 |
adkeyword.setBidAmount(Double.parseDouble(bidUpdate));
|
| - |
|
782 |
bidAmount = (long) (Double.parseDouble(bidUpdate) * Math.pow(10, 6));
|
| - |
|
783 |
}
|
| - |
|
784 |
}
|
| - |
|
785 |
if(!adkeyword.getMatchType().toString().equalsIgnoreCase(KeywordMatchType.valueOf(matchTypeUpdate).toString())){
|
| - |
|
786 |
adkeyword.setMatchType(KeywordMatchType.valueOf(matchTypeUpdate));
|
| - |
|
787 |
type = KeywordMatchType.valueOf(matchTypeUpdate).toString();
|
| - |
|
788 |
}
|
| - |
|
789 |
|
| - |
|
790 |
Long updatedCriterionId = 0l;
|
| - |
|
791 |
try {
|
| - |
|
792 |
updatedCriterionId = UpdateKeyword.runExample(Long.parseLong(adgroupListUpdate2), Long.parseLong(keywordListUpdate1), text, bidAmount, type);
|
| - |
|
793 |
} catch (NumberFormatException e) {
|
| - |
|
794 |
addActionError("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2+ "(Google End)..");
|
| - |
|
795 |
logger.error("Number Format Exception for AdGroupCriterionId.."+keywordListUpdate1+"..AdGroupId.."+adgroupListUpdate2+ "(Google End)..", e);
|
| - |
|
796 |
} catch (Exception e) {
|
| - |
|
797 |
addActionError("AdGroup Crierion Service Mutate Operation Exception ");
|
| - |
|
798 |
logger.error("Error while AdGroup Crierion Service Mutate Operation", e);
|
| - |
|
799 |
}
|
| - |
|
800 |
|
| - |
|
801 |
if(updatedCriterionId>0l){
|
| - |
|
802 |
adkeyword.setCriterionId(updatedCriterionId);
|
| - |
|
803 |
try {
|
| - |
|
804 |
client.updateAdwordsAdKeyword(adkeyword);
|
| - |
|
805 |
return true;
|
| - |
|
806 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
807 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services in updateAdwordsAdKeyword Method while updating Data");
|
| - |
|
808 |
logger.error("Error while performing operations with Saholic Google Adowrds Services in updateAdwordsAdKeyword Method while updating Data", e);
|
| - |
|
809 |
} catch (TException e) {
|
| - |
|
810 |
addActionError("Unable to perform operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while updating Data");
|
| - |
|
811 |
logger.error("Error while performing operations with Saholic Google Adowrds Services Client in updateAdwordsAdKeyword Method while updating Data", e);
|
| - |
|
812 |
}
|
| - |
|
813 |
}
|
| - |
|
814 |
else{
|
| - |
|
815 |
addActionError("Error while processing Update Request for Google AdGroupCriterion Service");
|
| - |
|
816 |
}
|
| - |
|
817 |
|
| - |
|
818 |
}
|
| - |
|
819 |
|
| 522 |
}
|
820 |
}
|
| 523 |
}
|
821 |
}
|
| 524 |
return false;
|
822 |
return false;
|
| 525 |
}
|
823 |
}
|
| 526 |
|
824 |
|
| Line 551... |
Line 849... |
| 551 |
}
|
849 |
}
|
| 552 |
|
850 |
|
| 553 |
public void setJsonData(JSONObject jsonData) {
|
851 |
public void setJsonData(JSONObject jsonData) {
|
| 554 |
this.jsonData = jsonData;
|
852 |
this.jsonData = jsonData;
|
| 555 |
}
|
853 |
}
|
| - |
|
854 |
|
| - |
|
855 |
public JSONObject getJsonCampaignData() {
|
| - |
|
856 |
return jsonCampaignData;
|
| - |
|
857 |
}
|
| - |
|
858 |
|
| - |
|
859 |
public void setJsonCampaignData(JSONObject jsonCampaignData) {
|
| - |
|
860 |
this.jsonCampaignData = jsonCampaignData;
|
| - |
|
861 |
}
|
| - |
|
862 |
|
| - |
|
863 |
public JSONObject getJsonAdgroupData() {
|
| - |
|
864 |
return jsonAdgroupData;
|
| - |
|
865 |
}
|
| - |
|
866 |
|
| - |
|
867 |
public void setJsonAdgroupData(JSONObject jsonAdgroupData) {
|
| - |
|
868 |
this.jsonAdgroupData = jsonAdgroupData;
|
| - |
|
869 |
}
|
| - |
|
870 |
|
| - |
|
871 |
public String getKeywordId() {
|
| - |
|
872 |
return keywordId;
|
| - |
|
873 |
}
|
| - |
|
874 |
|
| - |
|
875 |
public void setKeywordId(String keywordId) {
|
| - |
|
876 |
this.keywordId = keywordId;
|
| - |
|
877 |
}
|
| - |
|
878 |
|
| - |
|
879 |
public String getAdgroupId() {
|
| - |
|
880 |
return adgroupId;
|
| - |
|
881 |
}
|
| - |
|
882 |
|
| - |
|
883 |
public void setAdgroupId(String adgroupId) {
|
| - |
|
884 |
this.adgroupId = adgroupId;
|
| - |
|
885 |
}
|
| 556 |
|
886 |
|
| - |
|
887 |
public JSONObject getJsonKeywordList() {
|
| - |
|
888 |
return jsonKeywordList;
|
| - |
|
889 |
}
|
| - |
|
890 |
|
| - |
|
891 |
public void setJsonKeywordList(JSONObject jsonKeywordList) {
|
| - |
|
892 |
this.jsonKeywordList = jsonKeywordList;
|
| - |
|
893 |
}
|
| - |
|
894 |
|
| - |
|
895 |
public JSONObject getJsonKeywordData() {
|
| - |
|
896 |
return jsonKeywordData;
|
| - |
|
897 |
}
|
| - |
|
898 |
|
| - |
|
899 |
public void setJsonKeywordData(JSONObject jsonKeywordData) {
|
| - |
|
900 |
this.jsonKeywordData = jsonKeywordData;
|
| - |
|
901 |
}
|
| - |
|
902 |
|
| - |
|
903 |
public String getTextAdItemPrice(){
|
| - |
|
904 |
String itemPrice = "";
|
| - |
|
905 |
List<Item> itemList = new ArrayList<Item>();
|
| - |
|
906 |
try {
|
| - |
|
907 |
itemList = new CatalogClient().getClient().getItemsByCatalogId(Long.parseLong(catalogItemId));
|
| - |
|
908 |
} catch (NumberFormatException e) {
|
| - |
|
909 |
e.printStackTrace();
|
| - |
|
910 |
} catch (TTransportException e) {
|
| - |
|
911 |
e.printStackTrace();
|
| - |
|
912 |
} catch (CatalogServiceException e) {
|
| - |
|
913 |
e.printStackTrace();
|
| - |
|
914 |
} catch (TException e) {
|
| - |
|
915 |
e.printStackTrace();
|
| - |
|
916 |
}
|
| - |
|
917 |
|
| - |
|
918 |
for(Item item : itemList){
|
| - |
|
919 |
if(status.ACTIVE==item.getItemStatus()){
|
| - |
|
920 |
itemPrice = ((long)item.getSellingPrice()) + "";
|
| - |
|
921 |
break;
|
| - |
|
922 |
}
|
| - |
|
923 |
}
|
| - |
|
924 |
|
| - |
|
925 |
return itemPrice;
|
| - |
|
926 |
}
|
| 557 |
public String getAdgroupList(){
|
927 |
public String getAdgroupList(){
|
| 558 |
List<Map<String,String>> adgroupDataList = new ArrayList<Map<String,String>>();
|
928 |
List<Map<String,String>> adgroupDataList = new ArrayList<Map<String,String>>();
|
| 559 |
Map<String, List<Map<String,String>>> mainMap = new HashMap<String, List<Map<String,String>>>();
|
929 |
Map<String, List<Map<String,String>>> mainMap = new HashMap<String, List<Map<String,String>>>();
|
| 560 |
List<AdwordsAdGroup> adgroupList =null;
|
930 |
List<AdwordsAdGroup> adgroupList =null;
|
| 561 |
try {
|
931 |
try {
|
| Line 576... |
Line 946... |
| 576 |
}
|
946 |
}
|
| 577 |
mainMap.put("AdGroupData", adgroupDataList);
|
947 |
mainMap.put("AdGroupData", adgroupDataList);
|
| 578 |
jsonData = new JSONObject(mainMap);
|
948 |
jsonData = new JSONObject(mainMap);
|
| 579 |
return "output";
|
949 |
return "output";
|
| 580 |
}
|
950 |
}
|
| - |
|
951 |
|
| - |
|
952 |
public String getKeywordList(){
|
| - |
|
953 |
List<Map<String,String>> adkeywordDataList = new ArrayList<Map<String,String>>();
|
| - |
|
954 |
Map<String, List<Map<String,String>>> mainMap = new HashMap<String, List<Map<String,String>>>();
|
| - |
|
955 |
List<AdwordsAdKeyword> adkeywordList = null;
|
| - |
|
956 |
try {
|
| - |
|
957 |
adkeywordList = new AdwordsClient().getClient().getAdwordsAdKeywordsByAdgroupId(Long.parseLong(adgroupId));
|
| - |
|
958 |
}
|
| - |
|
959 |
catch (TTransportException e) {
|
| - |
|
960 |
e.printStackTrace();
|
| - |
|
961 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
962 |
e.printStackTrace();
|
| - |
|
963 |
} catch (TException e) {
|
| - |
|
964 |
e.printStackTrace();
|
| - |
|
965 |
}
|
| - |
|
966 |
|
| - |
|
967 |
for(AdwordsAdKeyword adkeyword : adkeywordList){
|
| - |
|
968 |
Map<String,String> adkeywordDataMap = new HashMap<String,String>();
|
| - |
|
969 |
adkeywordDataMap.put("KeywordId", adkeyword.getCriterionId()+"");
|
| - |
|
970 |
adkeywordDataMap.put("Text", adkeyword.getText());
|
| - |
|
971 |
adkeywordDataList.add(adkeywordDataMap);
|
| - |
|
972 |
}
|
| - |
|
973 |
mainMap.put("AdKeywordData", adkeywordDataList);
|
| - |
|
974 |
jsonKeywordList = new JSONObject(mainMap);
|
| - |
|
975 |
return "output";
|
| - |
|
976 |
}
|
| - |
|
977 |
|
| - |
|
978 |
public String getCampaignDetails(){
|
| - |
|
979 |
Map<String, String> campaignUnitDataMap = new HashMap<String, String>();
|
| - |
|
980 |
AdwordsCampaign campaign = null;
|
| - |
|
981 |
try {
|
| - |
|
982 |
campaign = new AdwordsClient().getClient().getAdwordsCampaignByCampaignId(Long.parseLong(campaignId));
|
| - |
|
983 |
} catch (NumberFormatException e) {
|
| - |
|
984 |
e.printStackTrace();
|
| - |
|
985 |
} catch (TTransportException e) {
|
| - |
|
986 |
e.printStackTrace();
|
| - |
|
987 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
988 |
e.printStackTrace();
|
| - |
|
989 |
} catch (TException e) {
|
| - |
|
990 |
e.printStackTrace();
|
| - |
|
991 |
}
|
| - |
|
992 |
|
| - |
|
993 |
if(campaign!=null){
|
| - |
|
994 |
campaignUnitDataMap.put("Name", campaign.getName());
|
| - |
|
995 |
campaignUnitDataMap.put("BudgetAmount", campaign.getBudgetAmount()+"");
|
| - |
|
996 |
campaignUnitDataMap.put("Status", campaign.getStatus().getValue()+"");
|
| - |
|
997 |
}
|
| - |
|
998 |
jsonCampaignData = new JSONObject(campaignUnitDataMap);
|
| - |
|
999 |
return "output";
|
| - |
|
1000 |
}
|
| - |
|
1001 |
|
| - |
|
1002 |
public String getAdGroupDetails(){
|
| - |
|
1003 |
Map<String, String> adgroupUnitDataMap = new HashMap<String, String>();
|
| - |
|
1004 |
AdwordsAdGroup adGroup = null;
|
| - |
|
1005 |
try {
|
| - |
|
1006 |
adGroup = new AdwordsClient().getClient().getAdwordsAdGroupByAdGroupId(Long.parseLong(adgroupId));
|
| - |
|
1007 |
} catch (NumberFormatException e) {
|
| - |
|
1008 |
e.printStackTrace();
|
| - |
|
1009 |
} catch (TTransportException e) {
|
| - |
|
1010 |
e.printStackTrace();
|
| - |
|
1011 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
1012 |
e.printStackTrace();
|
| - |
|
1013 |
} catch (TException e) {
|
| - |
|
1014 |
e.printStackTrace();
|
| - |
|
1015 |
}
|
| - |
|
1016 |
|
| - |
|
1017 |
if(adGroup!=null){
|
| - |
|
1018 |
adgroupUnitDataMap.put("Name", adGroup.getName());
|
| - |
|
1019 |
adgroupUnitDataMap.put("BidAmount", adGroup.getBidAmount()+"");
|
| - |
|
1020 |
adgroupUnitDataMap.put("Status", adGroup.getStatus().getValue()+"");
|
| - |
|
1021 |
adgroupUnitDataMap.put("CatalogItemId", adGroup.getCatalogItemId()+"");
|
| - |
|
1022 |
}
|
| - |
|
1023 |
jsonAdgroupData = new JSONObject(adgroupUnitDataMap);
|
| - |
|
1024 |
return "output";
|
| - |
|
1025 |
}
|
| - |
|
1026 |
|
| - |
|
1027 |
public String getKeywordDetails(){
|
| - |
|
1028 |
Map<String, String> adkeywordUnitDataMap = new HashMap<String, String>();
|
| - |
|
1029 |
AdwordsAdKeyword adKeyword = null;
|
| - |
|
1030 |
try {
|
| - |
|
1031 |
System.out.println("keywordId" +keywordId);
|
| - |
|
1032 |
System.out.println("adgroupId" +adgroupId);
|
| - |
|
1033 |
adKeyword = new AdwordsClient().getClient().getAdwordsAdKeywordByCriterionIdAndAdGroupId(Long.parseLong(keywordId), Long.parseLong(adgroupId));
|
| - |
|
1034 |
} catch (NumberFormatException e) {
|
| - |
|
1035 |
e.printStackTrace();
|
| - |
|
1036 |
} catch (TTransportException e) {
|
| - |
|
1037 |
e.printStackTrace();
|
| - |
|
1038 |
} catch (GoogleAdwordsServiceException e) {
|
| - |
|
1039 |
e.printStackTrace();
|
| - |
|
1040 |
} catch (TException e) {
|
| - |
|
1041 |
e.printStackTrace();
|
| - |
|
1042 |
}
|
| - |
|
1043 |
|
| - |
|
1044 |
if(adKeyword!=null){
|
| - |
|
1045 |
adkeywordUnitDataMap.put("Text", adKeyword.getText());
|
| - |
|
1046 |
adkeywordUnitDataMap.put("Bid", adKeyword.getBidAmount()+"");
|
| - |
|
1047 |
adkeywordUnitDataMap.put("MatchType", adKeyword.getMatchType().getValue()+"");
|
| - |
|
1048 |
}
|
| - |
|
1049 |
jsonKeywordData = new JSONObject(adkeywordUnitDataMap);
|
| - |
|
1050 |
return "output";
|
| - |
|
1051 |
}
|
| 581 |
|
1052 |
|
| 582 |
public List<AdwordsCampaign> getCampaigns(){
|
1053 |
public List<AdwordsCampaign> getCampaigns(){
|
| 583 |
List<AdwordsCampaign> campaignList =null;
|
1054 |
List<AdwordsCampaign> campaignList =null;
|
| 584 |
try {
|
1055 |
try {
|
| 585 |
campaignList = new AdwordsClient().getClient().getAllAdwordsCampaigns();
|
1056 |
campaignList = new AdwordsClient().getClient().getAllAdwordsCampaigns();
|
| Line 922... |
Line 1393... |
| 922 |
|
1393 |
|
| 923 |
public void setStockLinked(String stockLinked) {
|
1394 |
public void setStockLinked(String stockLinked) {
|
| 924 |
this.stockLinked = stockLinked;
|
1395 |
this.stockLinked = stockLinked;
|
| 925 |
}
|
1396 |
}
|
| 926 |
|
1397 |
|
| - |
|
1398 |
public String getAdwordUpdateRadio() {
|
| - |
|
1399 |
return adwordUpdateRadio;
|
| - |
|
1400 |
}
|
| - |
|
1401 |
|
| - |
|
1402 |
public void setAdwordUpdateRadio(String adwordUpdateRadio) {
|
| - |
|
1403 |
this.adwordUpdateRadio = adwordUpdateRadio;
|
| - |
|
1404 |
}
|
| - |
|
1405 |
|
| - |
|
1406 |
public String getCampaignListUpdate1() {
|
| - |
|
1407 |
return campaignListUpdate1;
|
| - |
|
1408 |
}
|
| - |
|
1409 |
|
| - |
|
1410 |
public void setCampaignListUpdate1(String campaignListUpdate1) {
|
| - |
|
1411 |
this.campaignListUpdate1 = campaignListUpdate1;
|
| - |
|
1412 |
}
|
| - |
|
1413 |
|
| - |
|
1414 |
public String getCampaignNameUpdate() {
|
| - |
|
1415 |
return campaignNameUpdate;
|
| - |
|
1416 |
}
|
| - |
|
1417 |
|
| - |
|
1418 |
public void setCampaignNameUpdate(String campaignNameUpdate) {
|
| - |
|
1419 |
this.campaignNameUpdate = campaignNameUpdate;
|
| - |
|
1420 |
}
|
| - |
|
1421 |
|
| - |
|
1422 |
public String getCampaignStatusUpdate() {
|
| - |
|
1423 |
return campaignStatusUpdate;
|
| - |
|
1424 |
}
|
| - |
|
1425 |
|
| - |
|
1426 |
public void setCampaignStatusUpdate(String campaignStatusUpdate) {
|
| - |
|
1427 |
this.campaignStatusUpdate = campaignStatusUpdate;
|
| - |
|
1428 |
}
|
| - |
|
1429 |
|
| - |
|
1430 |
public String getCampaignAmountUpdate() {
|
| - |
|
1431 |
return campaignAmountUpdate;
|
| - |
|
1432 |
}
|
| - |
|
1433 |
|
| - |
|
1434 |
public void setCampaignAmountUpdate(String campaignAmountUpdate) {
|
| - |
|
1435 |
this.campaignAmountUpdate = campaignAmountUpdate;
|
| - |
|
1436 |
}
|
| - |
|
1437 |
|
| - |
|
1438 |
public String getCampaignListUpdate2() {
|
| - |
|
1439 |
return campaignListUpdate2;
|
| - |
|
1440 |
}
|
| - |
|
1441 |
|
| - |
|
1442 |
public void setCampaignListUpdate2(String campaignListUpdate2) {
|
| - |
|
1443 |
this.campaignListUpdate2 = campaignListUpdate2;
|
| - |
|
1444 |
}
|
| - |
|
1445 |
|
| - |
|
1446 |
public String getAdgroupListUpdate1() {
|
| - |
|
1447 |
return adgroupListUpdate1;
|
| - |
|
1448 |
}
|
| - |
|
1449 |
|
| - |
|
1450 |
public void setAdgroupListUpdate1(String adgroupListUpdate1) {
|
| - |
|
1451 |
this.adgroupListUpdate1 = adgroupListUpdate1;
|
| - |
|
1452 |
}
|
| - |
|
1453 |
|
| - |
|
1454 |
public String getAdgroupNameUpdate() {
|
| - |
|
1455 |
return adgroupNameUpdate;
|
| - |
|
1456 |
}
|
| - |
|
1457 |
|
| - |
|
1458 |
public void setAdgroupNameUpdate(String adgroupNameUpdate) {
|
| - |
|
1459 |
this.adgroupNameUpdate = adgroupNameUpdate;
|
| - |
|
1460 |
}
|
| - |
|
1461 |
|
| - |
|
1462 |
public String getAdgroupStatusUpdate() {
|
| - |
|
1463 |
return adgroupStatusUpdate;
|
| - |
|
1464 |
}
|
| - |
|
1465 |
|
| - |
|
1466 |
public void setAdgroupStatusUpdate(String adgroupStatusUpdate) {
|
| - |
|
1467 |
this.adgroupStatusUpdate = adgroupStatusUpdate;
|
| - |
|
1468 |
}
|
| - |
|
1469 |
|
| - |
|
1470 |
public String getCatalogItemIdUpdate() {
|
| - |
|
1471 |
return catalogItemIdUpdate;
|
| - |
|
1472 |
}
|
| - |
|
1473 |
|
| - |
|
1474 |
public void setCatalogItemIdUpdate(String catalogItemIdUpdate) {
|
| - |
|
1475 |
this.catalogItemIdUpdate = catalogItemIdUpdate;
|
| - |
|
1476 |
}
|
| - |
|
1477 |
|
| - |
|
1478 |
public String getBidAmountUpdate() {
|
| - |
|
1479 |
return bidAmountUpdate;
|
| - |
|
1480 |
}
|
| - |
|
1481 |
|
| - |
|
1482 |
public void setBidAmountUpdate(String bidAmountUpdate) {
|
| - |
|
1483 |
this.bidAmountUpdate = bidAmountUpdate;
|
| - |
|
1484 |
}
|
| - |
|
1485 |
|
| - |
|
1486 |
public String getCampaignListUpdate3() {
|
| - |
|
1487 |
return campaignListUpdate3;
|
| - |
|
1488 |
}
|
| - |
|
1489 |
|
| - |
|
1490 |
public void setCampaignListUpdate3(String campaignListUpdate3) {
|
| - |
|
1491 |
this.campaignListUpdate3 = campaignListUpdate3;
|
| - |
|
1492 |
}
|
| - |
|
1493 |
|
| - |
|
1494 |
public String getAdgroupListUpdate2() {
|
| - |
|
1495 |
return adgroupListUpdate2;
|
| - |
|
1496 |
}
|
| - |
|
1497 |
|
| - |
|
1498 |
public void setAdgroupListUpdate2(String adgroupListUpdate2) {
|
| - |
|
1499 |
this.adgroupListUpdate2 = adgroupListUpdate2;
|
| - |
|
1500 |
}
|
| - |
|
1501 |
|
| - |
|
1502 |
public String getKeywordUpdate() {
|
| - |
|
1503 |
return keywordUpdate;
|
| - |
|
1504 |
}
|
| - |
|
1505 |
|
| - |
|
1506 |
public void setKeywordUpdate(String keywordUpdate) {
|
| - |
|
1507 |
this.keywordUpdate = keywordUpdate;
|
| - |
|
1508 |
}
|
| - |
|
1509 |
|
| - |
|
1510 |
public String getBidUpdate() {
|
| - |
|
1511 |
return bidUpdate;
|
| - |
|
1512 |
}
|
| - |
|
1513 |
|
| - |
|
1514 |
public void setBidUpdate(String bidUpdate) {
|
| - |
|
1515 |
this.bidUpdate = bidUpdate;
|
| - |
|
1516 |
}
|
| - |
|
1517 |
|
| - |
|
1518 |
public String getMatchTypeUpdate() {
|
| - |
|
1519 |
return matchTypeUpdate;
|
| - |
|
1520 |
}
|
| - |
|
1521 |
|
| - |
|
1522 |
public void setMatchTypeUpdate(String matchTypeUpdate) {
|
| - |
|
1523 |
this.matchTypeUpdate = matchTypeUpdate;
|
| - |
|
1524 |
}
|
| - |
|
1525 |
|
| - |
|
1526 |
public String getKeywordListUpdate1() {
|
| - |
|
1527 |
return keywordListUpdate1;
|
| - |
|
1528 |
}
|
| - |
|
1529 |
|
| - |
|
1530 |
public void setKeywordListUpdate1(String keywordListUpdate1) {
|
| - |
|
1531 |
this.keywordListUpdate1 = keywordListUpdate1;
|
| - |
|
1532 |
}
|
| - |
|
1533 |
|
| 927 |
}
|
1534 |
}
|