diff options
| author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2013-08-06 18:53:14 +0200 | 
|---|---|---|
| committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2013-08-06 18:53:14 +0200 | 
| commit | 328f850d0b5775bc8aed8f5ced1a6ef6269cb831 (patch) | |
| tree | 8b1cd2f0cf4e6e303af7fcd4f53f74d53db1b855 /id/server/moa-id-commons/src | |
| parent | 845d7241c2556d36cfd91cdca8ddeb11f0395e6e (diff) | |
| download | moa-id-spss-328f850d0b5775bc8aed8f5ced1a6ef6269cb831.tar.gz moa-id-spss-328f850d0b5775bc8aed8f5ced1a6ef6269cb831.tar.bz2 moa-id-spss-328f850d0b5775bc8aed8f5ced1a6ef6269cb831.zip | |
 - Change UserBase implementation
 - starts with general MOAID Config
Diffstat (limited to 'id/server/moa-id-commons/src')
5 files changed, 42 insertions, 328 deletions
| diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java index e815f2a69..67bc2b918 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/ConfigurationDBRead.java @@ -22,10 +22,8 @@ public class ConfigurationDBRead {      	  QUERIES.put("getOnlineApplicationWithDBID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id");      	  QUERIES.put("getAllOnlineApplications", "select onlineapplication from OnlineApplication onlineapplication");      	  QUERIES.put("getMOAIDConfiguration", "select moaidconfiguration from MOAIDConfiguration moaidconfiguration"); -    	  QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.id = :id"); -    	  QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id"); -    	  QUERIES.put("searchOnlineApplicationsFormUserWithID", "select onlineapplication from UserDatabase userdatabase, OnlineApplication onlineapplication where userdatabase.id = :userid and userdatabase.registratedOAs.friendlyName like :oaid");	   -      } +    	  QUERIES.put("getUserWithUserID", "select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id"); +    	  QUERIES.put("searchOnlineApplicationsWithID", "select onlineapplication from OnlineApplication onlineapplication where onlineapplication.friendlyName like :id");      }  	  @SuppressWarnings("rawtypes")  	  public static OnlineApplication getActiveOnlineApplication(String id) { @@ -156,34 +154,7 @@ public class ConfigurationDBRead {    		return result;  	  } -	   -	  @SuppressWarnings("rawtypes") -	  public static List<OnlineApplication> searchOnlineApplicationsFromUser(long userid, String oaid) { -	  	MiscUtil.assertNotNull(oaid, "OnlineApplictionID"); -	  	MiscUtil.assertNotNull(userid, "UserID"); -	  	 -		Logger.trace("Getting OnlineApplication with ID " + oaid  -				+ " from user with UserID " + userid + " database."); -		 -		List<OnlineApplication> result; -  		EntityManager session = ConfigurationDBUtils.getCurrentSession(); -	  	 -  		javax.persistence.Query query = session.createQuery(QUERIES.get("searchOnlineApplicationsFormUserWithID")); -  		query.setParameter("userid", userid); -  		query.setParameter("oaid", "%"+oaid+"%"); -  		 -  		result = query.getResultList(); -  	 -  		Logger.trace("Found entries: " + result.size()); -     -  		if (result.size() == 0) { -  			Logger.trace("No entries found."); -  			return null; -  		} -  		  		 -  		return result; -	  } -	   +	  	    	  public static UserDatabase getUserWithID(long id) {  		  	MiscUtil.assertNotNull(id, "UserID");  			Logger.trace("Getting Userinformation with ID " + id + " from database."); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java deleted file mode 100644 index d1887bfa6..000000000 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/UserDatabase.java +++ /dev/null @@ -1,263 +0,0 @@ -package at.gv.egovernment.moa.id.commons.db.dao.config; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.PreUpdate; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import org.hibernate.annotations.DynamicUpdate; - -import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; - - -@Entity -@DynamicUpdate(value=true) -@Table(name = "userdatabase") -public class UserDatabase implements Serializable{ - -	private static final long serialVersionUID = 1L; - -	@Id -	@GeneratedValue(strategy = GenerationType.IDENTITY) -	@Column(name = "id", unique=true, nullable=false) -	private long id; -	 -	@Column(name = "givenname", nullable=false) -	private String givenname; -	 -	@Column(name = "familyname", nullable=false) -	private String familyname; -	 -	@Column(name = "institut", nullable=false) -	private String institut; -	 -	@Column(name = "mail", nullable=false) -	private String mail; -	 -	@Column(name = "phone", nullable=false) -	private String phone; -	 -	@Column(name = "username", unique=true, nullable=false) -	private String username; -	 -	@Column(name = "password", nullable=false) -	private String password; -	 -	@Column(name = "bpk", unique=true, nullable=false) -	private String bpk; -	 -	@Column(name = "isadmin", nullable=false) -	private boolean isadmin; -	 -	@Column(name = "isactive", nullable=false) -	private boolean isactive; -	 -	@OneToMany(mappedBy="hjid", cascade=CascadeType.REFRESH) -    private List<OnlineApplication> registratedOAs = null; -	 -    @Column(name = "lastlogin") -    @Temporal(TemporalType.TIMESTAMP) -    private Date lastlogin; -     -    @PreUpdate -    protected void lastUpdate() { -    this.lastlogin = new Date(); -    } - -	/** -	 * @return the id -	 */ -	public long getId() { -		return id; -	} - -	/** -	 * @param id the id to set -	 */ -	public void setId(long id) { -		this.id = id; -	} - -	/** -	 * @return the givenname -	 */ -	public String getGivenname() { -		return givenname; -	} - -	/** -	 * @param givenname the givenname to set -	 */ -	public void setGivenname(String givenname) { -		this.givenname = givenname; -	} - -	/** -	 * @return the familyname -	 */ -	public String getFamilyname() { -		return familyname; -	} - -	/** -	 * @param familyname the familyname to set -	 */ -	public void setFamilyname(String familyname) { -		this.familyname = familyname; -	} - -	/** -	 * @return the institut -	 */ -	public String getInstitut() { -		return institut; -	} - -	/** -	 * @param institut the institut to set -	 */ -	public void setInstitut(String institut) { -		this.institut = institut; -	} - -	/** -	 * @return the mail -	 */ -	public String getMail() { -		return mail; -	} - -	/** -	 * @param mail the mail to set -	 */ -	public void setMail(String mail) { -		this.mail = mail; -	} - -	/** -	 * @return the phone -	 */ -	public String getPhone() { -		return phone; -	} - -	/** -	 * @param phone the phone to set -	 */ -	public void setPhone(String phone) { -		this.phone = phone; -	} - -	/** -	 * @return the username -	 */ -	public String getUsername() { -		return username; -	} - -	/** -	 * @param username the username to set -	 */ -	public void setUsername(String username) { -		this.username = username; -	} - -	/** -	 * @return the password -	 */ -	public String getPassword() { -		return password; -	} - -	/** -	 * @param password the password to set -	 */ -	public void setPassword(String password) { -		this.password = password; -	} - -	/** -	 * @return the bpk -	 */ -	public String getBpk() { -		return bpk; -	} - -	/** -	 * @param bpk the bpk to set -	 */ -	public void setBpk(String bpk) { -		this.bpk = bpk; -	} - -	/** -	 * @return the isadmin -	 */ -	public boolean isIsadmin() { -		return isadmin; -	} - -	/** -	 * @param isadmin the isadmin to set -	 */ -	public void setIsadmin(boolean isadmin) { -		this.isadmin = isadmin; -	} - -	/** -	 * @return the isactive -	 */ -	public boolean isIsactive() { -		return isactive; -	} - -	/** -	 * @param isactive the isactive to set -	 */ -	public void setIsactive(boolean isactive) { -		this.isactive = isactive; -	} - -	/** -	 * @return the registratedOAs -	 */ -	public List<OnlineApplication> getRegistratedOAs() { -		return registratedOAs; -	} - -	/** -	 * @param registratedOAs the registratedOAs to set -	 */ -	public void setRegistratedOAs(List<OnlineApplication> registratedOAs) { -		this.registratedOAs = registratedOAs; -	} - -	/** -	 * @return the lastlogin -	 */ -	public Date getLastlogin() { -		return lastlogin; -	} - -	/** -	 * @param lastlogin the lastlogin to set -	 */ -	public void setLastlogin(Date lastlogin) { -		this.lastlogin = lastlogin; -	} -     -     -} - - diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java index c7672f9ba..6e0f47805 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/OASessionStore.java @@ -45,7 +45,6 @@ public class OASessionStore implements Serializable{  //    	this.created = new Date();  //    } -	//@ManyToOne(fetch=FetchType.LAZY)  	@ManyToOne(fetch=FetchType.LAZY)  	@JoinColumn(name = "moasession")  	private AuthenticatedSessionStore moasession; diff --git a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd index a90205260..ac8aa3b40 100644 --- a/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd +++ b/id/server/moa-id-commons/src/main/resources/config/moaid_config_2.0.xsd @@ -1,6 +1,26 @@  <?xml version="1.0" encoding="UTF-8"?>  <!-- Mit XMLSpy v2013 sp1 (http://www.altova.com) von Thomas Lenz (Graz University of Technology IAIK) bearbeitet -->  <xsd:schema xmlns="http://www.buergerkarte.at/namespaces/moaconfig#" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.buergerkarte.at/namespaces/moaconfig#" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.0.0"> +	<xsd:complexType name="OnlineApplication"> +		<xsd:complexContent> +			<xsd:extension base="OnlineApplicationType"> +				<xsd:attribute name="publicURLPrefix" type="xsd:anyURI" use="required"/> +				<xsd:attribute name="keyBoxIdentifier" type="MOAKeyBoxSelector" use="optional" default="SecureSignatureKeypair"/> +				<xsd:attribute name="type" use="optional" default="publicService"> +					<xsd:simpleType> +						<xsd:restriction base="xsd:NMTOKEN"> +							<xsd:enumeration value="businessService"/> +							<xsd:enumeration value="publicService"/> +						</xsd:restriction> +					</xsd:simpleType> +				</xsd:attribute> +				<xsd:attribute name="calculateHPI" type="xsd:boolean" use="optional" default="false"/> +				<xsd:attribute name="friendlyName" type="xsd:string" use="optional"/> +				<xsd:attribute name="target" type="xsd:string" use="optional"/> +				<xsd:attribute name="targetFriendlyName" type="xsd:string" use="optional"/> +			</xsd:extension> +		</xsd:complexContent> +	</xsd:complexType>  	<xsd:element name="Configuration">  		<xsd:complexType>  			<xsd:sequence> @@ -171,31 +191,11 @@  						</xsd:sequence>  					</xsd:complexType>  				</xsd:element> -				<xsd:element name="OnlineApplication" maxOccurs="unbounded"> +				<xsd:element name="OnlineApplication" type="OnlineApplication" maxOccurs="unbounded">  					<xsd:annotation>  						<xsd:documentation>enthält Parameter für die OA  						</xsd:documentation>  					</xsd:annotation> -					<xsd:complexType> -						<xsd:complexContent> -							<xsd:extension base="OnlineApplicationType"> -								<xsd:attribute name="publicURLPrefix" type="xsd:anyURI" use="required"/> -								<xsd:attribute name="keyBoxIdentifier" type="MOAKeyBoxSelector" use="optional" default="SecureSignatureKeypair"/> -								<xsd:attribute name="type" use="optional" default="publicService"> -									<xsd:simpleType> -										<xsd:restriction base="xsd:NMTOKEN"> -											<xsd:enumeration value="businessService"/> -											<xsd:enumeration value="publicService"/> -										</xsd:restriction> -									</xsd:simpleType> -								</xsd:attribute> -								<xsd:attribute name="calculateHPI" type="xsd:boolean" use="optional" default="false"/> -								<xsd:attribute name="friendlyName" type="xsd:string" use="optional"/> -								<xsd:attribute name="target" type="xsd:string" use="optional"/> -								<xsd:attribute name="targetFriendlyName" type="xsd:string" use="optional"/> -							</xsd:extension> -						</xsd:complexContent> -					</xsd:complexType>  				</xsd:element>  				<xsd:element name="ChainingModes" minOccurs="0">  					<xsd:annotation> @@ -429,15 +429,6 @@  					</xsd:sequence>  				</xsd:complexType>  			</xsd:element> -			<xsd:element name="Templates"> -				<xsd:complexType> -					<xsd:sequence> -						<xsd:element name="OnlineBKU" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/> -						<xsd:element name="HandyBKU" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/> -						<xsd:element name="LocalBKU" type="xsd:anyURI" minOccurs="1" maxOccurs="1"/> -					</xsd:sequence> -				</xsd:complexType> -			</xsd:element>  		</xsd:sequence>  	</xsd:complexType>  	<xsd:complexType name="TransformsInfoType"> @@ -504,7 +495,7 @@  	<xsd:complexType name="ProxyComponentType"/>  	<xsd:complexType name="OnlineApplicationType">  		<xsd:sequence> -			<xsd:element name="isActive" type="xsd:boolean" minOccurs="1" maxOccurs="1" default="false"/> +			<xsd:element name="isActive" type="xsd:boolean" default="false" minOccurs="1" maxOccurs="1"/>  			<xsd:element name="AuthComponent_OA" minOccurs="0">  				<xsd:annotation>  					<xsd:documentation>enthält Parameter über die OA, die die @@ -941,4 +932,20 @@  			</xsd:sequence>  		</xsd:complexType>  	</xsd:element> +	<xsd:complexType name="UserDatabase"> +		<xsd:sequence> +			<xsd:element name="bpk" type="xsd:string" minOccurs="0" maxOccurs="1"/> +			<xsd:element name="familyname" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="givenname" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="institut" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="mail" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="phone" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="username" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="password" type="xsd:string" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="isActive" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="isAdmin" type="xsd:boolean" default="true" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="lastLogin" type="xsd:date" minOccurs="1" maxOccurs="1"/> +			<xsd:element name="OnlineApplication" type="OnlineApplication" minOccurs="0" maxOccurs="unbounded"/> +		</xsd:sequence> +	</xsd:complexType>  </xsd:schema> diff --git a/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml b/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml index bd60f5a46..25092ff58 100644 --- a/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml +++ b/id/server/moa-id-commons/src/main/resources/config/persistence_template.xml @@ -2,7 +2,7 @@  <persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd  http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">      <persistence-unit name="##generated"> -			<class>at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase</class> +			<!-- <class>at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase</class> -->  <!-- 			<properties>  			    C3p0 connection pooling configuration | 
