Search in sources :

Example 51 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project testnorge by navikt.

the class SykepengerIArbeidsgiverperiodenDTO method toXmlElement.

@Override
public XMLSykepengerIArbeidsgiverperioden toXmlElement() {
    ObjectFactory factory = new ObjectFactory();
    XMLSykepengerIArbeidsgiverperioden xmlSykepengerIArbeidsgiverperioden = factory.createXMLSykepengerIArbeidsgiverperioden();
    if (arbeidsgiverperiodeListe != null) {
        XMLArbeidsgiverperiodeListe xmlArbeidsgiverperiodeListe = factory.createXMLArbeidsgiverperiodeListe();
        xmlArbeidsgiverperiodeListe.withArbeidsgiverperiode(PeriodeDTO.convert(arbeidsgiverperiodeListe));
        xmlSykepengerIArbeidsgiverperioden.setArbeidsgiverperiodeListe(factory.createXMLSykepengerIArbeidsgiverperiodenArbeidsgiverperiodeListe(xmlArbeidsgiverperiodeListe));
    }
    xmlSykepengerIArbeidsgiverperioden.setBruttoUtbetalt(factory.createXMLSykepengerIArbeidsgiverperiodenBruttoUtbetalt(bruttoUtbetalt != null ? BigDecimal.valueOf(bruttoUtbetalt) : null));
    xmlSykepengerIArbeidsgiverperioden.setBegrunnelseForReduksjonEllerIkkeUtbetalt(factory.createXMLSykepengerIArbeidsgiverperiodenBegrunnelseForReduksjonEllerIkkeUtbetalt(begrunnelseForReduksjonEllerIkkeUtbetalt));
    return xmlSykepengerIArbeidsgiverperioden;
}
Also used : ObjectFactory(no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory) XMLArbeidsgiverperiodeListe(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLArbeidsgiverperiodeListe) XMLSykepengerIArbeidsgiverperioden(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLSykepengerIArbeidsgiverperioden)

Example 52 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project testnorge by navikt.

the class UtsettelseAvForeldrepengerDTO method toXmlElement.

@Override
public XMLUtsettelseAvForeldrepenger toXmlElement() {
    ObjectFactory factory = new ObjectFactory();
    XMLUtsettelseAvForeldrepenger xmlUtsettelseAvForeldrepenger = factory.createXMLUtsettelseAvForeldrepenger();
    xmlUtsettelseAvForeldrepenger.setPeriode(factory.createXMLUtsettelseAvForeldrepengerPeriode(periode != null ? periode.toXmlElement() : null));
    xmlUtsettelseAvForeldrepenger.setAarsakTilUtsettelse(factory.createXMLUtsettelseAvForeldrepengerAarsakTilUtsettelse(aarsakTilUtsettelse));
    return xmlUtsettelseAvForeldrepenger;
}
Also used : ObjectFactory(no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory) XMLUtsettelseAvForeldrepenger(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLUtsettelseAvForeldrepenger)

Example 53 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project bw-caldav by Bedework.

the class CaldavCalNode method generateXrdProperties.

@Override
public boolean generateXrdProperties(final List<Object> props, final String name, final WebdavNsIntf intf, final boolean allProp) throws WebdavException {
    try {
        int calType;
        CalDAVCollection<?> c = // deref this
        (CalDAVCollection<?>) getCollection(true);
        if (c == null) {
            // Probably no access -- fake it up as a collection
            calType = CalDAVCollection.calTypeCollection;
        } else {
            calType = c.getCalType();
        }
        if (name.equals(CalWSXrdDefs.collection)) {
            props.add(xrdEmptyProperty(name));
            if (calType == CalDAVCollection.calTypeInbox) {
                props.add(xrdEmptyProperty(CalWSXrdDefs.inbox));
            } else if (calType == CalDAVCollection.calTypeOutbox) {
                props.add(xrdEmptyProperty(CalWSXrdDefs.outbox));
            } else if (calType == CalDAVCollection.calTypeCalendarCollection) {
                props.add(xrdEmptyProperty(CalWSXrdDefs.calendarCollection));
            }
            return true;
        }
        if (name.equals(CalWSXrdDefs.description)) {
            String s = col.getDescription();
            if (s == null) {
                return true;
            }
            props.add(xrdProperty(name, s));
            return true;
        }
        if (name.equals(CalWSXrdDefs.principalHome)) {
            if (!rootNode || intf.getAnonymous()) {
                return true;
            }
            SysIntf si = getSysi();
            CalPrincipalInfo cinfo = si.getCalPrincipalInfo(si.getPrincipal());
            if (cinfo.userHomePath == null) {
                return true;
            }
            props.add(xrdProperty(name, getUrlValue(cinfo.userHomePath, true)));
            return true;
        }
        if (name.equals(CalWSXrdDefs.maxAttendeesPerInstance)) {
            if (!rootNode) {
                return true;
            }
            Integer val = getSysi().getAuthProperties().getMaxAttendeesPerInstance();
            if (val == null) {
                return true;
            }
            props.add(xrdProperty(name, String.valueOf(val)));
            return true;
        }
        if (name.equals(CalWSXrdDefs.maxDateTime)) {
            if (!rootNode) {
                return true;
            }
            Integer val = getSysi().getAuthProperties().getMaxAttendeesPerInstance();
            if (val == null) {
                return false;
            }
            props.add(xrdProperty(name, String.valueOf(val)));
            return true;
        }
        if (name.equals(CalWSXrdDefs.maxInstances)) {
            if (!rootNode) {
                return true;
            }
            Integer val = getSysi().getAuthProperties().getMaxInstances();
            if (val == null) {
                return false;
            }
            props.add(xrdProperty(name, String.valueOf(val)));
            return true;
        }
        if (name.equals(CalWSXrdDefs.maxResourceSize)) {
            if (!rootNode) {
                return true;
            }
            Integer val = getSysi().getAuthProperties().getMaxUserEntitySize();
            if (val == null) {
                return false;
            }
            props.add(xrdProperty(name, String.valueOf(val)));
            return true;
        }
        if (name.equals(CalWSXrdDefs.minDateTime)) {
            if (!rootNode) {
                return true;
            }
            String val = getSysi().getAuthProperties().getMinDateTime();
            if (val == null) {
                return false;
            }
            props.add(xrdProperty(name, val));
            return true;
        }
        if (name.equals(CalWSXrdDefs.timezone)) {
            String tzid = col.getTimezone();
            if (tzid == null) {
                return false;
            }
            props.add(xrdProperty(name, tzid));
            return true;
        }
        if (name.equals(CalWSXrdDefs.supportedCalendarComponentSet)) {
            SupportedCalendarComponentSetType sccs = new SupportedCalendarComponentSetType();
            List<String> comps = c.getSupportedComponents();
            if (Util.isEmpty(comps)) {
                return false;
            }
            ObjectFactory of = new ObjectFactory();
            for (String s : comps) {
                JAXBElement<? extends BaseComponentType> el = null;
                switch(s) {
                    case "VEVENT":
                        el = of.createVevent(new VeventType());
                        break;
                    case "VTODO":
                        el = of.createVtodo(new VtodoType());
                        break;
                    case "VAVAILABILITY":
                        el = of.createVavailability(new VavailabilityType());
                        break;
                }
                if (el != null) {
                    sccs.getBaseComponent().add(el);
                }
            }
            JAXBElement<SupportedCalendarComponentSetType> el = new JAXBElement<>(CalWSSoapTags.supportedCalendarComponentSet, SupportedCalendarComponentSetType.class, sccs);
            props.add(el);
            return true;
        }
        // Not known - try higher
        return super.generateXrdProperties(props, name, intf, allProp);
    } catch (WebdavException wde) {
        throw wde;
    } catch (Throwable t) {
        throw new WebdavException(t);
    }
}
Also used : WebdavException(org.bedework.webdav.servlet.shared.WebdavException) JAXBElement(javax.xml.bind.JAXBElement) BigInteger(java.math.BigInteger) SysIntf(org.bedework.caldav.server.sysinterface.SysIntf) VavailabilityType(ietf.params.xml.ns.icalendar_2.VavailabilityType) ObjectFactory(ietf.params.xml.ns.icalendar_2.ObjectFactory) VtodoType(ietf.params.xml.ns.icalendar_2.VtodoType) VeventType(ietf.params.xml.ns.icalendar_2.VeventType) SupportedCalendarComponentSetType(org.oasis_open.docs.ws_calendar.ns.soap.SupportedCalendarComponentSetType) CalPrincipalInfo(org.bedework.caldav.server.sysinterface.CalPrincipalInfo)

Example 54 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project midpoint by Evolveum.

the class TestConsistencyMechanism method test511AssignAccountMorgan.

/**
 * assign account to the user morgan. Account with the same 'uid' (not dn, nut other secondary identifier already exists)
 * account should be linked to the user.
 */
@Test
public void test511AssignAccountMorgan() throws Exception {
    // GIVEN
    openDJController.assumeRunning();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    // prepare new OU in opendj
    openDJController.addEntryFromLdifFile(LDIF_CREATE_USERS_OU_FILE);
    PrismObject<UserType> user = repositoryService.getObject(UserType.class, USER_MORGAN_OID, null, result);
    display("User Morgan: ", user);
    ExpressionType expression = new ExpressionType();
    ObjectFactory of = new ObjectFactory();
    RawType raw = new RawType(prismContext.xnodeFactory().primitive("uid=morgan,ou=users,dc=example,dc=com").frozen(), prismContext);
    JAXBElement<?> val = of.createValue(raw);
    expression.getExpressionEvaluator().add(val);
    MappingType mapping = new MappingType();
    mapping.setExpression(expression);
    ResourceAttributeDefinitionType attrDefType = new ResourceAttributeDefinitionType();
    attrDefType.setRef(new ItemPathType(ItemPath.create(getOpenDjSecondaryIdentifierQName())));
    attrDefType.setOutbound(mapping);
    ConstructionType construction = new ConstructionType();
    construction.getAttribute().add(attrDefType);
    construction.setResourceRef(ObjectTypeUtil.createObjectRef(resourceTypeOpenDjrepo, prismContext));
    AssignmentType assignment = new AssignmentType();
    assignment.setConstruction(construction);
    // noinspection unchecked
    ObjectDelta<UserType> userDelta = prismContext.deltaFactory().object().createModificationAddContainer(UserType.class, USER_MORGAN_OID, UserType.F_ASSIGNMENT, assignment.asPrismContainerValue());
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(userDelta);
    // WHEN
    when();
    modelService.executeChanges(deltas, null, task, result);
    // THEN
    then();
    result.computeStatus();
    // assertEquals("Expected handled error but got: " + result.getStatus(), OperationResultStatus.HANDLED_ERROR, result.getStatus());
    PrismObject<UserType> userMorgan = modelService.getObject(UserType.class, USER_MORGAN_OID, null, task, result);
    display("User morgan after", userMorgan);
    UserType userMorganType = userMorgan.asObjectable();
    assertEquals("Unexpected number of accountRefs", 1, userMorganType.getLinkRef().size());
    String accountOid = userMorganType.getLinkRef().iterator().next().getOid();
    // Check shadow
    PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
    provisioningService.applyDefinition(accountShadow, task, result);
    assertShadowRepo(accountShadow, accountOid, "uid=morgan,ou=users,dc=example,dc=com", resourceTypeOpenDjrepo, RESOURCE_OPENDJ_ACCOUNT_OBJECTCLASS);
    // Check account
    PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
    assertShadowModel(accountModel, accountOid, "uid=morgan,ou=users,dc=example,dc=com", resourceTypeOpenDjrepo, RESOURCE_OPENDJ_ACCOUNT_OBJECTCLASS);
    ResourceAttribute<?> attributes = ShadowUtil.getAttribute(accountModel, new QName(MidPointConstants.NS_RI, "uid"));
    assertEquals("morgan", attributes.getAnyRealValue());
// TODO: check OpenDJ Account
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) QName(javax.xml.namespace.QName) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 55 with ObjectFactory

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.ObjectFactory in project midpoint by Evolveum.

the class TestPlentyOfAssignments method initSystem.

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
    super.initSystem(initTask, initResult);
    initDummyResourcePirate(null, RESOURCE_DUMMY_FILE, RESOURCE_DUMMY_OID, initTask, initResult);
    importObjectFromFile(ROLE_BASIC_FILE, initResult);
    ObjectFactory objectFactory = new ObjectFactory();
    generateRoles(NUMBER_OF_GENERATED_EMPTY_ROLES, "Empty Role %04d", GENERATED_EMPTY_ROLE_OID_FORMAT, null, initResult);
    generateRoles(NUMBER_OF_GENERATED_DUMMY_ROLES, "Dummy Role %04d", GENERATED_DUMMY_ROLE_OID_FORMAT, (role, i) -> {
        ItemPathType attrPath = new ItemPathType(ItemPath.create(new QName(RESOURCE_DUMMY_NS, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME)));
        JAXBElement<Object> evaluator = objectFactory.createValue(formatRum(i));
        role.beginInducement().beginConstruction().resourceRef(RESOURCE_DUMMY_OID, ResourceType.COMPLEX_TYPE).kind(ShadowKindType.ACCOUNT).beginAttribute().ref(attrPath).beginOutbound().beginExpression().expressionEvaluator(evaluator);
    }, initResult);
    inspector = new CountingInspector();
    InternalMonitor.setInspector(inspector);
}
Also used : ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) QName(javax.xml.namespace.QName) PrismObject(com.evolveum.midpoint.prism.PrismObject)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)35 Test (org.junit.Test)29 ArrayList (java.util.ArrayList)26 Marshaller (javax.xml.bind.Marshaller)24 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 StringWriter (java.io.StringWriter)19 JAXBContext (javax.xml.bind.JAXBContext)19 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 ObjectFactory (no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory)16 QName (javax.xml.namespace.QName)15 BigInteger (java.math.BigInteger)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 ObjectFactory (slash.navigation.kml.binding22.ObjectFactory)12 ObjectFactory (com.opensymphony.xwork2.ObjectFactory)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11