本文整理匯總了Java中org.xdi.model.TrustContact類的典型用法代碼示例。如果您正苦於以下問題:Java TrustContact類的具體用法?Java TrustContact怎麽用?Java TrustContact使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TrustContact類屬於org.xdi.model包,在下文中一共展示了TrustContact類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setContacts
import org.xdi.model.TrustContact; //導入依賴的package包/類
@POST
@Path("/set_contacts")
@Consumes({MediaType.APPLICATION_JSON})
@Produces(MediaType.TEXT_PLAIN)
public void setContacts(@PathParam("inum") String trustRelationshipInum, String contacts, @Context HttpServletResponse response) {
try {
GluuSAMLTrustRelationship trustRelationship = trustService.getRelationshipByInum(trustRelationshipInum);
List<TrustContact> contactsList = objectMapper.readValue(contacts, new TypeReference<List<TrustContact>>() {});
trustService.saveContacts(trustRelationship, contactsList);
} catch (Exception e) {
logger.error("setContacts() Exception", e);
try { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR"); } catch (Exception ex) {}
}
}
示例2: getContacts
import org.xdi.model.TrustContact; //導入依賴的package包/類
public List<TrustContact> getContacts(GluuSAMLTrustRelationship trustRelationship) {
List<String> gluuTrustContacts = trustRelationship.getGluuTrustContact();
List<TrustContact> contacts = new ArrayList<TrustContact>();
if (gluuTrustContacts != null) {
for (String contact : gluuTrustContacts) {
contacts.add(xmlService.getTrustContactFromXML(contact));
}
}
return contacts;
}
示例3: saveContacts
import org.xdi.model.TrustContact; //導入依賴的package包/類
public void saveContacts(GluuSAMLTrustRelationship trustRelationship, List<TrustContact> contacts) {
if (contacts != null && !contacts.isEmpty()) {
List<String> gluuTrustContacts = new ArrayList<String>();
for (TrustContact contact : contacts) {
gluuTrustContacts.add(xmlService.getXMLFromTrustContact(contact));
}
trustRelationship.setGluuTrustContact(gluuTrustContacts);
}
}
示例4: removeEmptyContacts
import org.xdi.model.TrustContact; //導入依賴的package包/類
private void removeEmptyContacts() {
TrustContact emptyContact = new TrustContact();
emptyContact.setMail("");
emptyContact.setName("");
emptyContact.setPhone("");
emptyContact.setTitle("");
List<TrustContact> trustContacts = new ArrayList<TrustContact>(contacts);
for (TrustContact contact : trustContacts) {
if (contact.equals(emptyContact)) {
contacts.remove(contact);
}
}
}
示例5: getContacts
import org.xdi.model.TrustContact; //導入依賴的package包/類
@GET
@Path("/get_contacts")
@Produces(MediaType.TEXT_PLAIN)
public String getContacts(@PathParam("inum") String trustRelationshipInum, @Context HttpServletResponse response) {
try {
GluuSAMLTrustRelationship trustRelationship = trustService.getRelationshipByInum(trustRelationshipInum);
List<TrustContact> list = trustService.getContacts(trustRelationship);
//convert to JSON
return objectMapper.writeValueAsString(list);
} catch (Exception e) {
logger.error("getContacts() Exception", e);
try { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "INTERNAL SERVER ERROR"); } catch (Exception ex) {}
return OxTrustConstants.RESULT_FAILURE;
}
}
示例6: init
import org.xdi.model.TrustContact; //導入依賴的package包/類
@PostConstruct
public void init() {
try {
this.jaxbContext = JAXBContext.newInstance(GluuImage.class, TrustContact.class);
this.jaxbMarshaller = this.jaxbContext.createMarshaller();
this.jaxbUnmarshaller = this.jaxbContext.createUnmarshaller();
} catch (JAXBException ex) {
log.error("Failed to create JAXB marshaller and unmarshaller", ex);
}
}
示例7: getTrustContactFromXML
import org.xdi.model.TrustContact; //導入依賴的package包/類
public TrustContact getTrustContactFromXML(String xml) {
if (xml == null) {
return null;
}
try {
ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes("UTF-8"));
return (TrustContact) this.jaxbUnmarshaller.unmarshal(bis);
} catch (Exception ex) {
log.error("Failed to create TrustContact from XML {}", ex, xml);
}
return null;
}
示例8: getXMLFromTrustContact
import org.xdi.model.TrustContact; //導入依賴的package包/類
public String getXMLFromTrustContact(TrustContact contact) {
if (contact == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
this.jaxbMarshaller.marshal(contact, bos);
return new String(bos.toByteArray(), "UTF-8");
} catch (Exception ex) {
log.error("Failed to convert TrustContact {} to XML", ex, contact);
}
return null;
}
示例9: getTrustContacts
import org.xdi.model.TrustContact; //導入依賴的package包/類
public List<TrustContact> getTrustContacts() {
return contacts;
}
示例10: removeContact
import org.xdi.model.TrustContact; //導入依賴的package包/類
public void removeContact(TrustContact contact) {
contacts.remove(contact);
}
示例11: addEmptyContact
import org.xdi.model.TrustContact; //導入依賴的package包/類
public void addEmptyContact() {
// Util.removeDuplicateWithOrder(contacts);
contacts.add(new TrustContact());
}