Package org.dspace.eperson

Examples of org.dspace.eperson.EPerson


        try {
            Group group = Group.find(context, Integer.parseInt(ref.getId()));
            if (group != null) {
                if (EPerson.findByEmail(context, email) == null) {
                    EPerson ePerson = EPerson.create(context);
                    if (ePerson != null) {
                        result = String.valueOf(ePerson.getID());
                        ePerson.setEmail(email);
                        ePerson.setFirstName(firstName);
                        ePerson.setLastName(lastName);
                        if (password != null && !"".equals(password)) ePerson.setPassword(password);
                        ePerson.setMetadata("phone", phone);
                        ePerson.setNetid(netId);
                        ePerson.setLanguage(language);
                        ePerson.setCanLogIn(canLogIn);
                        ePerson.setRequireCertificate(requireCertificate);
                        ePerson.setSelfRegistered(selfRegistered);
                        ePerson.update();

                        group.addMember(ePerson);
                        group.update();
                    } else {
                        throw new EntityException("Internal server error", "Could not create ePerson", 500);
View Full Code Here


            for (int i = 0; i < epeopleRows.size(); i++) {
                TableRow row = epeopleRows.get(i);

                // First check the cache
                EPerson fromCache = (EPerson) context.fromCache(EPerson.class, row.getIntColumn("eperson_id"));

                if (fromCache != null) {
                    epeople[i] = fromCache;
                } else {
                    epeople[i] = EPerson.find(context, row.getIntColumn("eperson_id"));
View Full Code Here

            for (int i = 0; i < epeopleRows.size(); i++) {
                TableRow row = epeopleRows.get(i);

                // First check the cache
                EPerson fromCache = (EPerson) context.fromCache(EPerson.class, row.getIntColumn("eperson_id"));

                if (fromCache != null) {
                    epeople[i] = fromCache;
                } else {
                    epeople[i] = EPerson.find(context, row.getIntColumn("eperson_id"));
View Full Code Here

        String timestamp = DCDate.getCurrent().toString();

        // Add suitable provenance - includes user, date, collections +
        // bitstream checksums
        EPerson e = ourContext.getCurrentUser();

        // Build some provenance data while we're at it.
        StringBuilder prov = new StringBuilder();

        prov.append("Item withdrawn by ").append(e.getFullName()).append(" (")
                .append(e.getEmail()).append(") on ").append(timestamp).append("\n")
                .append("Item was in collections:\n");

        Collection[] colls = getCollections();

        for (int i = 0; i < colls.length; i++)
        {
            prov.append(colls[i].getMetadata("name")).append(" (ID: ").append(colls[i].getID()).append(")\n");
        }

        // Set withdrawn flag. timestamp will be set; last_modified in update()
        itemRow.setColumn("withdrawn", true);

        // in_archive flag is now false
        itemRow.setColumn("in_archive", false);

        prov.append(InstallItem.getBitstreamProvenanceMessage(this));

        addDC("description", "provenance", "en", prov.toString());

        // Update item in DB
        update();

        ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), "WITHDRAW"));

        // remove all authorization policies, saving the custom ones
        AuthorizeManager.removeAllPoliciesByDSOAndTypeNotEqualsTo(ourContext, this, ResourcePolicy.TYPE_CUSTOM);

        // Write log
        log.info(LogManager.getHeader(ourContext, "withdraw_item", "user="
                + e.getEmail() + ",item_id=" + getID()));
    }
View Full Code Here

        return wfItems.toArray(new WorkflowItem[wfItems.size()]);
    }

    private static String fillSqlWorkflow(Context c, String reviewerStr, String submitterStr, String[] fields, String status, String sort) {
        int epid = 0;
        EPerson ep = c.getCurrentUser();
        if (ep != null) {
            epid = ep.getID();
        }

        int reviewer = parseEPersonInt(c, reviewerStr);
        int submitter = parseEPersonInt(c, submitterStr);
View Full Code Here

        try {
            Group group = Group.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, group, Constants.WRITE);
            if (group != null) {
                EPerson ePerson = EPerson.find(context, Integer.parseInt(id));
                if (ePerson != null) {
                    group.addMember(ePerson);
                    group.update();
                } else {
                    throw new IllegalArgumentException("Invalid id:" + ref.getId());
View Full Code Here

        return wsItems.toArray(new WorkspaceItem[wsItems.size()]);
    }

    private static String fillSqlSubmission(Context c) {
        int epid = 0;
        EPerson ep = c.getCurrentUser();
        if (ep != null) {
            epid = ep.getID();
        }

        String sql = "SELECT workspaceitem.* FROM workspaceitem, item " +
                "       WHERE workspaceitem.item_id=item.item_id " +
                "       AND item.submitter_id= "+epid+" \n" +
View Full Code Here

                return Integer.parseInt(str);
            } catch (NumberFormatException e) {
            }

            try {
                EPerson ePerson = EPerson.findByEmail(c, str);
                if (ePerson != null) {
                    return ePerson.getID();
                }
            } catch (SQLException ee) {
            } catch (AuthorizeException e1) {
            }
        }
View Full Code Here

        // Build some provenance data while we're at it.
        Collection[] colls = getCollections();

        // Add suitable provenance - includes user, date, collections +
        // bitstream checksums
        EPerson e = ourContext.getCurrentUser();
        StringBuilder prov = new StringBuilder();
        prov.append("Item reinstated by ").append(e.getFullName()).append(" (")
                .append(e.getEmail()).append(") on ").append(timestamp).append("\n")
                .append("Item was in collections:\n");

        for (int i = 0; i < colls.length; i++)
        {
            prov.append(colls[i].getMetadata("name")).append(" (ID: ").append(colls[i].getID()).append(")\n");
        }
       
        // Clear withdrawn flag
        itemRow.setColumn("withdrawn", false);

        // in_archive flag is now true
        itemRow.setColumn("in_archive", true);

        // Add suitable provenance - includes user, date, collections +
        // bitstream checksums
        prov.append(InstallItem.getBitstreamProvenanceMessage(this));

        addDC("description", "provenance", "en", prov.toString());

        // Update item in DB
        update();

        ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), "REINSTATE"));

        // authorization policies
        if (colls.length > 0)
        {
            // FIXME: not multiple inclusion friendly - just apply access
            // policies from first collection
            // remove the item's policies and replace them with
            // the defaults from the collection
            inheritCollectionDefaultPolicies(colls[0]);
        }

        // Write log
        log.info(LogManager.getHeader(ourContext, "reinstate_item", "user="
                + e.getEmail() + ",item_id=" + getID()));
    }
View Full Code Here

        try {
            Group group = Group.find(context, Integer.parseInt(ref.getId()));
            AuthorizeManager.authorizeAction(context, group, Constants.WRITE);
            if ((group != null)) {
                int eid = Integer.parseInt((String) inputVar.get("eid"));
                EPerson ePerson = EPerson.find(context, eid);
                if (ePerson != null) {
                    group.removeMember(ePerson);
                    group.update();
                }
            }
View Full Code Here

TOP

Related Classes of org.dspace.eperson.EPerson

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.