本文整理匯總了Java中org.alfresco.service.cmr.repository.NodeService.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeService.getProperty方法的具體用法?Java NodeService.getProperty怎麽用?Java NodeService.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.alfresco.service.cmr.repository.NodeService
的用法示例。
在下文中一共展示了NodeService.getProperty方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ScriptUser
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
* Constructs a scriptable object representing a user.
*
* @param userName The username
* @param personNodeRef The NodeRef
* @param serviceRegistry A ServiceRegistry instance
* @param scope Script scope
* @since 4.0
*/
public ScriptUser(String userName, NodeRef personNodeRef, ServiceRegistry serviceRegistry, Scriptable scope)
{
this.serviceRegistry = serviceRegistry;
this.authorityService = serviceRegistry.getAuthorityService();
this.personService = serviceRegistry.getPersonService();
this.scope = scope;
this.personNodeRef = personNodeRef == null ? personService.getPerson(userName) : personNodeRef;
this.userName = userName;
this.shortName = authorityService.getShortName(userName);
NodeService nodeService = serviceRegistry.getNodeService();
String firstName = (String)nodeService.getProperty(this.personNodeRef, ContentModel.PROP_FIRSTNAME);
String lastName = (String)nodeService.getProperty(this.personNodeRef, ContentModel.PROP_LASTNAME);
this.displayName = this.fullName = (firstName != null ? firstName : "") + (lastName != null ? (' ' + lastName) : "");
}
示例2: setPersistedHeaders
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
private void setPersistedHeaders() throws MessagingException
{
NodeService nodeService = serviceRegistry.getNodeService();
if (nodeService.hasAspect(messageFileInfo.getNodeRef(), ImapModel.ASPECT_IMAP_MESSAGE_HEADERS))
{
@SuppressWarnings("unchecked")
List<String> messageHeaders = (List<String>)nodeService.getProperty(messageFileInfo.getNodeRef(), ImapModel.PROP_MESSAGE_HEADERS);
if (messageHeaders == null)
{
return;
}
for (String header : messageHeaders)
{
String headerValue = header.substring(header.indexOf(ImapModel.MESSAGE_HEADER_TO_PERSIST_SPLITTER) + 1);
String headerName = header.substring(0, header.indexOf(ImapModel.MESSAGE_HEADER_TO_PERSIST_SPLITTER));
setHeader(headerName, headerValue);
}
}
}
示例3: getNodeCreationDateComparator
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public Comparator<NodeRef> getNodeCreationDateComparator(final NodeService nodeService)
{
return new Comparator<NodeRef>()
{
private Map<NodeRef, Long> dates = new HashMap<NodeRef, Long>();
public int compare(NodeRef o1, NodeRef o2)
{
long date1 = getDate(o1);
long date2 = getDate(o1);
return (int)(date1 - date2);
}
private long getDate(NodeRef node)
{
Long date = dates.get(node);
if(date == null)
{
Date dateObj = (Date) nodeService.getProperty(node, ContentModel.PROP_CREATED);
date = dateObj == null ? -1 : dateObj.getTime();
dates.put(node, date);
}
return date;
}
};
}
示例4: getDisplayLabel
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
@Override
public FacetLabel getDisplayLabel(String value)
{
String name = null;
final NodeRef personRef = serviceRegistry.getPersonService().getPersonOrNull(value);
if (personRef != null)
{
NodeService nodeService = serviceRegistry.getNodeService();
final String firstName = (String) nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
final String lastName = (String) nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
name = (firstName != null ? firstName + " " : "") + (lastName != null ? lastName : "");
}
return new FacetLabel(value, name == null ? value : name.trim(), -1);
}
示例5: createNodeLocation
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
* This method creates a {@link RenditionLocation} object from the specified destination node.
* This is formed from the specified destination NodeRef, its cm:name and its primary parent.
*
* @param destination NodeRef
* @return RenditionLocationImpl
* @throws RenditionServiceException if the destination node does not exist.
*/
private RenditionLocationImpl createNodeLocation(NodeRef destination)
{
NodeService nodeService = serviceRegistry.getNodeService();
if(nodeService.exists(destination)==false)
throw new RenditionServiceException("The rendition destination node does not exist! NodeRef: "+destination);
NodeRef parentRef = nodeService.getPrimaryParent(destination).getParentRef();
String destinationCmName = (String) nodeService.getProperty(destination, ContentModel.PROP_NAME);
RenditionLocationImpl location = new RenditionLocationImpl(parentRef, destination, destinationCmName);
return location;
}
示例6: getPersonFullName
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
* Faster helper when the script just wants to build the Full name for a person.
* Avoids complete getProperties() retrieval for a cm:person.
*
* @param username the username of the person to get Full name for
* @return full name for a person or null if the user does not exist in the system.
*/
public String getPersonFullName(final String username)
{
String name = null;
ParameterCheck.mandatoryString("Username", username);
final NodeRef personRef = personService.getPersonOrNull(username);
if (personRef != null)
{
final NodeService nodeService = services.getNodeService();
final String firstName = (String)nodeService.getProperty(personRef, ContentModel.PROP_FIRSTNAME);
final String lastName = (String)nodeService.getProperty(personRef, ContentModel.PROP_LASTNAME);
name = (firstName != null ? firstName + " " : "") + (lastName != null ? lastName : "");
}
return name;
}
示例7: create
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
public static SiteState create(SiteInfo siteInfo, Map<String, String> members, String currentUser,
NodeService nodeService, PersonService personService)
{
SiteState result = new SiteState();
result.members = new ArrayList<MemberState>(members.size());
result.siteInfo = siteInfo;
boolean found = false;
Set<String> siteMembers = members.keySet();
for (String userName : siteMembers)
{
NodeRef person = personService.getPersonOrNull(userName);
if (person != null)
{
String firstName = (String) nodeService.getProperty(person, ContentModel.PROP_FIRSTNAME);
String lastName = (String) nodeService.getProperty(person, ContentModel.PROP_LASTNAME);
result.members.add(new MemberState(userName, firstName, lastName));
}
if (!found && userName.equals(currentUser))
{
found = true;
result.currentUserSiteManager = true;
}
}
return result;
}
示例8: executeImpl
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
NodeService nodeService = this.serviceRegistry.getNodeService();
if (nodeService.exists(actionedUponNodeRef))
{
NodeRef scriptRef = (NodeRef)action.getParameterValue(PARAM_SCRIPTREF);
NodeRef spaceRef = this.serviceRegistry.getRuleService().getOwningNodeRef(action);
if (spaceRef == null)
{
// the actionedUponNodeRef may actually be a space
if (this.serviceRegistry.getDictionaryService().isSubClass(
nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_FOLDER))
{
spaceRef = actionedUponNodeRef;
}
else
{
spaceRef = nodeService.getPrimaryParent(actionedUponNodeRef).getParentRef();
}
}
if (this.scriptLocation != null || (scriptRef != null && nodeService.exists(scriptRef) == true))
{
// get the references we need to build the default scripting data-model
String userName = this.serviceRegistry.getAuthenticationService().getCurrentUserName();
NodeRef personRef = this.personService.getPerson(userName);
NodeRef homeSpaceRef = (NodeRef)nodeService.getProperty(personRef, ContentModel.PROP_HOMEFOLDER);
// the default scripting model provides access to well known objects and searching
// facilities - it also provides basic create/update/delete/copy/move services
Map<String, Object> model = this.serviceRegistry.getScriptService().buildDefaultModel(
personRef,
getCompanyHome(),
homeSpaceRef,
scriptRef,
actionedUponNodeRef,
spaceRef);
// Add the action to the default model
ScriptAction scriptAction = new ScriptAction(this.serviceRegistry, action, this.actionDefinition);
model.put("action", scriptAction);
model.put("webApplicationContextUrl", UrlUtil.getAlfrescoUrl(sysAdminParams));
Object result = null;
if (this.scriptLocation == null)
{
// execute the script against the default model
result = this.serviceRegistry.getScriptService().executeScript(
scriptRef,
ContentModel.PROP_CONTENT,
model);
}
else
{
// execute the script at the specified script location
result = this.serviceRegistry.getScriptService().executeScript(this.scriptLocation, model);
}
// Set the result
if (result != null)
{
action.setParameterValue(PARAM_RESULT, (Serializable)result);
}
}
}
}
示例9: testLifecycleOfXmlMetadataExtraction
import org.alfresco.service.cmr.repository.NodeService; //導入方法依賴的package包/類
/**
* Tests metadata extraction using an action with an EAGER MetadataExtracter for XML.
*/
public void testLifecycleOfXmlMetadataExtraction() throws Exception
{
NodeService nodeService = serviceRegistry.getNodeService();
ContentService contentService = serviceRegistry.getContentService();
ActionExecuter executer = (ActionExecuter) ctx.getBean("extract-metadata");
Action action = new ActionImpl(null, GUID.generate(), SetPropertyValueActionExecuter.NAME, null);
StoreRef storeRef = new StoreRef("test", getName());
NodeRef rootNodeRef = null;
if (nodeService.exists(storeRef))
{
rootNodeRef = nodeService.getRootNode(storeRef);
}
else
{
nodeService.createStore("test", getName());
rootNodeRef = nodeService.getRootNode(storeRef);
}
// Set up some properties
PropertyMap properties = new PropertyMap();
properties.put(ContentModel.PROP_TITLE, "My title");
properties.put(ContentModel.PROP_DESCRIPTION, "My description");
NodeRef contentNodeRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, getName()),
ContentModel.TYPE_CONTENT,
properties).getChildRef();
// Add some content
ContentReader alfrescoModelReader = getReader(FILE_ALFRESCO_MODEL);
assertTrue(alfrescoModelReader.exists());
ContentWriter writer = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, true);
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
writer.putContent(alfrescoModelReader);
// Execute the action
executer.execute(action, contentNodeRef);
// Check the node's properties. The EAGER overwrite policy should have replaced the required
// properties.
String checkTitle = (String) nodeService.getProperty(contentNodeRef, ContentModel.PROP_TITLE);
String checkDescription = (String) nodeService.getProperty(contentNodeRef, ContentModel.PROP_DESCRIPTION);
assertEquals("fm:forummodel", checkTitle);
assertEquals("Forum Model", checkDescription);
}