use of io.jans.ca.server.persistence.modal.RpObject in project jans by JanssenProject.
the class JansPersistenceService method getRp.
public Rp getRp(String rpId) {
try {
RpObject rpFromGluuPersistance = getRpObject(rpId, new String[0]);
Rp rp = MigrationService.parseRp(rpFromGluuPersistance.getData());
if (rp != null) {
LOG.debug("Found RP id: {}, RP : {} ", rpId, rp);
return rp;
}
LOG.error("Failed to fetch RP by id: {} ", rpId);
return null;
} catch (Exception e) {
LOG.error("Failed to update rpId: {} ", rpId, e);
}
return null;
}
use of io.jans.ca.server.persistence.modal.RpObject in project jans by JanssenProject.
the class JansPersistenceService method update.
public boolean update(Rp rp) {
try {
RpObject rpObj = new RpObject(getDnForRp(rp.getRpId()), rp.getRpId(), Jackson2.serializeWithoutNulls(rp));
this.persistenceEntryManager.merge(rpObj);
LOG.debug("RP updated successfully. RP : {} ", rpObj);
return true;
} catch (Exception e) {
LOG.error("Failed to update RP: {} ", rp, e);
}
return false;
}
use of io.jans.ca.server.persistence.modal.RpObject in project jans by JanssenProject.
the class JansPersistenceService method create.
public boolean create(Rp rp) {
try {
RpObject rpObj = new RpObject(getDnForRp(rp.getRpId()), rp.getRpId(), Jackson2.serializeWithoutNulls(rp));
this.persistenceEntryManager.persist(rpObj);
LOG.debug("RP created successfully. RP : {} ", rp);
return true;
} catch (Exception e) {
LOG.error("Failed to create RP: {} ", rp, e);
}
return false;
}
use of io.jans.ca.server.persistence.modal.RpObject in project jans by JanssenProject.
the class JansPersistenceService method getRps.
public Set<Rp> getRps() {
try {
List<RpObject> rpObjects = this.persistenceEntryManager.findEntries(String.format("%s,%s", new Object[] { getRpOu(), getClientApiDn() }), RpObject.class, null);
Set<Rp> result = new HashSet();
for (RpObject ele : rpObjects) {
Rp rp = MigrationService.parseRp(ele.getData());
if (rp != null) {
result.add(rp);
} else {
LOG.error("Failed to parse rp, id: {}, dn: {} ", ele.getId(), ele.getDn());
}
}
return result;
} catch (Exception e) {
if (((e instanceof EntryPersistenceException)) && (e.getMessage().contains("Failed to find entries"))) {
LOG.warn("Failed to fetch RpObjects. {} ", e.getMessage());
return null;
}
LOG.error("Failed to fetch rps. Error: {} ", e.getMessage(), e);
}
return null;
}
Aggregations