Search in sources :

Example 11 with IPersonAttributesGroupDefinition

use of org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition in project uPortal by Jasig.

the class PersonAttributesGroupStoreDataFunction method apply.

@Override
public Iterable<? extends IPortalData> apply(IPortalDataType input) {
    final Set<IPersonAttributesGroupDefinition> personAttributesGroupDefinitions = this.personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitions();
    List<IPersonAttributesGroupDefinition> pagsDefs = new ArrayList<IPersonAttributesGroupDefinition>();
    for (IPersonAttributesGroupDefinition pagsDef : personAttributesGroupDefinitions) {
        pagsDefs.add(pagsDef);
    }
    final List<IPortalData> portalData = Lists.transform(pagsDefs, new Function<IPersonAttributesGroupDefinition, IPortalData>() {

        @Override
        public IPortalData apply(IPersonAttributesGroupDefinition personAttributesGroup) {
            return new SimpleStringPortalData(personAttributesGroup.getName(), null, personAttributesGroup.getDescription());
        }
    });
    return portalData;
}
Also used : IPersonAttributesGroupDefinition(org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition) SimpleStringPortalData(org.apereo.portal.io.xml.SimpleStringPortalData) ArrayList(java.util.ArrayList) IPortalData(org.apereo.portal.io.xml.IPortalData)

Example 12 with IPersonAttributesGroupDefinition

use of org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition in project uPortal by Jasig.

the class JpaPersonAttributesGroupDefinitionDao method createPersonAttributesGroupDefinition.

@PortalTransactional
@Override
public IPersonAttributesGroupDefinition createPersonAttributesGroupDefinition(String name, String description) {
    final IPersonAttributesGroupDefinition personAttributesGroupDefinition = new PersonAttributesGroupDefinitionImpl(name, description);
    this.getEntityManager().persist(personAttributesGroupDefinition);
    return personAttributesGroupDefinition;
}
Also used : IPersonAttributesGroupDefinition(org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition)

Example 13 with IPersonAttributesGroupDefinition

use of org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition in project uPortal by Jasig.

the class JpaPersonAttributesGroupDefinitionDao method updatePersonAttributesGroupDefinition.

@PortalTransactional
@Override
public IPersonAttributesGroupDefinition updatePersonAttributesGroupDefinition(IPersonAttributesGroupDefinition personAttributesGroupDefinition) {
    Validate.notNull(personAttributesGroupDefinition, "personAttributesGroupDefinition can not be null");
    final IPersonAttributesGroupDefinition persistentDefinition;
    final EntityManager entityManager = this.getEntityManager();
    if (entityManager.contains(personAttributesGroupDefinition)) {
        persistentDefinition = personAttributesGroupDefinition;
    } else {
        persistentDefinition = entityManager.merge(personAttributesGroupDefinition);
    }
    this.getEntityManager().persist(persistentDefinition);
    return persistentDefinition;
}
Also used : EntityManager(javax.persistence.EntityManager) IPersonAttributesGroupDefinition(org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition)

Aggregations

IPersonAttributesGroupDefinition (org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition)13 IPersonAttributesGroupTestGroupDefinition (org.apereo.portal.groups.pags.dao.IPersonAttributesGroupTestGroupDefinition)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 IPerson (org.apereo.portal.security.IPerson)3 EntityManager (javax.persistence.EntityManager)2 PersonAttributesGroupDefinitionImpl (org.apereo.portal.groups.pags.dao.jpa.PersonAttributesGroupDefinitionImpl)2 RuntimeAuthorizationException (org.apereo.portal.security.RuntimeAuthorizationException)2 ArrayList (java.util.ArrayList)1 EntityIdentifier (org.apereo.portal.EntityIdentifier)1 IEntityGroup (org.apereo.portal.groups.IEntityGroup)1 IPortalData (org.apereo.portal.io.xml.IPortalData)1 SimpleStringPortalData (org.apereo.portal.io.xml.SimpleStringPortalData)1 Element (org.dom4j.Element)1 QName (org.dom4j.QName)1