Package edu.monash.merc.domain

Examples of edu.monash.merc.domain.RegMetadata


        this.paWsService = paWsService;
    }

    @Override
    public String publishExpRifcs(MDRegistrationBean mdRegistrationBean) {
        RegMetadata regMetadata = mdRegistrationBean.getRegMetadata();
        StringBuilder rifcsBuilder = new StringBuilder();
        rifcsBuilder.append(getRifcsHeader());
        rifcsBuilder.append("<registryObject group=\"" + mdRegistrationBean.getRifcsGroupName() + "\">");
        rifcsBuilder.append(lineSeparator);
        String identifier = regMetadata.getUniqueId();

        rifcsBuilder.append("<key>" + identifier + "</key>");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("<originatingSource>" + mdRegistrationBean.getAppName() + "</originatingSource>");
        rifcsBuilder.append(lineSeparator);

        rifcsBuilder.append("<collection type=\"dataset\">");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("<identifier type=\"local\">" + identifier + "</identifier>");
        rifcsBuilder.append(lineSeparator);


        rifcsBuilder.append("<name type=\"primary\">");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("<namePart>" + regMetadata.getTitle() + "</namePart>");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("</name>");
        rifcsBuilder.append(lineSeparator);
        String electronicURL = mdRegistrationBean.getElectronicURL();
        if (StringUtils.isNotBlank(electronicURL)) {
            rifcsBuilder.append("<location>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("<address>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("<electronic type=\"url\">");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("<value>" + mdRegistrationBean.getElectronicURL() + "</value>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</electronic>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</address>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</location>");
            rifcsBuilder.append(lineSeparator);
        }
        String physicalAddress = mdRegistrationBean.getPhysicalAddress();
        if (StringUtils.isNotBlank(physicalAddress)) {
            rifcsBuilder.append("<location>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("<address>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("<physical type=\"address\">");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("<addressPart type=\"text\">" + mdRegistrationBean.getPhysicalAddress() + "</addressPart>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</physical>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</address>");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</location>");
            rifcsBuilder.append(lineSeparator);
        }

        List<PartyBean> partyBeans = mdRegistrationBean.getPartyBeans();
        StringBuilder relatedPartiesBuilder = new StringBuilder();
        for (PartyBean pb : partyBeans) {
            relatedPartiesBuilder.append("<relatedObject>");
            relatedPartiesBuilder.append(lineSeparator);
            relatedPartiesBuilder.append("<key>" + pb.getPartyKey() + "</key>");
            relatedPartiesBuilder.append(lineSeparator);
            relatedPartiesBuilder.append("<relation type=\"isManagedBy\" />");
            relatedPartiesBuilder.append(lineSeparator);
            relatedPartiesBuilder.append("</relatedObject>");
            relatedPartiesBuilder.append(lineSeparator);
        }
        String partiesXML = relatedPartiesBuilder.toString();
        if (StringUtils.isNotBlank(partiesXML)) {
            rifcsBuilder.append(partiesXML);
        }


        String anzsrcCodes = mdRegistrationBean.getAnzsrcCode();
        List<String> codes = MercUtil.splitAnzsrcCode(anzsrcCodes);
        for (String code : codes) {
            rifcsBuilder.append("<subject  type=\"anzsrc-for\">" + code + "</subject>");
            rifcsBuilder.append(lineSeparator);
        }
        rifcsBuilder.append("<description type=\"rights\" xml:lang=\"en\">");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append(mdRegistrationBean.getLicenceBean().getLicenceContents());
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("</description>");
        rifcsBuilder.append(lineSeparator);

        rifcsBuilder.append("<description type=\"brief\" xml:lang=\"en\">");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append(regMetadata.getDescription());
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("</description>");
        rifcsBuilder.append(lineSeparator);

        if (StringUtils.isNotBlank(mdRegistrationBean.getAccessRights())) {
            rifcsBuilder.append("<description type=\"accessRights\" xml:lang=\"en\">");
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append(mdRegistrationBean.getAccessRights());
            rifcsBuilder.append(lineSeparator);
            rifcsBuilder.append("</description>");
            rifcsBuilder.append(lineSeparator);
        }

        rifcsBuilder.append("</collection>");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append("</registryObject>");
        rifcsBuilder.append(lineSeparator);
        rifcsBuilder.append(getRifcsEnder());
        String rifcsStoreLocation = mdRegistrationBean.getRifcsStoreLocation();

        synchronized (fileLock) {
            File rifcsFile = new File(rifcsStoreLocation + File.separator + regMetadata.getUniqueId() + ".xml");
            try {
                // publish collection
                FileUtils.writeStringToFile(rifcsFile, rifcsBuilder.toString());

                // publish parties
View Full Code Here


            if (!validateMdRegInfo()) {
                stringResult = genErrorMsg(getText("dataset.metadata.reg.invalid.metadata.info"));
                return ERROR;
            }
            //get the previous RegMetadata if any
            RegMetadata previousRegMetadata = this.dmService.getRegMetadatadByDatasetId(regMetadata.getDatasetId());
            //if previous RegMetadata existed
            if (previousRegMetadata != null) {
                regMetadata.setId(previousRegMetadata.getId());
                regMetadata.setUniqueId(previousRegMetadata.getUniqueId());
            }
            //generate the rifcs unique id if required
            if (StringUtils.isBlank(regMetadata.getUniqueId())) {
                String monUuid = this.identifierService.genUUIDWithPrefix();
                regMetadata.setUniqueId(monUuid);
View Full Code Here

                p = copyPartyBeanToParty(partybean);
                saveParty(p);
            }
            parties.add(p);
        }
        RegMetadata regMetadata = mdRegistrationBean.getRegMetadata();
        //add the parties
        regMetadata.setParties(parties);
        //persist the RegMetadata (save or update)
        if (regMetadata.getId() == 0) {
            this.saveRegMetadata(regMetadata);
        } else {
            this.updateRegMetadata(regMetadata);
        }
        //save the licence:
        LicenceBean licenceBean = mdRegistrationBean.getLicenceBean();
        Licence licence = copyLicenceBeanToLicence(licenceBean);
        licence.setRegMetadata(regMetadata);
        if (licence.getId() == 0) {
            Licence existedLicence = this.getLicenceByRegMetadataId(regMetadata.getId());
            if (existedLicence != null) {
                licence.setId(existedLicence.getId());
                this.mergeLicence(licence);
            } else {
                this.saveLicence(licence);
View Full Code Here

TOP

Related Classes of edu.monash.merc.domain.RegMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.