當前位置: 首頁>>代碼示例>>Java>>正文


Java TrustContact類代碼示例

本文整理匯總了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) {}
    }
}
 
開發者ID:GluuFederation,項目名稱:oxTrust,代碼行數:17,代碼來源:TrustRelationshipWebService.java

示例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;
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:11,代碼來源:TrustService.java

示例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);
	}
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:10,代碼來源:TrustService.java

示例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);
		}
	}
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:14,代碼來源:TrustContactsAction.java

示例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;
    }
}
 
開發者ID:GluuFederation,項目名稱:oxTrust,代碼行數:16,代碼來源:TrustRelationshipWebService.java

示例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);
    }
}
 
開發者ID:GluuFederation,項目名稱:oxCore,代碼行數:11,代碼來源:XmlService.java

示例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;
}
 
開發者ID:GluuFederation,項目名稱:oxCore,代碼行數:15,代碼來源:XmlService.java

示例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;
}
 
開發者ID:GluuFederation,項目名稱:oxCore,代碼行數:16,代碼來源:XmlService.java

示例9: getTrustContacts

import org.xdi.model.TrustContact; //導入依賴的package包/類
public List<TrustContact> getTrustContacts() {
	return contacts;
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:4,代碼來源:TrustContactsAction.java

示例10: removeContact

import org.xdi.model.TrustContact; //導入依賴的package包/類
public void removeContact(TrustContact contact) {
	contacts.remove(contact);
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:4,代碼來源:TrustContactsAction.java

示例11: addEmptyContact

import org.xdi.model.TrustContact; //導入依賴的package包/類
public void addEmptyContact() {
	// Util.removeDuplicateWithOrder(contacts);
	contacts.add(new TrustContact());
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:5,代碼來源:TrustContactsAction.java


注:本文中的org.xdi.model.TrustContact類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。