use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemManagerBlImpl method updatePublicationSystem.
public PublicationSystem updatePublicationSystem(PerunSession session, PublicationSystem ps) throws CabinetException, InternalErrorException {
PublicationSystem upps = getPublicationSystemManagerDao().updatePublicationSystem(session, ps);
log.debug("{} updated.", upps);
return upps;
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationManagerBlImpl method createPublication.
// business methods --------------------------------
@Override
public Publication createPublication(PerunSession sess, Publication p) throws CabinetException, InternalErrorException {
if (p.getCreatedDate() == null)
p.setCreatedDate(new Date());
p.setCreatedByUid(sess.getPerunPrincipal().getUserId());
// check existence
if (publicationExists(p)) {
throw new CabinetException("Cannot create duplicate publication: " + p, ErrorCodes.PUBLICATION_ALREADY_EXISTS);
}
Publication createdPublication;
if (p.getExternalId() == 0 && p.getPublicationSystemId() == 0) {
// get internal pub. system
PublicationSystem ps = getPublicationSystemManagerBl().getPublicationSystemByName("INTERNAL");
// There is only one internal system so, get(0) is safe
p.setPublicationSystemId(ps.getId());
}
stripLongParams(p);
createdPublication = getPublicationManagerDao().createPublication(sess, p);
log.debug("{} created.", createdPublication);
return createdPublication;
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemManagerBlImpl method createPublicationSystem.
// methods -----------------------------
public PublicationSystem createPublicationSystem(PerunSession session, PublicationSystem ps) throws InternalErrorException {
PublicationSystem newps = getPublicationSystemManagerDao().createPublicationSystem(session, ps);
log.debug("{} created.", newps);
return newps;
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemStrategyIntegrationTest method contactPublicationSystemMUTest.
@Test
public void contactPublicationSystemMUTest() throws Exception {
System.out.println("PublicationSystemStrategyIntegrationTest.contactPublicationSystemMUTest");
PublicationSystem publicationSystem = getCabinetManager().getPublicationSystemByNamespace("mu");
assertNotNull(publicationSystem);
PublicationSystemStrategy prezentator = (PublicationSystemStrategy) Class.forName(publicationSystem.getType()).newInstance();
assertNotNull(prezentator);
String authorId = "39700";
int yearSince = 2009;
int yearTill = 2010;
HttpResponse result = prezentator.execute(prezentator.getHttpRequest(authorId, yearSince, yearTill, publicationSystem));
assertNotNull(result);
}
use of cz.metacentrum.perun.cabinet.model.PublicationSystem in project perun by CESNET.
the class PublicationSystemManagerIntegrationTest method getPublicationSystemById.
@Test
public void getPublicationSystemById() throws Exception {
System.out.println("PublicationSystemManagerIntegrationTest.getPublicationSystemById");
PublicationSystem publicationSystem = getCabinetManager().getPublicationSystemById(pubSysZcu.getId());
assertNotNull(publicationSystem);
assertTrue(Objects.equals(publicationSystem, pubSysZcu));
PublicationSystemStrategy ps = (PublicationSystemStrategy) Class.forName(publicationSystem.getType()).newInstance();
assertNotNull(ps);
}
Aggregations