- * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun - * ServiceBuilder to copy their definitions into the - * {@link it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti} interface. + * Helper methods and all application logic should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti} interface. *
* * @author 3F Consulting */ -@SuppressWarnings("serial") public class RichiestaAccessoAttiImpl extends RichiestaAccessoAttiBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this class directly. All methods that expect a richiesta accesso atti model - * instance should use the {@link it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti} interface instead. + * NOTE FOR DEVELOPERS: + * + * Never reference this class directly. All methods that expect a richiesta accesso atti model instance should use the {@link it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti} interface instead. */ public RichiestaAccessoAttiImpl() { } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java index 080da7c6..27bdb870 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/impl/RichiestaAccessoAttiLocalServiceImpl.java @@ -37,173 +37,211 @@ import com.liferay.portal.service.OrganizationLocalServiceUtil; * The implementation of the richiesta accesso atti local service. * *- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy - * their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalService} - * interface. + * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalService} interface. * *
- * This is a local service. Methods of this service will not have security checks based on the propagated JAAS - * credentials because this service can only be accessed from within the same VM. + * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM. *
* * @author 3F Consulting * @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiLocalServiceBaseImpl * @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil */ -public class RichiestaAccessoAttiLocalServiceImpl extends RichiestaAccessoAttiLocalServiceBaseImpl { +public class RichiestaAccessoAttiLocalServiceImpl +extends RichiestaAccessoAttiLocalServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso - * atti local service. + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiLocalServiceUtil} to access the richiesta accesso atti local service. */ - @Override - public List- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy - * their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiService} interface. + * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiService} interface. * *
- * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS - * credentials because this service can be accessed remotely. + * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely. *
* * @author 3F Consulting * @see it.tref.liferay.portos.accesso.atti.service.base.RichiestaAccessoAttiServiceBaseImpl * @see it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil */ -public class RichiestaAccessoAttiServiceImpl extends RichiestaAccessoAttiServiceBaseImpl { +public class RichiestaAccessoAttiServiceImpl + extends RichiestaAccessoAttiServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti - * remote service. + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link it.tref.liferay.portos.accesso.atti.service.RichiestaAccessoAttiServiceUtil} to access the richiesta accesso atti remote service. */ } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/persistence/RichiestaAccessoAttiPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/persistence/RichiestaAccessoAttiPersistenceImpl.java index 5d8232f9..6765ce2f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/persistence/RichiestaAccessoAttiPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/service/persistence/RichiestaAccessoAttiPersistenceImpl.java @@ -43,7 +43,6 @@ import it.tref.liferay.portos.accesso.atti.NoSuchRichiestaAccessoAttiException; import it.tref.liferay.portos.accesso.atti.model.RichiestaAccessoAtti; import it.tref.liferay.portos.accesso.atti.model.impl.RichiestaAccessoAttiImpl; import it.tref.liferay.portos.accesso.atti.model.impl.RichiestaAccessoAttiModelImpl; -import it.tref.liferay.portos.accesso.atti.service.persistence.RichiestaAccessoAttiPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java index 9f1bf01c..e69c92d6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/AccessoAttiAccessTokenUtil.java @@ -8,24 +8,34 @@ import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.StringPool; public class AccessoAttiAccessTokenUtil { - + private static final Log _log = LogFactoryUtil.getLog(AccessoAttiAccessTokenUtil.class); - - public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId) { - + + public static String generateAccessToken(long richiestaAccessoAttiId, String numeroProgetto, long richiedenteUserId){ + StringBuffer sb = new StringBuffer(); + try { - String concatString = String.valueOf(richiestaAccessoAttiId) + StringPool.UNDERLINE + numeroProgetto - + StringPool.UNDERLINE + richiedenteUserId; + + String concatString = String.valueOf(richiestaAccessoAttiId) + StringPool.UNDERLINE + + numeroProgetto + StringPool.UNDERLINE + richiedenteUserId; + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(concatString.getBytes()); - byte byteData[] = md.digest(); - for (int i = 0; i < byteData.length; i++) { - sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); - } + + byte byteData[] = md.digest(); + + for (int i = 0; i < byteData.length; i++) { + sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1)); + } + } catch (NoSuchAlgorithmException e) { - _log.error(e, e); + _log.error(e,e); } + return sb.toString(); + } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java index f9e80da6..1412700f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/accesso/atti/uti/DocumentLibraryUtil.java @@ -17,48 +17,62 @@ import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil; public class DocumentLibraryUtil { - + public static Log _log = LogFactoryUtil.getLog(DocumentLibraryUtil.class); public static final String RICHIESTA_ATTI_FOLDER_NAME = "RICHIESTA_ATTI"; public static final String PAGAMENTO_CODEC_FILENAME = "PAGAMENTO_"; public static final String DOCUMENTO_CODEC_FILENAME = "DOCUMENTO_"; - - public static long saveFileEntryAccessoAtti(long companyGroupId, long richiestaAccessoAttiId, - String originFileName, File file, boolean pagamento) { - + + public static long saveFileEntryAccessoAtti(long companyGroupId, long richiestaAccessoAttiId, String originFileName, + File file, boolean pagamento) { + long fileEntryId = 0L; + try { DLFolder folder = getRichiestaAttiFolder(companyGroupId); - if (folder != null) { - RichiestaAccessoAtti richiestaAccessoAtti = RichiestaAccessoAttiLocalServiceUtil - .fetchRichiestaAccessoAtti(richiestaAccessoAttiId); - if (richiestaAccessoAtti != null) { + if(folder != null){ + + RichiestaAccessoAtti richiestaAccessoAtti = + RichiestaAccessoAttiLocalServiceUtil.fetchRichiestaAccessoAtti(richiestaAccessoAttiId); + + if(richiestaAccessoAtti != null){ + ServiceContext serviceContext = new ServiceContext(); serviceContext.setCompanyId(richiestaAccessoAtti.getCompanyId()); serviceContext.setUserId(richiestaAccessoAtti.getUserId()); + String mineType = FileUtil.getExtension(originFileName); + String prefixedFileName = ""; - if (pagamento) { + if(pagamento){ prefixedFileName = PAGAMENTO_CODEC_FILENAME + richiestaAccessoAttiId + "." + mineType; } else { prefixedFileName = DOCUMENTO_CODEC_FILENAME + richiestaAccessoAttiId + "." + mineType; } - FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry(richiestaAccessoAtti.getUserId(), - folder.getRepositoryId(), folder.getFolderId(), prefixedFileName, mineType, - prefixedFileName, "", "", file, serviceContext); + + FileEntry fileEntry = DLAppLocalServiceUtil.addFileEntry( + richiestaAccessoAtti.getUserId(), folder.getRepositoryId(), folder.getFolderId(), + prefixedFileName, mineType, prefixedFileName, "", "", file, serviceContext); + fileEntryId = fileEntry.getFileEntryId(); + } } + } catch (PortalException | SystemException e) { - _log.error(e, e); + _log.error(e,e); } + return fileEntryId; + } - - private static DLFolder getRichiestaAttiFolder(long companyGroupId) throws PortalException, SystemException { - + + private static DLFolder getRichiestaAttiFolder(long companyGroupId) throws PortalException, SystemException{ + DLFolder folder = DLFolderLocalServiceUtil.getFolder(companyGroupId, 0L, RICHIESTA_ATTI_FOLDER_NAME); + return folder; } + } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/action_button.jsp b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/action_button.jsp index 66343e7c..b6e680b7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/action_button.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/action_button.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%> <%@page import="com.liferay.portal.kernel.util.HtmlUtil"%> <%@include file="init.jsp" %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp index c10be4dd..0a37c540 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-accesso-atti-portlet/docroot/html/accesso_atti_bo/add_richiesta.jsp @@ -1,4 +1,3 @@ -<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="init.jsp" %>- * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy - * their definitions into the {@link it.tref.portos.calendar.appointments.service.DisponibilitaService} interface. + * All custom service methods should be put in this class. Whenever methods are added, rerun + * ServiceBuilder to copy their definitions into the + * {@link it.tref.portos.calendar.appointments.service.DisponibilitaService} interface. + * *
- * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS - * credentials because this service can be accessed remotely. + * This is a remote service. Methods of this service are expected to have security checks based on + * the propagated JAAS credentials because this service can be accessed remotely. *
* * @author 3F Consulting @@ -56,109 +63,127 @@ import com.liferay.portal.service.UserLocalServiceUtil; */ public class DisponibilitaServiceImpl extends DisponibilitaServiceBaseImpl { /* - * NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link - * it.tref.portos.calendar.appointments.service.DisponibilitaServiceUtil} to access the disponibilita remote - * service. + * NOTE FOR DEVELOPERS: + * + * Never reference this interface directly. Always use {@link + * it.tref.portos.calendar.appointments.service.DisponibilitaServiceUtil} to access the + * disponibilita remote service. */ - + private static Log _log = LogFactoryUtil.getLog(DisponibilitaServiceImpl.class); - @Override public Disponibilita addDisponibilita(long userId, long funzionarioId, Date startDate, Date endDate, long presidio, ServiceContext serviceContext) throws SystemException, PortalException { - return disponibilitaLocalService.addDisponibilita(userId, funzionarioId, startDate, endDate, presidio, - serviceContext); + return disponibilitaLocalService.addDisponibilita(userId, funzionarioId, startDate, endDate, presidio, serviceContext); } - @Override public List