1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| package xxxxxxxxxxxx.business.service;
import xxxxxxxxxxxx.business.repository.CreationCampagneBlocRepository;
import xxxxxxxxxxxx.domain.TDV.CampagneCartouche;
import xxxxxxxxxxxx.domain.alm.Models;
import xxxxxxxxxxxx.domain.alm.copyEntity.Copy;
import xxxxxxxxxxxx.domain.alm.release.Release;
import xxxxxxxxxxxx.domain.alm.release.ReleaseCycle;
import xxxxxxxxxxxx.domain.alm.release.ReleaseFolder;
import xxxxxxxxxxxx.jhutil.config.ApplicationProperties;
import xxxxxxxxxxxx.tool.ObjectRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
@Service
public class CreationCampagneBlocService
{
@Autowired
RestTemplate restTemplate;
@Autowired
ApplicationProperties applicationProperties;
private final CreationCampagneBlocRepository creationCampagneBlocRepository;
public CreationCampagneBlocService (CreationCampagneBlocRepository creationCampagneBlocRepository) {this.creationCampagneBlocRepository = creationCampagneBlocRepository;}
public void templateSearch(CampagneCartouche objectRequest)
{
creationCampagneBlocRepository.requestLoging("https://xxxxxxxxxxxxxxx/qcbin/api/authentication/sign-in");
//TODO URLs actuellement en dur !!!! Il faudra récuperer les links en entrées de ce service
String urlEnveloppe = "https://xxxxxxxxxxxxxxx/qcbin/rest/domains/dom_g/projects/greenwich_dev";
String folderReleaseCible = urlEnveloppe+"/"+ Models.RELEASEFOLDER+"s/134";
int folderTemplateTestLab;
int folderRoot;
ArrayList<ReleaseFolder> listOfFolderRel= null;
ReleaseFolder folderRel= null;
ArrayList<Release> listOfReleases= null;
Release release= null;
ArrayList<ReleaseCycle> listOfCycles= null;
ReleaseCycle cycle = null;
try {
creationCampagneBlocRepository.readWithURL(new ObjectRequest().setURLEntity(folderReleaseCible));
} catch (Exception e) {
e.printStackTrace();
}
creationCampagneBlocRepository.requestLoging("https://xxxxxxxxxxxxxxx/qcbin/api/authentication/sign-out");
}
public String copyTemplate(String idSource, String idTarget)
{
creationCampagneBlocRepository.requestLoging("https://xxxxxxxxxxxxxxx/qcbin/api/authentication/sign-in");
String response = "";
Copy entityTest = new Copy();
entityTest.getID().add(idSource);
entityTest.setTargetParentId(idTarget);
ObjectRequest objectRequest = new ObjectRequest();
objectRequest.setURLEntity("https://xxxxxxxxxxxxxxx/qcbin/rest/domains/DOM_G/projects/Greenwich_dev/test-set-folders/copy");
objectRequest.setCopy(entityTest);
try {
response = creationCampagneBlocRepository.copyEntityWithURL(objectRequest).getBody().toString();
} catch (Exception e) {
e.printStackTrace();
}
creationCampagneBlocRepository.requestLoging("https://xxxxxxxxxxxxxxx/qcbin/api/authentication/sign-out");
return response;
}
} |
Partager