You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2011/04/01 18:42:42 UTC
svn commit: r1087796 [6/37] - in /incubator/rave/donations/mitre-osec: ./
conf/ db/ db/data/ db/sequences/ db/tables/ lib/ lib/apache-commons/
lib/apache-taglibs/ lib/build/ lib/build/cobertura/ lib/eclipselink/
lib/freemarker/ lib/google-collections/ ...
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PageTemplateRegion.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PageTemplateRegion.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PageTemplateRegion.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PageTemplateRegion.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import java.util.List;
+import javax.persistence.*;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "PAGE_TEMPLATE_REGION")
+@SequenceGenerator(name="PageTemplateRegionSeq", sequenceName="PAGE_TEMPLATE_REGION_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "PageTemplateRegion.findAll", query = "SELECT p FROM PageTemplateRegion p"),
+ @NamedQuery(name = "PageTemplateRegion.findByPageTemplateRegionId", query = "SELECT p FROM PageTemplateRegion p WHERE p.pageTemplateRegionId = :pageTemplateRegionId"),
+ @NamedQuery(name = "PageTemplateRegion.findByRegionName", query = "SELECT p FROM PageTemplateRegion p WHERE p.regionName = :regionName")
+})
+public class PageTemplateRegion implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PageTemplateRegionSeq")
+ @Column(name = "PAGE_TEMPLATE_REGION_ID")
+ private Long pageTemplateRegionId;
+
+ @Basic(optional = false)
+ @Column(name = "REGION_NAME")
+ private String regionName;
+
+ @JoinColumn(name = "PAGE_TEMPLATE_ID", referencedColumnName = "PAGE_TEMPLATE_ID")
+ @ManyToOne(optional = false)
+ private PageTemplate pageTemplate;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "pageTemplateRegion")
+ @OrderBy("renderSeq")
+ private List<PageTemplateGadget> pageTemplateGadgetList;
+
+ public PageTemplateRegion() {
+ }
+
+ public PageTemplateRegion(Long pageTemplateRegionId) {
+ this.pageTemplateRegionId = pageTemplateRegionId;
+ }
+
+ public PageTemplateRegion(Long pageTemplateRegionId, String regionName) {
+ this.pageTemplateRegionId = pageTemplateRegionId;
+ this.regionName = regionName;
+ }
+
+ public Long getPageTemplateRegionId() {
+ return pageTemplateRegionId;
+ }
+
+ public void setPageTemplateRegionId(Long pageTemplateRegionId) {
+ this.pageTemplateRegionId = pageTemplateRegionId;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public void setRegionName(String regionName) {
+ this.regionName = regionName;
+ }
+
+ public List<PageTemplateGadget> getPageTemplateGadgetList() {
+ return pageTemplateGadgetList;
+ }
+
+ public void setPageTemplateGadgetList(List<PageTemplateGadget> pageTemplateGadgetList) {
+ this.pageTemplateGadgetList = pageTemplateGadgetList;
+ }
+
+ public PageTemplate getPageTemplate() {
+ return pageTemplate;
+ }
+
+ public void setPageTemplate(PageTemplate pageTemplate) {
+ this.pageTemplate = pageTemplate;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (pageTemplateRegionId != null ? pageTemplateRegionId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof PageTemplateRegion)) {
+ return false;
+ }
+ PageTemplateRegion other = (PageTemplateRegion) object;
+ if (this.pageTemplateRegionId == null ||
+ other.getPageTemplateRegionId() == null ||
+ !this.pageTemplateRegionId.equals(other.getPageTemplateRegionId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.PageTemplateRegion[pageTemplateRegionId=" + pageTemplateRegionId + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PageTemplateRegion.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Person.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Person.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Person.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Person.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import javax.persistence.*;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: MFRANKLIN
+ * Date: Sep 23, 2009
+ * Time: 5:10:34 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@Entity
+@Table(name = "PERSON")
+@SequenceGenerator(name = "PersonSeq", sequenceName = "PERSON_ID_SEQ", allocationSize = 1)
+@NamedQueries({
+ @NamedQuery(name = "Person.findByUsername", query = "SELECT p FROM Person p WHERE p.username= :username")
+})
+public class Person implements UserDetails {
+ private static final long serialVersionUID = 1L;
+
+ /* identifiers */
+ @Id
+ @Basic(optional = false)
+ @Column(name = "ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PersonSeq")
+ //Using a string here since many enterprises userId's may not always be numeric
+ private String userId;
+
+ @Basic(optional = false)
+ @Column(name = "USERNAME")
+ private String username;
+
+ /* name info */
+ @Basic(optional = false)
+ @Column(name = "LAST_NAME")
+ private String lastName;
+
+ @Basic(optional = false)
+ @Column(name = "FIRST_NAME")
+ private String firstName;
+
+ /* contact info */
+ @Basic(optional = false)
+ @Column(name = "PRIMARY_EMAIL")
+ private String primaryEmail;
+
+ @Basic(optional = false)
+ @Column(name="AVATAR_URL")
+ private String avatarUrl;
+
+ /* spring security info */
+ @Transient
+ private Collection<GrantedAuthority> authorities;
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getPrimaryEmail() {
+ return primaryEmail;
+ }
+
+ public void setPrimaryEmail(String primaryEmail) {
+ this.primaryEmail = primaryEmail;
+ }
+
+ public String getAvatarUrl() {
+ return avatarUrl;
+ }
+
+ public void setAvatarUrl(String avatarUrl) {
+ this.avatarUrl = avatarUrl;
+ }
+
+ @Override
+ public Collection<GrantedAuthority> getAuthorities() {
+ return authorities;
+ }
+
+ public void setAuthorities(Collection<GrantedAuthority> authorities) {
+ this.authorities = authorities;
+ }
+
+ public String getDisplayName() {
+ return lastName + ", " + firstName;
+ }
+
+ public boolean hasAnyAuthority(List<GrantedAuthority> candidateAuthorities) {
+ if (authorities == null || candidateAuthorities == null)
+ return false;
+
+ for (GrantedAuthority authority : candidateAuthorities) {
+ if (authorities.contains(authority)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public String getPassword() {
+ return getUsername();
+ }
+
+ @Override
+ public boolean isAccountNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isAccountNonLocked() {
+ return true;
+ }
+
+ @Override
+ public boolean isCredentialsNonExpired() {
+ return true;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Person[userId=" + getUserId() + ", username=" + getUsername() + "]";
+ }
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Person.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadget.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadget.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadget.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadget.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.persistence.annotations.PrivateOwned;
+
+/**
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "PERSON_GADGET")
+@SequenceGenerator(name = "PersonGadgetSeq", sequenceName = "PERSON_GADGET_ID_SEQ", allocationSize = 1)
+@NamedQueries({
+ //TODO: Make this finder consistent with the others...
+ @NamedQuery(name = "PersonGadget.findById", query = "SELECT p FROM PersonGadget p WHERE p.personGadgetId = :personGadgetId"),
+ @NamedQuery(name = "PersonGadget.findAllByUserId", query = "SELECT p FROM PersonGadget p WHERE p.userId = :userId"),
+ @NamedQuery(name = "PersonGadget.findAllByGadget", query = "SELECT p FROM PersonGadget p WHERE p.gadget = :gadget")
+})
+public class PersonGadget implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "PERSON_GADGET_ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PersonGadgetSeq")
+ private Long personGadgetId;
+
+ @Basic(optional = false)
+ @Column(name = "USER_ID")
+ private String userId;
+
+ @JoinColumn(name = "GADGET_ID", referencedColumnName = "GADGET_ID")
+ @ManyToOne(optional = false)
+ private Gadget gadget;
+
+ @Transient
+ private String securityToken;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "personGadget")
+ private List<PersonGadgetUserPref> personGadgetUserPrefList;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "personGadget")
+ @OrderBy("sortValue")
+ private List<PersonGadgetUserPrefListType> personGadgetUserPrefListTypeList;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "personGadget")
+ private List<ApplicationData> applicationDataList;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "personGadget")
+ private List<TokenInfo> tokenInfoList;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "personGadget")
+ private List<RegionGadget> regionGadgetList;
+
+ public PersonGadget() {
+ }
+
+ public PersonGadget(Long personGadgetId) {
+ this.personGadgetId = personGadgetId;
+ }
+
+ public PersonGadget(Long personGadgetId, String userId) {
+ this.personGadgetId = personGadgetId;
+ this.userId = userId;
+ }
+
+ public Long getPersonGadgetId() {
+ return personGadgetId;
+ }
+
+ public void setPersonGadgetId(Long personGadgetId) {
+ this.personGadgetId = personGadgetId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public Gadget getGadget() {
+ return gadget;
+ }
+
+ public void setGadget(Gadget gadget) {
+ this.gadget = gadget;
+ }
+
+ public String getSecurityToken() {
+ return securityToken;
+ }
+
+ public void setSecurityToken(String securityToken) {
+ this.securityToken = securityToken;
+ }
+
+ public List<PersonGadgetUserPref> getPersonGadgetUserPrefList() {
+ return personGadgetUserPrefList;
+ }
+
+ public void setPersonGadgetUserPrefList(List<PersonGadgetUserPref> personGadgetUserPrefList) {
+ this.personGadgetUserPrefList = personGadgetUserPrefList;
+ }
+
+ public List<PersonGadgetUserPrefListType> getPersonGadgetUserPrefListTypeList() {
+ return personGadgetUserPrefListTypeList;
+ }
+
+ public void setPersonGadgetUserPrefListTypeList(List<PersonGadgetUserPrefListType> personGadgetUserPrefListTypeList) {
+ this.personGadgetUserPrefListTypeList = personGadgetUserPrefListTypeList;
+ }
+ public List<ApplicationData> getApplicationDataList() {
+ return applicationDataList;
+ }
+
+ public void setApplicationDataList(List<ApplicationData> applicationDataList) {
+ this.applicationDataList = applicationDataList;
+ }
+
+ public List<TokenInfo> getTokenInfoList() {
+ return tokenInfoList;
+ }
+
+ public void setTokenInfoList(List<TokenInfo> tokenInfoList) {
+ this.tokenInfoList = tokenInfoList;
+ }
+
+ public List<RegionGadget> getRegionGadgetList() {
+ return regionGadgetList;
+ }
+
+ public void setRegionGadgetList(List<RegionGadget> regionGadgetList) {
+ this.regionGadgetList = regionGadgetList;
+ }
+
+ public PersonGadgetUserPref getPersonGadgetUserPrefByGadgetPref(Long gadgetUserPrefId) {
+ if (personGadgetUserPrefList == null) return null;
+
+ for (PersonGadgetUserPref personGadgetUserPref : personGadgetUserPrefList) {
+ if (personGadgetUserPref.getGadgetUserPref().getGadgetUserPrefId().equals(gadgetUserPrefId)) {
+ return personGadgetUserPref;
+ }
+ }
+ // none found...
+ return null;
+ }
+
+ public PersonGadgetUserPref getPersonGadgetUserPrefByGadgetPref(String gadgetUserPrefName) {
+ for (PersonGadgetUserPref personGadgetUserPref : personGadgetUserPrefList) {
+ if (personGadgetUserPref.getGadgetUserPref().getName().equals(gadgetUserPrefName)) {
+ return personGadgetUserPref;
+ }
+ }
+ // none found...
+ return null;
+ }
+
+ public List<PersonGadgetUserPrefListType> getPersonGadgetUserPrefListTypesByGadgetPref(Long gadgetUserPrefId) {
+ List<PersonGadgetUserPrefListType> list = new ArrayList<PersonGadgetUserPrefListType>();
+ for (PersonGadgetUserPrefListType personGadgetUserPrefListType : personGadgetUserPrefListTypeList) {
+ if (personGadgetUserPrefListType.getGadgetUserPref().getGadgetUserPrefId().equals(gadgetUserPrefId)) {
+ list.add(personGadgetUserPrefListType);
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (personGadgetId != null ? personGadgetId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof PersonGadget)) {
+ return false;
+ }
+ PersonGadget other = (PersonGadget) object;
+ if (this.personGadgetId == null ||
+ other.getPersonGadgetId() == null ||
+ !this.personGadgetId.equals(other.getPersonGadgetId())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.PersonGadget[personGadgetId=" + personGadgetId + "]";
+ }
+
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadget.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPref.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPref.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPref.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPref.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "PERSON_GADGET_USER_PREF")
+@SequenceGenerator(name="PersonGadgetUserPrefSeq", sequenceName="PERSON_GADGET_USER_PREF_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "PersonGadgetUserPref.findByPersonGadgetUserPrefId", query = "SELECT p FROM PersonGadgetUserPref p WHERE p.personGadgetUserPrefId = :personGadgetUserPrefId")
+})
+public class PersonGadgetUserPref implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "PERSON_GADGET_USER_PREF_ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PersonGadgetUserPrefSeq")
+ private Long personGadgetUserPrefId;
+
+ @Basic(optional = true)
+ @Column(name = "PREF_VALUE")
+ private String prefValue;
+
+ @JoinColumn(name = "GADGET_USER_PREF_ID", referencedColumnName = "GADGET_USER_PREF_ID")
+ @ManyToOne(optional = false)
+ private GadgetUserPref gadgetUserPref;
+
+ @JoinColumn(name = "PERSON_GADGET_ID", referencedColumnName = "PERSON_GADGET_ID")
+ @ManyToOne(optional = false)
+ private PersonGadget personGadget;
+
+ public PersonGadgetUserPref() {
+ }
+
+ public PersonGadgetUserPref(Long personGadgetUserPrefId) {
+ this.personGadgetUserPrefId = personGadgetUserPrefId;
+ }
+
+ public Long getPersonGadgetUserPrefId() {
+ return personGadgetUserPrefId;
+ }
+
+ public void setPersonGadgetUserPrefId(Long personGadgetUserPrefId) {
+ this.personGadgetUserPrefId = personGadgetUserPrefId;
+ }
+
+ public String getPrefValue() {
+ return prefValue;
+ }
+
+ public void setPrefValue(String prefValue) {
+ if (prefValue.length() > 4000) {
+ this.prefValue = prefValue.substring(0, 4000);
+ }
+ else {
+ this.prefValue = prefValue;
+ }
+ }
+
+ public GadgetUserPref getGadgetUserPref() {
+ return gadgetUserPref;
+ }
+
+ public void setGadgetUserPref(GadgetUserPref gadgetUserPref) {
+ this.gadgetUserPref = gadgetUserPref;
+ }
+
+ public PersonGadget getPersonGadget() {
+ return personGadget;
+ }
+
+ public void setPersonGadget(PersonGadget personGadget) {
+ this.personGadget = personGadget;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (personGadgetUserPrefId != null ? personGadgetUserPrefId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof PersonGadgetUserPref)) {
+ return false;
+ }
+ PersonGadgetUserPref other = (PersonGadgetUserPref) object;
+ if (this.personGadgetUserPrefId == null ||
+ other.getPersonGadgetUserPrefId() == null ||
+ !this.personGadgetUserPrefId.equals(other.getPersonGadgetUserPrefId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.web.model.PersonGadgetUserPref[personGadgetUserPrefId=" + personGadgetUserPrefId + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPref.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPrefListType.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPrefListType.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPrefListType.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPrefListType.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "PRSN_GDGT_USR_PRF_LIST_TYPE")
+@SequenceGenerator(name="PersonGadgetUserPrefListTypeSeq", sequenceName="PGUPLT_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "PersonGadgetUserPrefListType.findByPguplId", query = "SELECT p FROM PersonGadgetUserPrefListType p WHERE p.personGadgetUserPrefListTypeId = :personGadgetUserPrefListTypeId"),
+ @NamedQuery(name = "PersonGadgetUserPrefListType.findAllByPersonGadgetAndGadgetUserPref", query = "SELECT p FROM PersonGadgetUserPrefListType p WHERE p.personGadget = :personGadget AND p.gadgetUserPref = :gadgetUserPref ORDER BY p.sortValue")
+})
+public class PersonGadgetUserPrefListType implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "prsn_gdgt_usr_prf_list_type_id")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PersonGadgetUserPrefListTypeSeq")
+ private Long personGadgetUserPrefListTypeId;
+
+ @Basic(optional = false)
+ @Column(name = "PREF_VALUE")
+ private String prefValue;
+
+ @Basic(optional = false)
+ @Column(name = "SORT_VALUE")
+ private Integer sortValue;
+
+ @JoinColumn(name = "GADGET_USER_PREF_ID", referencedColumnName = "GADGET_USER_PREF_ID")
+ @ManyToOne(optional = false)
+ private GadgetUserPref gadgetUserPref;
+
+ @JoinColumn(name = "PERSON_GADGET_ID", referencedColumnName = "PERSON_GADGET_ID")
+ @ManyToOne(optional = false)
+ private PersonGadget personGadget;
+
+ public PersonGadgetUserPrefListType() {
+ }
+
+ public PersonGadgetUserPrefListType(Long personGadgetUserPrefListTypeId) {
+ this.personGadgetUserPrefListTypeId = personGadgetUserPrefListTypeId;
+ }
+
+ public PersonGadgetUserPrefListType(Long personGadgetUserPrefListTypeId, Integer sortValue) {
+ this.personGadgetUserPrefListTypeId = personGadgetUserPrefListTypeId;
+ this.sortValue = sortValue;
+ }
+
+ public Long getPersonGadgetUserPrefListTypeId() {
+ return personGadgetUserPrefListTypeId;
+ }
+
+ public void setPersonGadgetUserPrefListTypeId(Long personGadgetUserPrefListTypeId) {
+ this.personGadgetUserPrefListTypeId = personGadgetUserPrefListTypeId;
+ }
+
+ public String getPrefValue() {
+ return prefValue;
+ }
+
+ public void setPrefValue(String prefValue) {
+ this.prefValue = prefValue;
+ }
+
+ public long getSortValue() {
+ return sortValue;
+ }
+
+ public void setSortValue(Integer sortValue) {
+ this.sortValue = sortValue;
+ }
+
+ public GadgetUserPref getGadgetUserPref() {
+ return gadgetUserPref;
+ }
+
+ public void setGadgetUserPref(GadgetUserPref gadgetUserPref) {
+ this.gadgetUserPref = gadgetUserPref;
+ }
+
+ public PersonGadget getPersonGadget() {
+ return personGadget;
+ }
+
+ public void setPersonGadget(PersonGadget personGadget) {
+ this.personGadget = personGadget;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (personGadgetUserPrefListTypeId != null ? personGadgetUserPrefListTypeId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof PersonGadgetUserPrefListType)) {
+ return false;
+ }
+ PersonGadgetUserPrefListType other = (PersonGadgetUserPrefListType) object;
+ if (this.personGadgetUserPrefListTypeId == null ||
+ other.getPersonGadgetUserPrefListTypeId() == null ||
+ !this.personGadgetUserPrefListTypeId.equals(other.getPersonGadgetUserPrefListTypeId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.PersonGadgetUserPrefListType[personGadgetUserPrefListTypeId=" + personGadgetUserPrefListTypeId + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/PersonGadgetUserPrefListType.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Region.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Region.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Region.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Region.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import java.util.List;
+import javax.persistence.*;
+import org.eclipse.persistence.annotations.PrivateOwned;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "REGION")
+@SequenceGenerator(name="RegionSeq", sequenceName="REGION_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "Region.findByRegionId", query = "SELECT r FROM Region r WHERE r.regionId = :regionId"),
+ @NamedQuery(name = "Region.findByName", query = "SELECT r FROM Region r WHERE r.name = :name AND r.page = :page"),
+ @NamedQuery(name = "Region.findAllByPage", query = "SELECT r FROM Region r WHERE r.page = :page")
+})
+public class Region implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "REGION_ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "RegionSeq")
+ private Long regionId;
+
+ @Basic(optional = false)
+ @Column(name = "NAME")
+ private String name;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "region")
+ @OrderBy("renderSeq")
+ private List<RegionGadget> regionGadgetList;
+
+ @JoinColumn(name = "PAGE_ID", referencedColumnName = "PAGE_ID")
+ @ManyToOne(optional = false)
+ private Page page;
+
+ /**
+ * used for persisting RegionGadget locations
+ */
+ public enum Location {
+ BEGINNING, END
+ }
+
+ /**
+ * the string prefix used as the identifier for a region, followed by a unique integer
+ */
+ @Transient
+ public static final String IDENTIFIER_PREFIX = "region_";
+
+ public Region() {
+ }
+
+ public Region(Long regionId) {
+ this.regionId = regionId;
+ }
+
+ public Region(Long regionId, String name) {
+ this.regionId = regionId;
+ this.name = name;
+ }
+
+ public Long getRegionId() {
+ return regionId;
+ }
+
+ public void setRegionId(Long regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<RegionGadget> getRegionGadgetList() {
+ return regionGadgetList;
+ }
+
+ public void setRegionGadgetList(List<RegionGadget> regionGadgetList) {
+ this.regionGadgetList = regionGadgetList;
+ }
+
+ public Page getPage() {
+ return page;
+ }
+
+ public void setPage(Page page) {
+ this.page = page;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (regionId != null ? regionId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof Region)) {
+ return false;
+ }
+ Region other = (Region) object;
+ if (this.regionId == null ||
+ other.getRegionId() == null ||
+ !this.regionId.equals(other.getRegionId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.Region[regionId=" + regionId + "]";
+ }
+
+ // removes a regionGadget from the List and update the render sequences
+ public void removeRegionGadget(RegionGadget regionGadget)
+ {
+ regionGadgetList.remove(regionGadget);
+ updateRegionGadgetRenderSequences();
+ }
+
+ // re-calculates the render sequence values based on their index position
+ // in the list. render sequence values are 1-based indexed
+ public void updateRegionGadgetRenderSequences()
+ {
+ if (regionGadgetList != null && !regionGadgetList.isEmpty())
+ {
+ for (int i = 0; i < regionGadgetList.size(); i++)
+ {
+ regionGadgetList.get(i).setRenderSeq(i+1);
+ }
+ }
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Region.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/RegionGadget.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/RegionGadget.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/RegionGadget.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/RegionGadget.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import java.util.List;
+import javax.persistence.*;
+import org.eclipse.persistence.annotations.Convert;
+import org.eclipse.persistence.annotations.Converter;
+import org.mitre.portal.model.util.BooleanConverter;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "REGION_GADGET",
+ uniqueConstraints=
+ @UniqueConstraint(columnNames={"REGION_ID", "PERSON_GADGET_ID"})
+)
+@SequenceGenerator(name="RegionGadgetSeq", sequenceName="REGION_GADGET_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "RegionGadget.findById", query = "SELECT r FROM RegionGadget r WHERE r.regionGadgetId = :regionGadgetId"),
+ @NamedQuery(name = "RegionGadget.findAllByRegion", query = "SELECT r FROM RegionGadget r WHERE r.region = :region ORDER BY r.renderSeq"),
+ @NamedQuery(name = "RegionGadget.findAllByGadget", query = "SELECT r FROM RegionGadget r WHERE r.personGadget.gadget = :gadget")
+})
+@Converter (
+ name="BooleanConverter",
+ converterClass=BooleanConverter.class
+)
+public class RegionGadget implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "REGION_GADGET_ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "RegionGadgetSeq")
+ private Long regionGadgetId;
+
+ @Basic(optional = false)
+ @Column(name = "RENDER_SEQ")
+ private long renderSeq;
+
+ @JoinColumn(name = "PERSON_GADGET_ID", referencedColumnName = "PERSON_GADGET_ID")
+ @ManyToOne(optional = false, cascade={CascadeType.ALL})
+ private PersonGadget personGadget;
+
+ @JoinColumn(name = "REGION_ID", referencedColumnName = "REGION_ID")
+ @ManyToOne(optional = false)
+ private Region region;
+
+ @Basic(optional = false)
+ @Column(name = "COLLAPSED")
+ @Convert("BooleanConverter")
+ private boolean collapsed;
+
+ public RegionGadget() {
+ }
+
+ public RegionGadget(Long regionGadgetId) {
+ this.regionGadgetId = regionGadgetId;
+ }
+
+ public RegionGadget(Long regionGadgetId, long renderSeq)
+ {
+ validateRenderSeq(renderSeq);
+ this.regionGadgetId = regionGadgetId;
+ this.renderSeq = renderSeq;
+ }
+
+ public Long getRegionGadgetId() {
+ return regionGadgetId;
+ }
+
+ public void setRegionGadgetId(Long regionGadgetId) {
+ this.regionGadgetId = regionGadgetId;
+ }
+
+ public long getRenderSeq() {
+ return renderSeq;
+ }
+
+ public void setRenderSeq(long renderSeq) {
+ validateRenderSeq(renderSeq);
+ this.renderSeq = renderSeq;
+ }
+
+ public PersonGadget getPersonGadget() {
+ return personGadget;
+ }
+
+ public void setPersonGadget(PersonGadget personGadget) {
+ this.personGadget = personGadget;
+ }
+
+ public Region getRegion() {
+ return region;
+ }
+
+ public void setRegion(Region region) {
+ this.region = region;
+ }
+
+ public boolean isCollapsed() {
+ return collapsed;
+ }
+
+ public void setCollapsed(boolean collapsed) {
+ this.collapsed = collapsed;
+ }
+
+ public boolean isUserCustomizable() {
+ if (personGadget == null || personGadget.getGadget() == null)
+ return false;
+
+ List<GadgetUserPref> gadgetUserPrefList = personGadget.getGadget().getGadgetUserPrefList();
+ return (gadgetUserPrefList != null && !gadgetUserPrefList.isEmpty());
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (regionGadgetId != null ? regionGadgetId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof RegionGadget)) {
+ return false;
+ }
+ RegionGadget other = (RegionGadget) object;
+ if (this.regionGadgetId == null ||
+ other.getRegionGadgetId() == null ||
+ !this.regionGadgetId.equals(other.getRegionGadgetId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.RegionGadget[regionGadgetId=" + regionGadgetId + "]";
+ }
+
+ private void validateRenderSeq(long renderSequence)
+ {
+ if (renderSequence < 1)
+ throw new IllegalArgumentException("renderSequence must be > 0, supplied: " + renderSequence);
+ }
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/RegionGadget.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityRole.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityRole.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityRole.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityRole.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "SECURITY_ROLE")
+@NamedQueries({
+ @NamedQuery(name = "SecurityRole.findAll", query = "SELECT s FROM SecurityRole s"),
+ @NamedQuery(name = "SecurityRole.findByName", query = "SELECT s FROM SecurityRole s WHERE s.name = :name")
+})
+public class SecurityRole implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "NAME")
+ private String name;
+ @Basic(optional = false)
+ @Column(name = "DESCRIPTION")
+ private String description;
+ @Basic(optional = false)
+ @Column(name = "ENABLED")
+ private String enabled;
+
+ public SecurityRole() {
+ }
+
+ public SecurityRole(String name) {
+ this.name = name;
+ }
+
+ public SecurityRole(String name, String description, String enabled) {
+ this.name = name;
+ this.description = description;
+ this.enabled = enabled;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(String enabled) {
+ this.enabled = enabled;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (name != null ? name.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof SecurityRole)) {
+ return false;
+ }
+ SecurityRole other = (SecurityRole) object;
+ if (this.name == null ||
+ other.getName() == null ||
+ !this.name.equals(other.getName()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.SecurityRole[name=" + name + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityRole.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityUserRole.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityUserRole.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityUserRole.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityUserRole.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import javax.persistence.*;
+import java.io.Serializable;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "SECURITY_USER_ROLE")
+@SequenceGenerator(name="SecurityUserRoleSeq", sequenceName="SECURITY_USER_ROLE_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "SecurityUserRole.findAll", query = "SELECT s FROM SecurityUserRole s WHERE s.id = :id"),
+ @NamedQuery(name = "SecurityUserRole.findAllSecurityUserRoles", query = "SELECT distinct s.securityRoleName FROM SecurityUserRole s"),
+ @NamedQuery(name = "SecurityUserRole.findById", query = "SELECT s FROM SecurityUserRole s WHERE s.id = :id"),
+ @NamedQuery(name = "SecurityUserRole.findByUserId", query = "SELECT s FROM SecurityUserRole s WHERE s.userId = :userId"),
+ @NamedQuery(name = "SecurityUserRole.findBySecurityRoleName", query = "SELECT s FROM SecurityUserRole s WHERE s.securityRoleName = :securityRoleName")
+})
+public class SecurityUserRole implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SecurityUserRoleSeq")
+ private Long id;
+
+
+ @Basic(optional = false)
+ @Column(name = "USER_ID")
+ private String userId;
+ @Basic(optional = false)
+ @Column(name = "SECURITY_ROLE_NAME")
+ private String securityRoleName;
+
+ public SecurityUserRole() {
+ }
+
+ public SecurityUserRole(Long id) {
+ this.id = id;
+ }
+
+ public SecurityUserRole(Long id, String userId, String securityRoleName) {
+ this.id = id;
+ this.userId = userId;
+ this.securityRoleName = securityRoleName;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getSecurityRoleName() {
+ return securityRoleName;
+ }
+
+ public void setSecurityRoleName(String securityRoleName) {
+ this.securityRoleName = securityRoleName;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (id != null ? id.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof SecurityUserRole)) {
+ return false;
+ }
+ SecurityUserRole other = (SecurityUserRole) object;
+ if (this.id == null ||
+ other.getId() == null ||
+ !this.id.equals(other.getId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.SecurityUserRole[id=" + id + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/SecurityUserRole.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/TokenInfo.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/TokenInfo.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/TokenInfo.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/TokenInfo.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author JCIAN
+ */
+@Entity
+@Table(name = "TOKEN_INFO")
+@SequenceGenerator(name = "TokenInfoIdGenerator", sequenceName = "TOKEN_INFO_ID_SEQ", allocationSize = 1)
+@NamedQueries({
+ @NamedQuery(name = "TokenInfo.findAll", query = "SELECT t FROM TokenInfo t"),
+ @NamedQuery(name = "TokenInfo.findByTokenInfoId", query = "SELECT t FROM TokenInfo t WHERE t.tokenInfoId = :tokenInfoId")
+})
+public class TokenInfo implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The database ID for this oauth token.
+ */
+ @Id
+ @Basic(optional = false)
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TokenInfoIdGenerator")
+ @Column(name = "TOKEN_INFO_ID")
+ private Long tokenInfoId;
+
+ /**
+ * The gadget instance (module ID) this oauth token is for.
+ */
+ @JoinColumn(name = "PERSON_GADGET_ID", referencedColumnName = "PERSON_GADGET_ID")
+ @ManyToOne(optional = false)
+ private PersonGadget personGadget;
+
+ /**
+ * The user this token is for.
+ */
+ @Column(name = "USER_ID", nullable = false)
+ private String userId;
+
+ /**
+ * The nickname the gadget uses to refer to the OAuth <Service> element from its XML spec.
+ */
+ @Column(name = "SERVICE_NAME")
+ private String serviceName;
+
+ /**
+ * The nickname the gadget uses to refer to an OAuth token granting access to a particular resources. Gadgets can
+ * use multiple token names if they have access to multiple resources from the same service provider. For example,
+ * a gadget with access to a contact list and a calendar might use a token name of "contacts" to use the contact
+ * list token, and a contact list of "calendar" to use the calendar token.
+ */
+ @Column(name = "TOKEN_NAME")
+ private String tokenName;
+
+ /**
+ * The oauth token.
+ */
+ @Basic(optional = false)
+ @Column(name = "ACCESS_TOKEN")
+ private String accessToken;
+
+ /**
+ * The secret for the token.
+ */
+ @Basic(optional = false)
+ @Column(name = "TOKEN_SECRET")
+ private String tokenSecret;
+
+ /**
+ * The session handle - http://oauth.googlecode.com/svn/spec/ext/session/1.0/drafts/1/spec.html
+ */
+ @Column(name = "SESSION_HANDLE")
+ private String sessionHandle;
+
+ /**
+ * The time (milliseconds since epoch) when the token expires.
+ */
+ @Column(name = "TOKEN_EXPIRATION")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date tokenExpiration;
+
+ public TokenInfo() {
+ }
+
+ public TokenInfo(Long tokenInfoId, PersonGadget personGadget, String userId, String serviceName, String tokenName,
+ String accessToken, String tokenSecret, String sessionHandle, Date tokenExpiration) {
+ this.tokenInfoId = tokenInfoId;
+ this.personGadget = personGadget;
+ this.userId = userId;
+ this.serviceName = serviceName;
+ this.tokenName = tokenName;
+ this.accessToken = accessToken;
+ this.tokenSecret = tokenSecret;
+ this.sessionHandle = sessionHandle;
+ this.tokenExpiration = tokenExpiration;
+ }
+
+ public Long getTokenInfoId() {
+ return tokenInfoId;
+ }
+
+ public void setTokenInfoId(Long tokenInfoId) {
+ this.tokenInfoId = tokenInfoId;
+ }
+
+ public PersonGadget getPersonGadget() {
+ return personGadget;
+ }
+
+ public void setPersonGadget(PersonGadget personGadget) {
+ this.personGadget = personGadget;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getTokenName() {
+ return tokenName;
+ }
+
+ public void setTokenName(String tokenName) {
+ this.tokenName = tokenName;
+ }
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+ public String getTokenSecret() {
+ return tokenSecret;
+ }
+
+ public void setTokenSecret(String tokenSecret) {
+ this.tokenSecret = tokenSecret;
+ }
+
+ public String getSessionHandle() {
+ return sessionHandle;
+ }
+
+ public void setSessionHandle(String sessionHandle) {
+ this.sessionHandle = sessionHandle;
+ }
+
+ public Date getTokenExpiration() {
+ return tokenExpiration;
+ }
+
+ public void setTokenExpiration(Date tokenExpiration) {
+ this.tokenExpiration = tokenExpiration;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (tokenInfoId != null ? tokenInfoId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ // TODO: Warning - this method won't work in the case the id fields are not set
+ if (!(object instanceof TokenInfo)) {
+ return false;
+ }
+ TokenInfo other = (TokenInfo) object;
+ if (this.getTokenInfoId() == null ||
+ other.getTokenInfoId() == null ||
+ !this.tokenInfoId.equals(other.getTokenInfoId())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.TokenInfo[tokenInfoId=" + tokenInfoId + "]";
+ }
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/TokenInfo.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/UserWizardCompleted.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/UserWizardCompleted.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/UserWizardCompleted.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/UserWizardCompleted.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "USER_WIZARD_COMPLETED")
+@SequenceGenerator(name="UserWizardCompletedSeq", sequenceName="USER_WIZARD_COMPLETED_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "UserWizardCompleted.findAll", query = "SELECT u FROM UserWizardCompleted u"),
+ @NamedQuery(name = "UserWizardCompleted.findByUserWizardCompletedId", query = "SELECT u FROM UserWizardCompleted u WHERE u.userWizardCompletedId = :userWizardCompletedId"),
+ @NamedQuery(name = "UserWizardCompleted.findByUserId", query = "SELECT u FROM UserWizardCompleted u WHERE u.userId = :userId")
+})
+public class UserWizardCompleted implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "USER_WIZARD_COMPLETED_ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "UserWizardCompletedSeq")
+ private Long userWizardCompletedId;
+
+ @Basic(optional = false)
+ @Column(name = "USER_ID")
+ private String userId;
+
+ @JoinColumn(name = "WIZARD_ID", referencedColumnName = "WIZARD_ID")
+ @ManyToOne(optional = false)
+ private Wizard wizard;
+
+ public UserWizardCompleted() {
+ }
+
+ public UserWizardCompleted(Long userWizardCompletedId) {
+ this.userWizardCompletedId = userWizardCompletedId;
+ }
+
+ public UserWizardCompleted(Long userWizardCompletedId, String userId) {
+ this.userWizardCompletedId = userWizardCompletedId;
+ this.userId = userId;
+ }
+
+ public Long getUserWizardCompletedId() {
+ return userWizardCompletedId;
+ }
+
+ public void setUserWizardCompletedId(Long userWizardCompletedId) {
+ this.userWizardCompletedId = userWizardCompletedId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public Wizard getWizard() {
+ return wizard;
+ }
+
+ public void setWizard(Wizard wizard) {
+ this.wizard = wizard;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (userWizardCompletedId != null ? userWizardCompletedId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof UserWizardCompleted)) {
+ return false;
+ }
+ UserWizardCompleted other = (UserWizardCompleted) object;
+ if (this.userWizardCompletedId == null ||
+ other.getUserWizardCompletedId() == null ||
+ !this.userWizardCompletedId.equals(other.getUserWizardCompletedId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.UserWizardCompleted[userWizardCompletedId=" + userWizardCompletedId + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/UserWizardCompleted.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Wizard.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Wizard.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Wizard.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Wizard.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.List;
+import javax.persistence.*;
+import org.eclipse.persistence.annotations.Convert;
+import org.eclipse.persistence.annotations.Converter;
+import org.eclipse.persistence.annotations.PrivateOwned;
+import org.mitre.portal.model.util.URLConverter;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+@Entity
+@Table(name = "WIZARD")
+@SequenceGenerator(name="WizardSeq", sequenceName="WIZARD_ID_SEQ", allocationSize=1)
+@NamedQueries({
+ @NamedQuery(name = "Wizard.findAll", query = "SELECT w FROM Wizard w"),
+ @NamedQuery(name = "Wizard.findByWizardId", query = "SELECT w FROM Wizard w WHERE w.wizardId = :wizardId"),
+ @NamedQuery(name = "Wizard.findByName", query = "SELECT w FROM Wizard w WHERE w.name = :name")
+})
+@Converter (
+ name="URLConverter",
+ converterClass=URLConverter.class
+)
+public class Wizard implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Basic(optional = false)
+ @Column(name = "WIZARD_ID")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "WizardSeq")
+ private Long wizardId;
+
+ @Basic(optional = false)
+ @Column(name = "NAME")
+ private String name;
+
+ @Basic(optional = false)
+ @Column(name = "DISPLAY_NAME")
+ private String displayName;
+
+ @Basic(optional = false)
+ @Column(name = "USER_TARGET")
+ private String userTarget;
+
+ @Basic(optional = false)
+ @Column(name = "URL")
+ @Convert("URLConverter")
+ private URL url;
+
+ @PrivateOwned
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "wizard")
+ private List<UserWizardCompleted> userWizardCompletedList;
+
+ public Wizard() {
+ }
+
+ public Wizard(Long wizardId) {
+ this.wizardId = wizardId;
+ }
+
+ public Wizard(Long wizardId, String name, String userTarget, URL url) {
+ this.wizardId = wizardId;
+ this.name = name;
+ this.userTarget = userTarget;
+ this.url = url;
+ }
+
+ public Long getWizardId() {
+ return wizardId;
+ }
+
+ public void setWizardId(Long wizardId) {
+ this.wizardId = wizardId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getUserTarget() {
+ return userTarget;
+ }
+
+ public void setUserTarget(String userTarget) {
+ this.userTarget = userTarget;
+ }
+
+ public URL getUrl() {
+ return url;
+ }
+
+ public void setUrl(URL url) {
+ this.url = url;
+ }
+
+ public List<UserWizardCompleted> getUserWizardCompletedList() {
+ return userWizardCompletedList;
+ }
+
+ public void setUserWizardCompletedList(List<UserWizardCompleted> userWizardCompletedList) {
+ this.userWizardCompletedList = userWizardCompletedList;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (wizardId != null ? wizardId.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof Wizard)) {
+ return false;
+ }
+ Wizard other = (Wizard) object;
+ if (this.wizardId == null ||
+ other.getWizardId() == null ||
+ !this.wizardId.equals(other.getWizardId()))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "org.mitre.portal.model.Wizard[wizardId=" + wizardId + "]";
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/Wizard.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/BooleanConverter.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/BooleanConverter.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/BooleanConverter.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/BooleanConverter.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model.util;
+
+import org.eclipse.persistence.mappings.converters.Converter;
+import org.eclipse.persistence.mappings.DatabaseMapping;
+import org.eclipse.persistence.sessions.Session;
+
+/**
+ *
+ * @author ACARLUCCI
+ */
+public class BooleanConverter implements Converter
+{
+ private final String DB_TRUE_VALUE = "Y";
+ private final String DB_FALSE_VALUE = "N";
+
+ @Override
+ public Object convertObjectValueToDataValue(Object objectValue, Session session) {
+ if (objectValue == null)
+ return DB_FALSE_VALUE;
+
+ Boolean boolValue = (Boolean)objectValue;
+ return (boolValue) ? DB_TRUE_VALUE : DB_FALSE_VALUE;
+ }
+
+ @Override
+ public Object convertDataValueToObjectValue(Object dataValue, Session session) {
+ String stringValue = (String)dataValue;
+ return (DB_TRUE_VALUE.equals(stringValue));
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+
+ @Override
+ public void initialize(DatabaseMapping databaseMapping, Session session) {
+
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/BooleanConverter.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/FeaturedComparator.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/FeaturedComparator.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/FeaturedComparator.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/FeaturedComparator.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model.util;
+
+import java.util.Comparator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mitre.portal.model.ContainerRegistry;
+
+/**
+ *
+ * @author MAHADEVAN
+ */
+public class FeaturedComparator implements Comparator
+{
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Override
+ public int compare(Object containerRegistry1, Object containerRegistry2)
+ {
+ if (!(containerRegistry1 instanceof ContainerRegistry)) {
+ throw new ClassCastException("parameter1 is not a ContainerRegistry object, it is of type: " + containerRegistry1.getClass().getName());
+ }
+
+ if (!(containerRegistry2 instanceof ContainerRegistry)) {
+ throw new ClassCastException("parameter2 is not a ContainerRegistry object, it is of type: " + containerRegistry2.getClass().getName());
+ }
+
+ boolean featured1 = ((ContainerRegistry) containerRegistry1).getGadget().isFeatured();
+ boolean featured2 = ((ContainerRegistry) containerRegistry2).getGadget().isFeatured();
+
+ if ( featured1 && !featured2 )
+ return -1;
+ else if ( !featured1 && featured2 )
+ return 1;
+ else
+ return 0;
+ }
+
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/FeaturedComparator.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/GadgetStatistics.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/GadgetStatistics.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/GadgetStatistics.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/GadgetStatistics.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.mitre.portal.model.util;
+
+/**
+ *
+ * @author Sean Cooper
+ */
+public class GadgetStatistics {
+
+ private Long gadgetId;
+ private int userCount;
+ private int userLike;
+ private int userDislike;
+ private int userRating;
+
+ public GadgetStatistics(final Long id) {
+ gadgetId = id;
+ }
+
+ public GadgetStatistics() {
+ }
+
+ public void setGadgetId(final Long gadgetId) { this.gadgetId = gadgetId; }
+ public Long getGadgetId() { return gadgetId; }
+
+
+ public void setUserCount(final int userCount) { this.userCount = userCount; }
+ public int getUserCount() { return userCount; }
+
+ public void setUserLike(final int userLike) { this.userLike = userLike; }
+ public int getUserLike() { return userLike; }
+
+ public void setUserDislike(final int userDislike) { this.userDislike = userDislike; }
+ public int getUserDislike() { return userDislike; }
+
+ public void setUserRating(final int userRating) { this.userRating = userRating; }
+ public int getUserRating() { return userRating ; }
+
+ @Override
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("{userCount:");
+ buffer.append(getUserCount());
+ buffer.append(", gadgetId:");
+ buffer.append(getGadgetId());
+ buffer.append(", userLike:");
+ buffer.append(getUserLike());
+ buffer.append(", userDislike:");
+ buffer.append(getUserDislike());
+ buffer.append('}');
+
+ return buffer.toString();
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (object == null || ! (object instanceof GadgetStatistics))
+ return false;
+
+ GadgetStatistics objectStats = (GadgetStatistics) object;
+
+ return ( ((getGadgetId() == null && objectStats.getGadgetId() == null) || (getGadgetId() != null && getGadgetId().equals(objectStats.getGadgetId())))
+ && getUserCount() == objectStats.getUserCount()
+ && getUserDislike() == objectStats.getUserDislike()
+ && getUserLike() == objectStats.getUserLike()
+ && getUserRating() == objectStats.getUserRating());
+
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 17 * hash + (this.gadgetId != null ? this.gadgetId.hashCode() : 0);
+ return hash;
+ }
+}
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/GadgetStatistics.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/JaxbWrappers.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/JaxbWrappers.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/JaxbWrappers.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/JaxbWrappers.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model.util;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Map;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: JCIAN
+ * Date: Oct 7, 2009
+ * Time: 10:07:32 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class JaxbWrappers {
+ @XmlRootElement(name = "map")
+ public static class StringStringMapWrapper {
+ private Map<String, String> data;
+
+ public StringStringMapWrapper() {
+ }
+
+ public StringStringMapWrapper(Map<String, String> data) {
+ this.data = data;
+ }
+
+ public Map<String, String> getData() {
+ return data;
+ }
+
+ public void setData(Map<String, String> data) {
+ this.data = data;
+ }
+ }
+
+ @XmlRootElement(name = "map")
+ public static class GenericMapWrapper<K, V> {
+ private Map<K, V> data;
+
+ public GenericMapWrapper() {
+ }
+
+ public GenericMapWrapper(Map<K, V> data) {
+ this.data = data;
+ }
+
+ public Map<K, V> getData() {
+ return data;
+ }
+
+ public void setData(Map<K, V> data) {
+ this.data = data;
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/JaxbWrappers.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/ListUtil.java
URL: http://svn.apache.org/viewvc/incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/ListUtil.java?rev=1087796&view=auto
==============================================================================
--- incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/ListUtil.java (added)
+++ incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/ListUtil.java Fri Apr 1 16:42:22 2011
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.mitre.portal.model.util;
+
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: JCIAN
+ * Date: Mar 2, 2010
+ * Time: 1:54:03 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ListUtil {
+ /**
+ * Returns the first object or null from a list that is expected to contain a single object or be null or empty.
+ * If the list contains more than one object, an IncorrectResultSizeDataAccessException will be thrown.
+ *
+ * @param singleResultList The list that should contain a single object or be null or empty.
+ * @return The first object or null.
+ */
+ public static <T> T getSingleOrNullResultObject(List<T> singleResultList) {
+ if (singleResultList == null || singleResultList.size() == 0) {
+ return null;
+ } else if (singleResultList.size() > 1) {
+ throw new IncorrectResultSizeDataAccessException(1, singleResultList.size());
+ } else {
+ return singleResultList.get(0);
+ }
+ }
+
+ /**
+ * Returns the first object from a list that is expected to contain a single object.
+ * If the list does not contain exactly one object, an IncorrectResultSizeDataAccessException will be thrown.
+ *
+ * @param singleResultList The list that should contain a single object.
+ * @return The first object.
+ */
+ public static <T> T getSingleResultObject(List<T> singleResultList) {
+ if (singleResultList == null || singleResultList.size() != 1) {
+ //using -1 so we can differentiate between a null list and a 0 length list
+ int size = singleResultList == null ? -1 : singleResultList.size();
+ throw new IncorrectResultSizeDataAccessException(1, size);
+ } else {
+ return singleResultList.get(0);
+ }
+ }
+
+ /**
+ * Simple method to ensure all strings are given the same treatment when turning them into cache keys.
+ *
+ * @param cacheKey the String to turn into a cache key.
+ * @return the cache key version of the String.
+ */
+ public static String getCacheKey(String cacheKey) {
+ return cacheKey == null ? null : cacheKey.toUpperCase();
+ }
+
+ public static <T> void addEntryToObjectsMap(String key, T object, Map<String, List<T>> keyToObjectsMap) {
+ //ensure we have consistency with our cache keys
+ key = getCacheKey(key);
+
+ //if the key is null there is nothing to cache
+ if (key == null) {
+ return;
+ }
+
+ //see if there is already a list in the map for this key
+ List<T> objects = keyToObjectsMap.get(key);
+
+ //if not, create a new one and add it to the map
+ if (objects == null) {
+ objects = new ArrayList<T>();
+ keyToObjectsMap.put(key, objects);
+ }
+
+ //add this person to the list
+ objects.add(object);
+ }
+}
\ No newline at end of file
Propchange: incubator/rave/donations/mitre-osec/src/org/mitre/portal/model/util/ListUtil.java
------------------------------------------------------------------------------
svn:executable = *