use of org.alfresco.util.PropertyMap in project alfresco-remote-api by Alfresco.
the class AbstractSiteServiceTest method createPerson.
protected void createPerson(String userName) {
PropertyMap ppOne = new PropertyMap(4);
ppOne.put(ContentModel.PROP_USERNAME, userName);
ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName");
ppOne.put(ContentModel.PROP_LASTNAME, "lastName");
ppOne.put(ContentModel.PROP_EMAIL, "email@email.com");
ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle");
this.personService.createPerson(ppOne);
}
use of org.alfresco.util.PropertyMap in project alfresco-remote-api by Alfresco.
the class CommentsApiTest method createUser.
private void createUser(String userName) {
// if user with given user name doesn't already exist then create user
if (!authenticationService.authenticationExists(userName)) {
// create user
authenticationService.createAuthentication(userName, "password".toCharArray());
}
if (!personService.personExists(userName)) {
// create person properties
PropertyMap personProps = new PropertyMap();
personProps.put(ContentModel.PROP_USERNAME, userName);
personProps.put(ContentModel.PROP_FIRSTNAME, "FirstNameTest");
personProps.put(ContentModel.PROP_LASTNAME, "LastNameTest");
personProps.put(ContentModel.PROP_EMAIL, "FirstNameTest.LastNameTest@test.com");
personProps.put(ContentModel.PROP_JOBTITLE, "JobTitleTest");
// create person node for user
personService.createPerson(personProps);
}
}
use of org.alfresco.util.PropertyMap in project alfresco-remote-api by Alfresco.
the class ContentGetTest method createUser.
private void createUser(String userName) {
if (!this.authenticationService.authenticationExists(userName)) {
this.authenticationService.createAuthentication(userName, "PWD".toCharArray());
PropertyMap ppOne = new PropertyMap(5);
ppOne.put(ContentModel.PROP_USERNAME, userName);
ppOne.put(ContentModel.PROP_FIRSTNAME, "firstName");
ppOne.put(ContentModel.PROP_LASTNAME, "lastName");
ppOne.put(ContentModel.PROP_EMAIL, "email@email.com");
ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle");
this.personService.createPerson(ppOne);
}
}
use of org.alfresco.util.PropertyMap in project alfresco-remote-api by Alfresco.
the class DiscussionRestApiTest method createUser.
private void createUser(String userName, String role, String siteName) {
// if user with given user name doesn't already exist then create user
if (!this.authenticationService.authenticationExists(userName)) {
// create user
this.authenticationService.createAuthentication(userName, "password".toCharArray());
}
if (!this.personService.personExists(userName)) {
// create person properties
PropertyMap personProps = new PropertyMap();
personProps.put(ContentModel.PROP_USERNAME, userName);
personProps.put(ContentModel.PROP_FIRSTNAME, "FirstName123");
personProps.put(ContentModel.PROP_LASTNAME, "LastName123");
personProps.put(ContentModel.PROP_EMAIL, "FirstName123.LastName123@email.com");
personProps.put(ContentModel.PROP_JOBTITLE, "JobTitle123");
personProps.put(ContentModel.PROP_JOBTITLE, "Organisation123");
// create person node for user
this.personService.createPerson(personProps);
}
// add the user as a member with the given role
this.siteService.setMembership(siteName, userName, role);
// Give the test user access to the test node
// They need to be able to read it, and create children of it
permissionService.setPermission(FORUM_NODE, userName, PermissionService.READ, true);
permissionService.setPermission(FORUM_NODE, userName, PermissionService.CREATE_CHILDREN, true);
}
use of org.alfresco.util.PropertyMap in project records-management by Alfresco.
the class RecordServiceImpl method createRecord.
/**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean)
*/
@Override
public void createRecord(final NodeRef filePlan, final NodeRef nodeRef, final boolean isLinked) {
// filePlan can be null. In this case the default RM site will be used.
ParameterCheck.mandatory("nodeRef", nodeRef);
ParameterCheck.mandatory("isLinked", isLinked);
recordCreationSanityCheckOnNode(nodeRef);
final NodeRef checkedFilePlan = recordCreationSanityCheckOnFilePlan(filePlan);
invokeBeforeRecordDeclaration(nodeRef);
// do the work of creating the record as the system user
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() {
@Override
public Void doWork() {
if (!nodeService.hasAspect(nodeRef, ASPECT_RECORD)) {
// disable delete rules
ruleService.disableRuleType("outbound");
try {
// get the new record container for the file plan
NodeRef newRecordContainer = filePlanService.getUnfiledContainer(checkedFilePlan);
if (newRecordContainer == null) {
throw new AlfrescoRuntimeException("Unable to create record, because new record container could not be found.");
}
// get the documents readers and writers
Pair<Set<String>, Set<String>> readersAndWriters = extendedPermissionService.getReadersAndWriters(nodeRef);
// get the current owner
String owner = ownableService.getOwner(nodeRef);
// get the documents primary parent assoc
ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
// get the latest version record, if there is one
NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef);
behaviourFilter.disableBehaviour();
try {
// move the document into the file plan
nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
} finally {
behaviourFilter.enableBehaviour();
}
// save the information about the originating details
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(3);
aspectProperties.put(PROP_RECORD_ORIGINATING_LOCATION, parentAssoc.getParentRef());
aspectProperties.put(PROP_RECORD_ORIGINATING_USER_ID, owner);
aspectProperties.put(PROP_RECORD_ORIGINATING_CREATION_DATE, new Date());
nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties);
// make the document a record
makeRecord(nodeRef);
generateRecordIdentifier(nodeService, identifierService, nodeRef);
if (latestVersionRecord != null) {
// indicate that this is the 'final' record version
PropertyMap versionRecordProps = new PropertyMap(2);
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, I18NUtil.getMessage(FINAL_VERSION));
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, I18NUtil.getMessage(FINAL_DESCRIPTION));
nodeService.addAspect(nodeRef, RecordableVersionModel.ASPECT_VERSION_RECORD, versionRecordProps);
// link to previous version
relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord);
}
if (isLinked) {
// turn off rules
ruleService.disableRules();
try {
// maintain the original primary location
nodeService.addChild(parentAssoc.getParentRef(), nodeRef, parentAssoc.getTypeQName(), parentAssoc.getQName());
// set the extended security
extendedSecurityService.set(nodeRef, readersAndWriters);
} finally {
ruleService.enableRules();
}
}
} finally {
ruleService.enableRuleType("outbound");
}
}
return null;
}
});
invokeOnRecordDeclaration(nodeRef);
}
Aggregations