Search in sources :

Example 6 with MonoTextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.

the class UserProfileManagerIntegrationTest method createProfile.

private IUserProfile createProfile(String name, String surname, String email, Date birthdate, String language) {
    IUserProfile profile = this._profileManager.getDefaultProfileType();
    MonoTextAttribute nameAttr = (MonoTextAttribute) profile.getAttribute("fullname");
    nameAttr.setText(name + " " + surname);
    MonoTextAttribute emailAttr = (MonoTextAttribute) profile.getAttribute("email");
    emailAttr.setText(email);
    DateAttribute birthdateAttr = (DateAttribute) profile.getAttribute("birthdate");
    birthdateAttr.setDate(birthdate);
    MonoTextAttribute languageAttr = (MonoTextAttribute) profile.getAttribute("language");
    languageAttr.setText(language);
    ((UserProfile) profile).setPublicProfile(true);
    return profile;
}
Also used : UserProfile(org.entando.entando.aps.system.services.userprofile.model.UserProfile) IUserProfile(org.entando.entando.aps.system.services.userprofile.model.IUserProfile) IUserProfile(org.entando.entando.aps.system.services.userprofile.model.IUserProfile) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute) DateAttribute(com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)

Example 7 with MonoTextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.

the class UserProfileManagerIntegrationTest method testAddProfile.

public void testAddProfile() throws Throwable {
    String username = "admin";
    Date birthdate = this.getBirthdate(1982, 10, 25);
    IUserProfile profile = this.createProfile("stefano", "puddu", "spuddu@agiletec.it", birthdate, "it");
    try {
        this._profileManager.addProfile("admin", profile);
        IUserProfile added = this._profileManager.getProfile(username);
        assertEquals("spuddu@agiletec.it", added.getValue("email"));
        assertEquals(username, added.getUsername());
        MonoTextAttribute emailAttr = (MonoTextAttribute) ((IUserProfile) profile).getAttribute("email");
        emailAttr.setText("agiletectest@gmail.com");
        this._profileManager.updateProfile(profile.getUsername(), profile);
        IUserProfile updated = this._profileManager.getProfile(username);
        assertEquals("agiletectest@gmail.com", updated.getValue("email"));
        assertEquals(username, added.getUsername());
    } catch (Throwable t) {
        throw t;
    } finally {
        this._profileManager.deleteProfile(username);
        assertNull(this._profileManager.getProfile(username));
    }
}
Also used : IUserProfile(org.entando.entando.aps.system.services.userprofile.model.IUserProfile) Date(java.util.Date) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)

Example 8 with MonoTextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.

the class UserProfileManagerTest method testAddProfile.

@Test
public void testAddProfile() throws ApsSystemException {
    // @formatter:off
    when(entityTypeFactory.extractEntityType(SystemConstants.DEFAULT_PROFILE_TYPE_CODE, UserProfile.class, configItemName, this.entityTypeDom, userProfileManager.getName(), this.entityDom)).thenReturn(this.createFakeProfile(SystemConstants.DEFAULT_PROFILE_TYPE_CODE));
    // @formatter:on
    IUserProfile userProfile = userProfileManager.getDefaultProfileType();
    String name = "Jack_Bower";
    MonoTextAttribute attribute = (MonoTextAttribute) userProfile.getAttribute("Name");
    attribute.setText(name);
    this.userProfileManager.addProfile(name, userProfile);
    assertThat(userProfile.getId(), is(name));
    Mockito.verify(userProfileDAO, Mockito.times(1)).addEntity(userProfile);
    Mockito.verify(notifyManager, Mockito.times(1)).publishEvent(Mockito.any(ProfileChangedEvent.class));
}
Also used : IUserProfile(org.entando.entando.aps.system.services.userprofile.model.IUserProfile) ProfileChangedEvent(org.entando.entando.aps.system.services.userprofile.event.ProfileChangedEvent) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute) Test(org.junit.Test)

Example 9 with MonoTextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.

the class UserProfileManagerTest method createFakeProfile.

private IApsEntity createFakeProfile(String defaultProfileTypeCode) {
    UserProfile userProfile = new UserProfile();
    MonoTextAttribute monoTextAttribute = new MonoTextAttribute();
    monoTextAttribute.setName("Name");
    monoTextAttribute.setHandler(new MonoTextAttributeHandler());
    userProfile.addAttribute(monoTextAttribute);
    userProfile.setTypeCode(defaultProfileTypeCode);
    return userProfile;
}
Also used : UserProfile(org.entando.entando.aps.system.services.userprofile.model.UserProfile) IUserProfile(org.entando.entando.aps.system.services.userprofile.model.IUserProfile) MonoTextAttributeHandler(com.agiletec.aps.system.common.entity.parse.attribute.MonoTextAttributeHandler) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)

Example 10 with MonoTextAttribute

use of com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute in project entando-core by entando.

the class TestContentDAO method getMockContent.

private Content getMockContent() {
    Content content = this._contentManager.createContentType("ART");
    content.setId("temp");
    content.setMainGroup(Group.FREE_GROUP_NAME);
    content.addGroup("firstGroup");
    content.addGroup("secondGroup");
    content.addGroup("thirdGroup");
    AttributeInterface attribute = new MonoTextAttribute();
    attribute.setName("temp");
    attribute.setDefaultLangCode("it");
    attribute.setRenderingLang("it");
    attribute.setSearchable(true);
    attribute.setType("Monotext");
    content.addAttribute(attribute);
    content.setDefaultLang("it");
    content.setDefaultModel("content_viewer");
    content.setDescription("temp");
    content.setListModel("Monolist");
    content.setRenderingLang("it");
    content.setStatus("Bozza");
    content.setTypeCode("ART");
    content.setTypeDescription("Articolo rassegna stampa");
    return content;
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface) MonoTextAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)

Aggregations

MonoTextAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)11 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)6 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)5 DateAttribute (com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)4 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)3 CheckBoxAttribute (com.agiletec.aps.system.common.entity.model.attribute.CheckBoxAttribute)2 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)2 EnumeratorAttribute (com.agiletec.aps.system.common.entity.model.attribute.EnumeratorAttribute)2 HypertextAttribute (com.agiletec.aps.system.common.entity.model.attribute.HypertextAttribute)2 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)2 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)2 NumberAttribute (com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute)2 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)2 ThreeStateAttribute (com.agiletec.aps.system.common.entity.model.attribute.ThreeStateAttribute)2 Date (java.util.Date)2 EnumeratorMapAttribute (org.entando.entando.aps.system.common.entity.model.attribute.EnumeratorMapAttribute)2 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)2 UserProfile (org.entando.entando.aps.system.services.userprofile.model.UserProfile)2 MonoTextAttributeHandler (com.agiletec.aps.system.common.entity.parse.attribute.MonoTextAttributeHandler)1 EntityAttributeIterator (com.agiletec.aps.system.common.util.EntityAttributeIterator)1