📄 registeredinfocardinfoadmin.java
字号:
/* * Copyright 2005-2007 WSO2, Inc. (http://wso2.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.wso2.solutions.identity.admin;import org.wso2.solutions.identity.IdentityProviderException;import org.wso2.solutions.identity.persistence.IPPersistenceManager;import org.wso2.solutions.identity.persistence.dataobject.RegisteredInfoCardInfoDO;import org.wso2.solutions.identity.persistence.dataobject.RemovedRegisteredInfoCardInfoDO;import java.util.Arrays;import java.util.Date;import java.util.List;public class RegisteredInfoCardInfoAdmin { public void registerNewInfoCardInformation(String ppid, String userId, String issuerInfo) throws IdentityProviderException { RegisteredInfoCardInfoDO info = new RegisteredInfoCardInfoDO(); info.setPpid(ppid); info.setUserId(userId); info.setIssuerInfo(issuerInfo); IPPersistenceManager db = IPPersistenceManager.getPersistanceManager(); db.create(info); } /** * Check whether there is a registered information card with the given ppid. * * @param ppid * The ppid to be checked for. * @return true if there is a registered card exists with the given ppid. */ public boolean isRegistedInformationCard(String ppid) throws IdentityProviderException { return getInfo(ppid) != null; } public List getAllRegisteredInfoCards(String userId) throws IdentityProviderException { IPPersistenceManager db = IPPersistenceManager.getPersistanceManager(); return Arrays.asList((RegisteredInfoCardInfoDO[]) db .getAllRegistedInfoCardInfoForUser(userId)); } public RegisteredInfoCardInfoDO getInfo(String ppid) throws IdentityProviderException { IPPersistenceManager db = IPPersistenceManager.getPersistanceManager(); return db.getRegisteredInfoCardInfo(ppid); } public void removeRegisteredInfoCard(String ppid) throws IdentityProviderException { IPPersistenceManager db = IPPersistenceManager.getPersistanceManager(); RegisteredInfoCardInfoDO infoCard = db.getRegisteredInfoCardInfo(ppid); RemovedRegisteredInfoCardInfoDO removedCard = new RemovedRegisteredInfoCardInfoDO(); removedCard.setPpid(ppid); removedCard.setUserId(infoCard.getUserId()); removedCard.setIssuerInfo(infoCard.getIssuerInfo()); removedCard.setRemovedDate(new Date()); db.create(removedCard); db.delete(infoCard); } /** * This method extracts the primary username if there is one. * If there is no primary username ... null will be returned. */ public String extractPrimaryUserName(String ppid) throws IdentityProviderException{ IPPersistenceManager db = IPPersistenceManager.getPersistanceManager(); return db.extractPrimaryUserName(ppid); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -